Hi,
I'm passing in a bunch of key-value pairs as parameters to a XSL (date -> "20th January", author -> "Dominic Rodger", ...).
These are referenced in some XML I'm parsing - the XML looks like this:
<element datasource="date" />
At present, I can't work out how to get 20th January out of these except with a horrible <xsl:choose>
statement:
<xsl:template match="element">
<xsl:choose>
<xsl:when test="@datasource = 'author'">
<xsl:value-of select="$author" />
</xsl:when>
<xsl:when test="@datasource = 'date'">
<xsl:value-of select="$date" />
</xsl:when>
...
</xsl:choose>
</xsl:template>
I'd like to use something like:
<xsl:template match="element">
<xsl:value-of select="${@datasource}" />
</xsl:template>
But I suspect this isn't possible. I'm opening to using external function calls, but want to avoid having to enumerate all possible map keys in my XSL. Any ideas?
Thanks,
Dom