我想在 xslt 的 select 语句中使用动态变量名。
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/>
<xsl:template match="/">
<xsl:variable name="input" select="input/message" />
<xsl:variable name="Name" select="'MyName'" />
<xsl:variable name="Address" select="MyAddress" />
<xsl:variable name="output" select="concat('$','$input')" /> <!-- This is not working -->
<output>
<xsl:value-of select="$output" />
</output>
</xsl:template>
变量“输入”的可能值是“名称”或“地址”。输出变量的 select 语句应该有一个基于输入变量值的动态变量名。我不想使用 xsl:choose。我想动态选择值。请给我一个解决方案。
谢谢,迪努