trying to insert CDATA section into a xml

2020-05-06 16:48发布

Hi I have added the below two xsl text nodes to get CDATA in my output xml

<xsl:text disable-output-escaping="yes">&lt;xsl:text disable-output-escaping="yes"&gt;&lt;![CDATA[&lt;/xsl:text&gt;</xsl:text>
<xsl:text disable-output-escaping="yes">&lt;xsl:text disable-output-escaping="yes"&gt;]]&gt;&lt;/xsl:text&gt;</xsl:text>

In My output i am getting the below

<xsl:text disable-output-escaping="yes"><![CDATA[</xsl:text>
<xsl:text disable-output-escaping="yes">]]></xsl:text>

I want my output to be like

<xsl:text disable-output-escaping="yes">&lt;![CDATA[</xsl:text>
<xsl:text disable-output-escaping="yes">]]&gt;</xsl:text>

I am bit new to xslt/xml so any help will be much appreciated :-)

1条回答
别忘想泡老子
2楼-- · 2020-05-06 17:29

Shouldn't it be

<xsl:text disable-output-escaping="yes">&lt;![CDATA[</xsl:text> <xsl:text disable-output-escaping="yes">]]&gt;</xsl:text>

If you want your output like the previous

<xsl:text disable-output-escaping="yes">&lt;xsl:text disable-output-escaping="yes"&gt;&amp;lt;![CDATA[&lt;/xsl:text&gt;</xsl:text>
<xsl:text disable-output-escaping="yes">&lt;xsl:text disable-output-escaping="yes"&gt;]]&amp;gt;&lt;/xsl:text&gt;</xsl:text>
查看更多
登录 后发表回答