Sign In | Register Now About Bytes | Help | Site Map
Connecting Tech Pros Worldwide

XSLT and XML

Question posted by: mickey0 (Member) on July 2nd, 2008 10:34 AM
hello,

I have an xml file like this I left out some lines):
Expand|Select|Wrap|Line Numbers
  1. <root>
  2.    <tag1>
  3.       <![CDATA[ hi world! ]]>
  4.    </tag1>
  5. </root>

I'm looking a way to retrieve the content of CDATA using XSLT. Is there any chance , please?

Thanks,
jkmyoung's Avatar
jkmyoung
Moderator
797 Posts
July 2nd, 2008
07:05 PM
#2

Re: XSLT and XML
?
<xsl:value-of select="tag1"/>
<xsl:value-of select="tag1/text()"/>
Not sure how specific you need it.

Reply
mickey0's Avatar
mickey0
Member
85 Posts
July 6th, 2008
10:44 PM
#3

Re: XSLT and XML
that's correct; but If I had something like
Expand|Select|Wrap|Line Numbers
  1. .......
  2. <tag1>
  3.     Hello
  4.    <![CDATA[ bye bye ]]
  5. </tag1>

your text() will return only "Hello". Any hints,please?

Reply
jkmyoung's Avatar
jkmyoung
Moderator
797 Posts
July 7th, 2008
06:09 PM
#4

Re: XSLT and XML
Strange, I'm getting both "hello" and "bye bye".

Assuming you don't want hello:
Use a different non-xml processing language. XSLT's processor converts the cdata, treating it as normal xml when processing.

Reply
mickey0's Avatar
mickey0
Member
85 Posts
July 7th, 2008
07:38 PM
#5

Re: XSLT and XML
Quote:
Strange, I'm getting both "hello" and "bye bye".

Assuming you don't want hello:
Use a different non-xml processing language. XSLT's processor converts the cdata, treating it as normal xml when processing.

Yes I don't want hello but I have to use Xslt. So, I assume, that there's some way to do it....

Reply
Reply
Not the answer you were looking for? Post your question . . .
189,759 Experts ready to help you find a solution.
Sign up for a free account, or Login (if you're already a member).

Latest Articles: Read & Comment
Top XML Forum Contributors