• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Extract CDATA from an element using xsl

 
girish chandra
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
InputXML)

<A1Result xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
<![CDATA[
<?xml version="1.0" encoding="UTF-8" ?>
<ABCD_XML_DATA>
<Header>
<MessageId>AGDMY1323292534488</MessageId>
</Header>
</ABCD_XML_DATA>
]]>
</A1Result>

I need this output using xsl:

<ABCD_XML_DATA>
<Header>
<MessageId>AGDMY1323292534488</MessageId>
</Header>
</ABCD_XML_DATA>

additional info, my input and output are written in/to varibales.i tried this,

<xsl:variable name="Data">
<xsl:value-of select="$A1Result" disable-output-escaping="yes"/>
</xsl:variable>

please suggest how to achieve this, thanks.
 
g tsuji
Ranch Hand
Posts: 669
3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Suppose I place a bit in a concrete context of a template: keeping though variables you seem to like having.
 
girish chandra
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for your response.

this got my issue resloved, (i am using dp xsl processor, so the name space dp); i was trying the same thing yesterday with no luck; i had to parse it to work.

<xsl:copy-of select="dp:parse(dp:variable('var://context/saved/MyRes')//*[local-name()='A1Result'])" disable-output-escaping="yes"/>


where, 'var://context/saved/MyRes', has the input xml from question.
 
g tsuji
Ranch Hand
Posts: 669
3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ok, thanks for the feedback, glad to hear the problem is behind.

I just take this opportunity to correct two careless typos in my above post in order not to confuse other readers eventual:
[1] Line #2: name="$A1Result" should be read name="A1Result", of course by syntax.
[2] Line #6: $payload should be read $A1Result, being clear from the context of it.
Thanks for the attentions.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic