I am trying to create an xml by transforming another xml using xslt. the problem is: I am using multiple "xsl:value of select=...." in a single element, and I marked that element as a CData element. The value that I receive after the transformation includes multiple CData, while I want them all to be within a single CData.
for example: original xml:
<test>
<text1>WOW</text1>
<text3>NO</text3>
</test>
xslt (there are headers above to have "Bla" value as CData):
<?xml version="1.0" encoding="utf-8" ?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://ift.tt/tCZ8VR" >
<xsl:output method="xml" cdata-section-elements="Bla" />
<xsl:template match="/">
<Bla id="bla">
text<xsl:value-of select="test/text1" />moreText<xsl:value-of select="test/text3" />
</Bla>
</xsl:template>
</xsl:stylesheet>
output xml:
<?xml version="1.0" encoding="UTF-8"?><Bla id="bla"><![CDATA[text]]><![CDATA[WOW]]><![CDATA[moreText]]><![CDATA[NO]]></Bla>
But, What I want to get in the end is this:
<?xml version="1.0" encoding="UTF-8"?><Bla id="bla"><![CDATA[textWOWmoreTextNO]]></Bla>
Anyone knows what I need to change to achieve this?
Thanks!
No comments:
Post a Comment