Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


XSLT evaluate XPath from a string

From: Mycroft@-----------.---------.---
To: NULL
Date: 8/19/2008 1:19:00 PM

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
Digg
delicious
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