1
輸入XML是這樣的:解析文本是在XSLT選擇的節點
<input>
<foo>John's bar</foo>
<bar>test</bar>
<foobar>testing</foobar>
</input>
XSL改造後:
<input>
<foo>John's bar</foo>
<bar>this_test</bar>
</input>
但遺留系統要求:
<foo>John's bar</foo>
不<foo>John's bar</foo>
所以我希望保留<foo>
的值,而不是讓XSLT解析它。
我嘗試使用<xsl:output method="text"/>
但沒有運氣成功的..
我覺得XML在加載時被解析和XSLT只是作爲輸出是... 如果這是真的,我ATLEAST想逃離它,使'
本身無關在輸入XML中是&apose
還是'
。我試過
XSLT是這樣的:
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="http://www.w3.org/1999/XSL/Format">
<xsl:output method="xml"/>
<xsl:template match="@*|node()">
<xsl:copy>
<xsl:apply-templates select="node()"/>
</xsl:copy>
</xsl:template>
<xsl:template match="bar">
<xsl:copy>
<xsl:text>this_</xsl:text>
<xsl:apply-templates/>
</xsl:copy>
</xsl:template>
<xsl:template match="foobar"/>
</xsl:stylesheet>
您在XSLT 1.0使用替換()。 –
你說得對。我編輯了我的帖子。對不起,今天有點「困惑」。 –