xsl:variable xsl:copy-of select
- by user1901345
I have the following XML:
Picture 1
Picture 2
Picture 3
While this XSL does what is expected (output the attr of the first picture):
It seems to be not possible to do the same inside the variable declaration using xsl:copy-of:
Curious:
If I just select "$FirstPicture" instead of "$FirstPicture/@attr" in the second example, it outputs the text node of Picture 1 as expected...
Before you all suggest me to rewrite the code:
This is just a simplified test, my real aim is to use a named template to select a node into the variable FirstPicture and reuse it for further selections.
I hope someone could help me to understand the behavior or could suggest me a proper way to select a node with code which could be easily reused (the decission which node is the first one is complex in my real application). Thanks.