[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Saxon extension functions

Subject: Saxon extension functions
From: Michel Hendriksen <michel.hendriksen@xxxxxxxxx>
Date: Fri, 10 Dec 2010 13:38:30 +0100
 Saxon extension functions
Hi all,

New topic. I made an extension function which is working in SaxonB.
When porting this to SaxonHE, where it is not supported, I get an
error that a matching function cant be found. This is expected. But
I'm testing for support of this and that seems to pass. So how do I
test for existing support? See my code below.

<xslt:template name="seed">
	<!-- Works with SaxonB only! -->
	<xslt:choose>
		<xslt:when test="function-available('date:new') and
function-available('date:get-time')" xmlns:date="java:java.util.Date">
			<xslt:variable name="date" select="date:new()"/>
			<xslt:value-of select="date:get-time($date)"/>
		</xslt:when>
		<xslt:otherwise>
			<!-- NOT random at all.....to be replaced by something else -->
			<xslt:variable name="time" select="current-time()" />
			<xslt:value-of select="seconds-from-time($time) + 60 *
minutes-from-time($time) + 3600 * hours-from-time($time)"/>
		</xslt:otherwise>
	</xslt:choose>
</xslt:template>

Error

Error at xslt:variable on line 64 column 52 of selector.xsl:
  XPST0017 XPath syntax error at char 0 on line 64 in {date:new()}:
    Cannot find a matching 0-argument function named
{java:java.util.Date}new(). Note that
  direct calls to Java methods are not available under Saxon-HE
Error at xslt:value-of on line 65 column 50 of selector.xsl:
  XPST0017 XPath syntax error at char 0 on line 65 in {date:get-time($date)}:
    Cannot find a matching 1-argument function named
{java:java.util.Date}get-time(). Note
  that direct calls to Java methods are not available under Saxon-HE

line 64/65 are

			<xslt:variable name="date" select="date:new()"/>
			<xslt:value-of select="date:get-time($date)"/>

So within test.

Michel Hendriksen
Kensas bv

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.