XPath error with xsltproc/libxslt

L

Loudin

Hello,

I`ve got Problems with Xpath and xsltproc/libxslt.

I have got a variable with tags in my Style sheet and later in the same
Style sheet i want to work with this tags using a <xsl:for-each>. Here is a
example:



<xsl:variable name="posinfo">

<pos tagname="dummy1" postypes="123"/>

<pos tagname="dummy2" postypes="456"/>

<pos tagname="dummy3" postypes="789"/>

</xsl:variable>



<xsl:for-each select="$posinfo/pos">

<POS>...</POS>

</xsl:for-each>

I am using saxon and with saxon the for-each works correctly. But I want to
change to xsltproc, because it ist faster. But with xsltproc I am getting
the message: "XPath error : Invalide type". Does somebody know, how i can
fix this error?

thanks for your attention.

with kind regards,

Loudin
 
D

David Carlisle

Loudin said:
Hello,

I`ve got Problems with Xpath and xsltproc/libxslt.

I have got a variable with tags in my Style sheet and later in the same
Style sheet i want to work with this tags using a <xsl:for-each>. Here is a
example:



<xsl:variable name="posinfo">

<pos tagname="dummy1" postypes="123"/>

<pos tagname="dummy2" postypes="456"/>

<pos tagname="dummy3" postypes="789"/>

</xsl:variable>



<xsl:for-each select="$posinfo/pos">

<POS>...</POS>

</xsl:for-each>

I am using saxon and with saxon the for-each works correctly.

Presumably you are using saxon 8 (which implements xslt2) or specifying
version="1.1" on xsl:stylesheet with saxon 6. (XSLT 1.1 never existed
but saxon 6 implements a draft of it. This draft and the draft xslt2
implemented by saxon8 both allow this syntax.
But I want to
change to xsltproc, because it ist faster. But with xsltproc I am getting
the message: "XPath error : Invalide type". Does somebody know, how i can
fix this error?

I believe xsltproc has a node-set extension function, in which case you
need to convert the result tree fragment into a node set, something like

<xsl:for-each select="x:node-set($posinfo)/pos">

whateverr xmlns:x="whatever xsltproc's extension namespace is"
thanks for your attention.

with kind regards,

Loudin

To do it without extension functions, put
<x>
<pos tagname="dummy1" postypes="123"/>
<pos tagname="dummy2" postypes="456"/>
<pos tagname="dummy3" postypes="789"/>
</x>
in foo.xml and use

<xsl:for-each select="document('foo.xml')/x/pos">


David
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,733
Messages
2,569,440
Members
44,830
Latest member
ZADIva7383

Latest Threads

Top