RESOLVED: Using param value in xpath
I have the following
Code:
<?xml version="1.0"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="html" indent="yes" encoding="UTF-8"/>
<xsl:param name="myvar"/>
<xsl:template match="/">
<html>
<body>
<xsl:for-each select="strings/$myvar">
<p><xsl:value-of select="."/></p>
</xsl:for-each>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
What i want to do is to use the $myvar in the xpath expression. Its marked in bold, but that gives me an error. I tried the concat function, but that did also didnt work. What am I doing wrong?
UPDATE, found the following solution:
Code:
<xsl:param name="query"/>
<xsl:template match="/">
<html>
<body>
<xsl:for-each select="/strings/*[name()=$query]">
<p><xsl:value-of select="."/></p>
</xsl:for-each>
</body>
</html>
</xsl:template>