开发者

xsl:cdata elements inside xsl:element

I am trying to get the following output :

<name><![CDATA[ SomeNameHere ]]></name>

using the following xslt :

  <xsl:element name="name"> 
            <xsl:cdata>
                <xsl:value-of select="name"/> 
            </xsl:开发者_如何学编程cdata>
  </xsl:element>

But while compiling I get the following exception :

'xsl:cdata' cannot be a child of the 'xsl:element' element.

How can I insert cdata elements inside an xml node then?

Thank you.


There's no such think as <xsl:cdata>

If your <xsl:output/> includes name among the elements listed in the cdata-section-elements attributes, then it will use CDATA sections for all such elements.

If you needed it in one particular case, you could kludge with disable-output-escaping though really you shouldn't have any need for this.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜