Hi,
I do have a snippet like this:
Code:
<xsl:for-each select="('option1', 'option2')">
<xsl:value-of select="/root/to/some/element"/>
</xsl:for-each>
The, example per se is obviously pretty useless but perfectly illustrates my problem. The error I get is the following:
Code:
XPTY0020: Leading '/' cannot select the root node of the tree containing the context item: the context item is an atomic value
I do understand why this error occurs and what it's telling me but I don't know a way around it. I tried using a variable like this:
Code:
<xsl:variable name="helper" as="element()+">
<item>option1</item><item>option2</item>
</xsl:variable>
Iterating over that variable instead of my atomic sequence did work, but accessing "/root/to/some/element" obviously failed:
Code:
net.sf.saxon.trans.XPathException: The root of the tree containing the context item is not a document node
(Yeah I assume the last try was pretty desperate ;))
Is there a way to access the document node in my loop?
Thanks in advance,
Florian
P.S.: The only way I found was putting / into a variable before entering the loop, but that's somewhat ugly imo.