【发布时间】:2015-01-10 13:05:52
【问题描述】:
我是 XSL 新手,遇到了一个问题。
我有一个如下格式的 xml:
<Destinations>
<conf:Destination id="12">
<conf:attributes>
<conf:attribute1>1212</conf:attribute1>
</conf:attributes>
</conf:Destination>
<conf:Destination id="31">
<conf:attributes>
<conf:attribute1>3131</conf:attribute1>
</conf:attributes>
</conf:Destination>
</Destinations>
说,我有一个带有以下 2 个参数的 xsl:
<xsl:param name="attribute12" select="'21'" />
<xsl:param name="attribute31" select="'5'" />
我想在 XSLT 1 中有一个 xsl 模板来更改我的 xml,如下所示: 1) 对于 xml 中的目标 id=12,将 'conf:attribute1' 标记内的值设置为 21 2) 对于 xml 中的目标 id=31,'conf:attribute1' 标签内的值设置为 5
这样我将得到最终的 xml:
<Destinations>
<conf:Destination id="12">
<conf:attributes>
<conf:attribute1>21</conf:attribute1>
</conf:attributes>
</conf:Destination>
<conf:Destination id="31">
<conf:attributes>
<conf:attribute1>5</conf:attribute1>
</conf:attributes>
</conf:Destination>
</Destinations>
有人可以帮忙吗。
【问题讨论】:
-
为什么在询问 XSLT 1 时问题被标记为
xslt-2.0? -
谢谢,已更正。对此有任何帮助..