我正在尝试使用 XSLT 2.0 对 XML 进行非规范化。
下面是 XML 和相同的预期输出。如果有人可以提供 XSLT 来实现这一点,将会有很大的帮助。非规范化应该只适用于以“Change”开头的标签,而不适用于其他标签。其他标签应保持原样。
示例输入 XML
<p> This is normal text
<changebold>This is new line</changebold>
My Name is
<table>
<tr>
<td>FirstName</td>
<td>LastName</td>
<td>Testing for <changebold>Bold <changeitalic>Italic <changeunderline>UnderLine</changeunderline>
</changeitalic>
</changebold>
</td>
</tr>
</table>
<changebold>The Test <changeitalic>of Chemistry<changeunderline>is passed</changeunderline>
</changeitalic> and for biology <changeunderline>the result</changeunderline> is unknown <changeunderline> and under process.</changeunderline>
<changeitalic>The result</changeitalic> of same<changeunderline>will be</changeunderline> displayed on <changeitalic>noticeboard soon.</changeitalic>
</changebold>
<table>table heading <tr>Row <td>Cell1</td>Row End</tr>Table Heading end. </table>
</p>
上述 XML 的预期输出
<p> This is normal text
<changebold>This is new line</changebold>
My Name is
<table>
<tr>
<td>FirstName</td>
<td>LastName</td>
<td>Testing for <changebold>Bold </changebold>
<changebold>
<changeitalic>Italic</changeitalic>
</changebold>
<changebold>
<changeitalic>
<changeunderline>UnderLine</changeunderline>
</changeitalic>
</changebold>
</td>
</tr>
</table>
<changebold>The Test </changebold>
<changebold>
<changeitalic>of Chemistry</changeitalic>
</changebold>
<changebold>
<changeitalic>
<changeunderline>is passed</changeunderline>
</changeitalic>
</changebold>
<changebold> and for biology </changebold>
<changebold>
<changeunderline>the result</changeunderline>
</changebold>
<changebold> is unknown </changebold>
<changebold>
<changeunderline> and under process.</changeunderline>
</changebold>
<changebold>
<changeitalic>The result</changeitalic>
</changebold>
<changebold> of same</changebold>
<changebold>
<changeunderline>will be</changeunderline>
</changebold>
<changebold> displayed on </changebold>
<changebold>
<changeitalic>noticeboard soon.</changeitalic>
</changebold>
<table>table heading <tr>Row <td>Cell1</td>Row End</tr>Table Heading end. </table>
</p>