[xslt] problem with key and position() function




Hi folks, I am encoutering a problem when using the
function position() with the result of a key().

Here is the xml file to process :

<?xml version="1.0" encoding="ISO-8859-1"?>
<doc>
   <a id="first"/>
   <a id="second"/>
</doc>

Here is the stylesheet :

<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"; version="1.0">
    <xsl:output method="xml" indent="yes" encoding="ISO-8859-1"/>
   <xsl:key name="match_a" match="a" use="@id"/>
<xsl:template match="/">
         <xsl:apply-templates/>
   </xsl:template>

   <xsl:template match="doc">
       <result>
           <xsl:value-of select="position(key('match_a','second'))"/>
       </result>
   </xsl:template>
</xsl:stylesheet>

Here is what i got when launching the transformation :

portmottelet-hz-1:~$ xsltproc test.xsl test.xml
XPath error : Invalid number of arguments
runtime error: file test.xsl line 16 element value-of
xsltValueOf: text copy failed
no result for test.xml

Is it  a bug, or am I missing something. I would expect to get the result :

<result>2</result>

Thanks for help

Using libxml 20616, libxslt 10111 and libexslt 809
xsltproc was compiled against libxml 20616, libxslt 10111 and libexslt 809
libxslt 10111 was compiled against libxml 20616
libexslt 809 was compiled against libxml 20616



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]