【发布时间】:2017-01-27 11:16:32
【问题描述】:
INPUT.xml
<human gender="male" nationality="american">
<property>blank</property>
</human>
(所需)OUTPUT.xml
<human gender="male" nationality="american">
<property>blank</property>
</human>
<person gender="female" nationality="british">
<property>blank</property>
</person>
大家好,以上是我想要的转换。 到目前为止,我有以下 xsl:
<xsl:template match="human">
<xsl:copy>
<xsl:apply-templates select="node()|@*"/>
</xsl:copy>
<person>
<xsl:apply-templates select="node()|@*"/>
</person>
</xsl:template>
但是我如何去替换属性值 我尝试使用 xsl:choose 但没有运气
【问题讨论】:
-
您想要的输出文档不是格式良好的 XML 文档,我建议您 a) 生成具有单个最外层元素的文档(其中包含其他所有元素)或 b) 不命名它
*.xml。另外,请展示一个完整的、最小的 XSLT 样式表。谢谢。更多帮助:stackoverflow.com/help/mcve.