我有一个像这样的xml文档:
<para>
This is some text <emphasis>blah blah</emphasis> and this is some more text.
<para>
我需要应用XSLT转换来实现以下HTML
<p>
This is some text <em>blah blah</em> and this is some more text.
</p>
答案 0 :(得分:3)
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" version="1.0" encoding="UTF-8"
indent="yes" />
<xsl:template match="@* | node()">
<xsl:copy>
<xsl:apply-templates select="@* | node()" />
</xsl:copy>
</xsl:template>
<xsl:template match="emphasis">
<em>
<xsl:apply-templates />
</em>
</xsl:template>
<xsl:template match="para">
<p>
<xsl:apply-templates />
</p>
</xsl:template>
</xsl:stylesheet>