所以我有以下XML片段...标签位置正确的节点的XSLT输出文本()
我需要把它放到HTML中。我想为每个(部分)打印出该部分的文本,如果您看到(b)标签,然后在该单词周围输出该标签。但我不知道如何做到这一点,因为它似乎我只能输出部分的文本()。
但我需要同时输出节点的text()以及操作该文本()中的标记。
这是样本XML:
<body>
<section>
<title>Response</title>
<p> Some info here <b> with some other tags</b> or lists like <ol> <li>something</li> </ol></p>
</section>
<section>Another section same format, sections are outputted as divs </section>
</body>
这是我到目前为止有:
<div class="body">
<xsl:for-each select='topic/body/section'>
<div class="section">
<xsl:choose>
<xsl:when test="title">
<h2 class="title sectiontitle"><xsl:value-of select="title"/></h2>
</xsl:when>
<xsl:when test="p">
[I dont know what to put here? I need to output both the text of the paragraph tag but also the html tags inside of it..]
</xsl:when>
</xsl:choose>
</div>
</xsl:for-each>
</div>
所需的输出 - 的HTML代码块为XML中的每个部分。
<div class="section">
<h2 class="title">Whatever my title is from the xml tag</h2>
<p> The text in the paragraph with the proper html tags like <b> and <u> </p>
</div>
提供样本输入XML和期望的输出。 – 2012-02-06 13:36:51
一块代码请! – TOUDIdel 2012-02-06 13:48:35