开发者

XSLT selection of text and change element within text

I have an xml document like this :

<para>
   This is some text <emphasis>blah blah</emphasis> and this is some more text.
<para>

And I need to apply an XSLT transformation to achieve 开发者_如何学运维the following HTML

<p>
  This is some text <em>blah blah</em> and this is some more text.
</p>


<?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>
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜