1
我想将XSL模板应用于XML的一部分,并将未修改的其余部分复制到结果XML中。使用XSL复制XML的部分而不应用模板
暂时我正在做一些工作。
<xsl:template match="yt:bold">
<xsl:choose>
<xsl:when test="ancestor::ReportContent"> //I keep the ReportContent unchanged
<xsl:copy><xsl:copy-of select="@*"/>
<xsl:apply-templates />
</xsl:copy>
</xsl:when>
<xsl:otherwise>
<b>
<xsl:apply-templates />
</b>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
但我正在为每个模板做这个......我确信有一个更优雅的方式来做到这一点。
我试图复制使用该模板的XML部分:
<xsl:template match="ReportContent">
<xsl:copy><xsl:copy-of select="@*"/><xsl:apply-templates select="???" /></xsl:copy>
</xsl:template>
但复制当我申请的所有其他模板...我不希望这样。
那么,有没有更好的方法来做我想做的事情?
在此先感谢。
第二个是我在找的东西。非常感谢。我将仔细看看函数xsl:copy-of – 2011-06-10 09:46:36
heys btw Dimitre Novatchev告诉我要与您联系(http://stackoverflow.com/questions/6288212/client-side-xslt-parsing-programs/6292747)你介意给我发一封XSelerator邮件给[email protected] – Pacerier 2011-06-11 15:56:56
好吧,他确实说'也许'..不幸的是我自己并没有使用它,所以我无法帮助你。 – Flynn1179 2011-06-12 06:08:44