Xml 在节点中嵌入另一个元素时提取节点的值
我试图处理来自另一个系统的XML文档,而我得到的XML是伪HTML格式的,我需要将其转换为HTML 示例XML:Xml 在节点中嵌入另一个元素时提取节点的值,xml,xslt,Xml,Xslt,我试图处理来自另一个系统的XML文档,而我得到的XML是伪HTML格式的,我需要将其转换为HTML 示例XML: <DOC> <Paragraph>This text is <bold>bold</bold> and this text is not.</Paragraph> </DOC> <BODY> <P>This text is <b>bold</b> and this
<DOC>
<Paragraph>This text is <bold>bold</bold> and this text is not.</Paragraph>
</DOC>
<BODY>
<P>This text is <b>bold</b> and this is not.</P>
</BODY>
此文本为粗体,而此文本为非粗体。
所需输出:
<DOC>
<Paragraph>This text is <bold>bold</bold> and this text is not.</Paragraph>
</DOC>
<BODY>
<P>This text is <b>bold</b> and this is not.</P>
</BODY>
此文本为粗体,此文本为非粗体。
使用node()值,我可以获得标记之前的node的值(此文本为),但我无法编写一个模板来处理标记之前的部分节点,处理标记,然后返回值的其余部分。有什么建议吗?你尝试了什么?不应该比
<xsl:template match="DOC">
<BODY><xsl:apply-templates/></BODY>
</xsl:template>
<xsl:template match="Paragraph">
<P><xsl:apply-templates/></P>
</xsl:template>
<xsl:template match="bold">
<b><xsl:apply-templates/></b>
</xsl:template>