Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


Re: XSLT evaluate XPath from a string

From: "Joe Fawcett" <joefawcett@---------.------>
To: NULL
Date: 8/20/2008 8:17:00 AM

XSLT 2.0 has no facility to do this either. Some processors have extension 
functions built in that do this, Saxon for instance has saxon:evaluate(). If 
you are using MSXML you can write an extension function in script, if using 
XML.NET then you can use a .NET language.
It also might be useful to see what you tried in EXSLT that failed.

-- 

Joe Fawcett (MVP - XML)

http://joe.fawcett.name

"Mycroft" <Mycroft@d...> wrote in message 
news:C00EE749-5633-46D5-A51F-64351B23028A@m......
>I need to pull XPath from strings obtained from the XML data source. A
> typical query might look like:
>
> XML:
> <library>
> <books>
> <book title="A" type="science fiction"/>
> <book title="B" type="fantasy"/>
> <book title="C" type="romance"/>
> <book title="D" type="science fiction"/>
> <book title="E" type="Christianity"/>
> </books>
> <librarian>
> <defaultXPath>//book[type="Christianity"]</defaultXPath>
> </librarian>
> </library>
>
> XSLT (works):
> <xsl:variable name="Books">
> <xsl:apply-templates select="//book[type="Christianity"]"/>
> </xsl:variable>
>
> XSLT (fails):
> <xsl:apply-templates select="//librarian/defaultXPath"/>
> <xsl:apply-templates select="{//librarian/defaultXPath}"/>
>
>
> The problem is that the apply-templates command process the string as a 
> data
> island rather than interpreting the string as an XPath query.
>
> I have tried using code from EXSLT but that has not worked and everything 
> I
> read suggests that XSLT 2.0 might have a method to perform this operation,
> but I find no examples.
>
> Any suggestions?
> 




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