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

RE: function-available() problem while using Saxon

Subject: RE: function-available() problem while using Saxon
From: "Michael Kay" <mike@xxxxxxxxxxxx>
Date: Tue, 21 Jun 2005 22:13:23 +0100
saxon evaluate node
Curious.

Stylesheet:

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"  
version="2.0">
<xsl:template match="/">     
      <ans><xsl:value-of select="function-available('saxon:evaluate-node')" 
                    xmlns:saxon="http://saxon.sf.net/"/></ans>
</xsl:template>
</xsl:stylesheet>

Command:

java -jar c:\saxon-build\saxon8.3\saxon-b\saxon8.jar -t test.xsl test.xsl

Result:

Saxon 8.3 from Saxonica
Java version 1.5.0
Stylesheet compilation time: 641 milliseconds
Processing file:/c:/temp/test.xsl
Building tree for file:/c:/temp/test.xsl using class
net.sf.saxon.tinytree.TinyBuilder
Tree built in 0 milliseconds
Tree size: 9 nodes, 21 characters, 3 attributes
<?xml version="1.0" encoding="UTF-8"?><ans>true</ans>
Execution time: 70 milliseconds

A possible explanation is that you are running with extension functions
disabled: how is Saxon being invoked? Another possibility is that you aren't
actually running Saxon at all - add a call on system-property('xsl:vendor')
to the stylesheet to check.

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

 

> -----Original Message-----
> From: Arian Hojat [mailto:arianhojat2000@xxxxxxxxx] 
> Sent: 21 June 2005 21:18
> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Subject: RE:  function-available() problem while using Saxon
> 
> Hey,
> 
> > What namespace URI is bound to the prefix "saxon"
> 
> I bind http://saxon.sf.net/ to saxon
> ...
> <xsl:stylesheet version="2.0"
> xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
> xmlns:dyn="http://exslt.org/dynamic"
> xmlns:saxon="http://saxon.sf.net/">
> 
> > Which version of
> > Saxon are you using? 
> "Saxon 8.3 from Saxonica"
> 
> Thanks,
> Arian
> 
> 
> 
> 
> --- Michael Kay <mike@xxxxxxxxxxxx> wrote:
> 
> > 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:  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
> > 
> > 
> 
> 
> 
> 		
> ____________________________________________________ 
> Yahoo! Sports 
> Rekindle the Rivalries. Sign up for Fantasy Football 
> http://football.fantasysports.yahoo.com

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.