xsl-list
[Top] [All Lists]

RE: function-available() problem while using Saxon

2005-06-21 14:13:23
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(_at_)yahoo(_dot_)com] 
Sent: 21 June 2005 21:18
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: RE: [xsl] 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(_at_)saxonica(_dot_)com> 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(_at_)yahoo(_dot_)com] 
Sent: 21 June 2005 20:15
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
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



--~------------------------------------------------------------------
XSL-List info and archive: 
http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to:
http://lists.mulberrytech.com/xsl-list/
or e-mail:
<mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--






--~------------------------------------------------------------------
XSL-List info and archive: 
http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to:
http://lists.mulberrytech.com/xsl-list/
or e-mail:
<mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--





              
____________________________________________________ 
Yahoo! Sports 
Rekindle the Rivalries. Sign up for Fantasy Football 
http://football.fantasysports.yahoo.com

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: 
<mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--





--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--