• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Extract CDATA from an element using xsl

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Input:(XML)

<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.
 
Ranch Hand
Posts: 734
7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 734
7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Nothing? Or something? Like this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic