How do you make use of a variable in xsl when attempting to select a node?

I would certainly have assumed this would certainly be a very easy one to Google, yet I've been unsucessful.

I intend to assign a variable the value out of a feature (very easy until now) after that make use of that variable to select an additional node based upon the value of that feature.


<xsl:variable name="myId" select="@id" />
<xsl value-of select="//Root/Some/Other/Path/Where[@id='{@myId}']/@Name />

That does not function. If I change the @myId with the value that remains in the variable after that it does locate the appropriate node, yet doign it in this manner generates absolutely nothing. I'm certain I'm missing out on something, or probably there is a various means to do it.

The context is that there relates information under various leading - degree nodes that share the very same id value so I require to get the relevant nodes in my layout.

2019-05-13 02:41:03
Source Share
Answers: 1

Ok, I ultimately figured it out. Foolish trouble actually, I merely required to omit the quotes and also the dental braces. Among those times when I assumed that I would certainly currently attempted that. :D Oh, and also I mistyped @myId in the first instance, the code was in fact $myId.

<xsl:variable name="myId" select="@id" />
<xsl value-of select="//Root/Some/Other/Path/Where[@id=$myId]/@Name" />
2019-05-13 18:43:38