RE: [xsl] function-available() problem while using Saxon

Subject: RE: [xsl] function-available() problem while using Saxon
From: "Michael Kay" <mike@xxxxxxxxxxxx>
Date: Tue, 21 Jun 2005 20:56:41 +0100
What namespace URI is bound to the prefix "saxon", and which version of
Saxon are you using? (You can find out using the -t option).

Michael Kay
http://www.saxonica.com/ 

> -----Original Message-----
> From: Arian Hojat [mailto:arianhojat2000@xxxxxxxxx] 
> Sent: 21 June 2005 20:15
> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Subject: [xsl] function-available() problem while using Saxon
> 
> Hello all,
> One last question for the day hopefully.
> 
> I deciding since I might be using FOP(which uses
> Xalan) and at some points be using Saxon to see whats
> wrong in my .fo output, that I would see which
> extension function is available and use it
> accordingly.
> Xalan checks to see if saxon:evaluate-node is
> available 1st and fails. Then dyn:evaluate is
> available and correctly used.
> 
> In Saxon, it checks to see if saxon:evaluate-node is
> available and FAILS?, then I believe tries to USE
> dyn:evaluate and errors? It shouldn't even get to the
> point of using dyn:evaluate since it isn't available
> right? (i am prob doing something very wrong). I
> should mention I do put saxon: and dyn: namespaces in
> the top of the xsl I am using, so thats not the
> problem.
> 
> XP0003: XPath syntax error at char 18 on line 200 in
> {dyn:evaluate($exp)}:
>   Cannot find a matching 1-argument function named
> {http://exslt.org/dynamic}evaluate()
> 
> 
> ###part that selects what function to use
> <xsl:choose>
>   <xsl:when
> test="function-available('saxon:evaluate-node')"><xsl:for-each
> select="document(@href)/Document">
> <xsl:apply-templates
> select="saxon:evaluate-node($exp)"/>
> </xsl:for-each></xsl:when>
>   <xsl:when
> test="function-available('dyn:evaluate')"><xsl:for-each
> select="document(@href)/Document">
> <xsl:apply-templates select="dyn:evaluate($exp)"/>
> </xsl:for-each></xsl:when>
>   <xsl:otherwise><xsl:message>EXSLT:EVALUATE() OR
> SAXON:EVALUATE-NODE() NOT FOUND IN YOUR XSL
> PROCESSOR</xsl:message></xsl:otherwise>
> </xsl:choose>
> 
> 
> Thanx again to the xsl list and Michael Kay
> 
> 
> Unrelated Note if someone notices I could use a
> simpler template for Saxon: I dont use that simple
> template like below because if Xalan is being used, it
> will not like the 'function call as a step in the
> xpath' as it parses beforehand, so i keep it as is.
> <xsl:apply-templates
> select="document(@href)/Document/saxon:evaluate-node(current()
> /@nodes))"/>
> 
> 
> 
> 		
> __________________________________ 
> Discover Yahoo! 
> Have fun online with music videos, cool games, IM and more. 
> Check it out! 
> http://discover.yahoo.com/online.html

Current Thread