我有一个具有以下结构的xml。
<p>Simple XML will return a reference to an <i>object</i> containing: <quote><p>the node value and you cant use references in session variables</p></quote> as there is <b>no feasible</b> way to restore a reference to another variable.</p>
输出应为
<p>Simple XML will return a reference to an <i>object</i> containing:<p>
<blockquote>the node value and you cant use references in session variables</blockquote>
<p>as there is <b>no feasible</b> way to restore a reference to another variable.</p>
如何重点突出标签。提前致谢。
如果要使用XSLT进行操作,则可以采用以下解决方案:
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
exclude-result-prefixes="xs"
version="2.0">
<xsl:template match="@*|node()">
<xsl:copy>
<xsl:apply-templates select="@*|node()"/>
</xsl:copy>
</xsl:template>
<xsl:template match="quote">
<xsl:text disable-output-escaping="yes"><![CDATA[</p>]]></xsl:text>
<blockquote><xsl:apply-templates select="@*|node()"/></blockquote>
<xsl:text disable-output-escaping="yes"><![CDATA[<p>]]></xsl:text>
</xsl:template>
<xsl:template match="quote/p">
<xsl:value-of select="."/>
</xsl:template>
</xsl:stylesheet>
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句