I have a constant and a variable that I wann mouch together to select a specific node, this is what I want to do:
<xsl:attribute name="value">
<xsl:value-of>
<xsl:attribute name="select">
<xsl:text>/root/meta/url_params/
<xsl:value-of select="$inputid" />
</xsl:attribute>
</xsl:value-of>
</xsl:attribute>
How come it doesn’t work, and what could I do instad?
While @Alejandro is right that in the general case dynamic evaluation will be needed (and this may be provided in XSLT 2.1+), there are manageable simpler cases.
For example, if
$inputidcontains just a name, you probably want this:We can implement a rather general dynamic XPath evaluator if we only restrict each location path to be an element name:
when this transformation is applied on this XML document:
the wanted, correct result is produced: