Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


Re: XPath error with xsltproc/libxslt

From: David Carlisle <davidc@---.--.-->
To: NULL
Date: 7/1/2005 9:28:00 AM
"Loudin" <patrick.loudin@s...> writes:

> 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


transparent
Print
Mail
Like It
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent