如何减少这个记录?
<xsl:template match="BR">
<br/>
</xsl:template>
<xsl:template match="B">
<strong><xsl:apply-templates /></strong>
</xsl:template>
<xsl:template match="STRONG">
<strong><xsl:apply-templates /></strong>
</xsl:template>
<xsl:template match="I">
<em><xsl:apply-templates /></em>
</xsl:template>
<xsl:template match="EM">
<em><xsl:apply-templates /></em>
</xsl:template>
<xsl:template match="OL">
<ol><xsl:apply-templates /></ol>
</xsl:template>
<xsl:template match="UL">
<ul><xsl:apply-templates /></ul>
</xsl:template>
<xsl:template match="LI">
<li><xsl:apply-templates /></li>
</xsl:template>
<xsl:template match="SUB">
<sub><xsl:apply-templates /></sub>
</xsl:template>
<xsl:template match="SUP">
<sup><xsl:apply-templates /></sup>
</xsl:template>
<xsl:template match="NOBR">
<nobr><xsl:apply-templates /></nobr>
</xsl:template>
最佳答案
也许是这样的:
<xsl:template match="LI|SUB|...">
<xsl:element name="{translate(name(),
'ABCDEFGHIJKLMNOPQRSTUVWXYZ','abcdefghijklmnopqrstuvwxyz')}">
<xsl:apply-templates/>
</xsl:element>
</xsl:template>
我不认为 XSLT 中有一个 tolower 函数(至少在 1.0 中没有)
关于xslt - 优化<xsl :apply-templates/> for a set of tags,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2628533/