Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我什至不确定这是否可能,但我说我有一些 XML:
<source> <list> <element id="1"/> </list> </source>
我想插入列表:
<element id="2"/>
我可以编写一个 XSLT 来执行此操作吗?
将这 2 个模板定义添加到 XSLT 文件中:
<xsl:template match="@*|node()"> <xsl:copy> <xsl:apply-templates select="@*|node()"/> </xsl:copy> </xsl:template> <xsl:template match="list"> <list> <xsl:apply-templates select="@* | *"/> <element id="2"/> </list> </xsl:template>