开发者

Dynamic path in document function()

开发者 https://www.devze.com 2023-01-03 19:43 出处:网络
The XML file name is specific but I need to build a dynamic path.I have tried using a variable to build the path but it didn\'t work:

The XML file name is specific but I need to build a dynamic path. I have tried using a variable to build the path but it didn't work:

<xsl:variable name="path">
   ...conditional c开发者_开发知识库ode
</xsl:variable>     <xsl:value-of select="document('myXML.xml')/worksheets/$path"/> 

2.0 solutions ok.


Evaluation of any dynamically-generated XPath expression is not supported by the XSLT 1.0 or XSLT 2.0 standards. It will be supported in XSLT 2.1.

If the dynamically-generated XPath expression is not too complex, the technique in this answer can be used successfully:

Retrieving XML node from a path specified in an attribute value of another node


You need an extension function, XPath 2.0 does not support dynamic compilation/evaluation. Saxon has saxon:evaluate. Even if your processor does not support such function you might be able to implement it yourself as an extension function.

0

精彩评论

暂无评论...
验证码 换一张
取 消