XSLT and XML

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • mickey0
    New Member
    • Jan 2008
    • 142

    XSLT and XML

    hello,

    I have an xml file like this I left out some lines):
    Code:
    <root>
       <tag1>
          <![CDATA[ hi world! ]]>
       </tag1>
    </root>
    I'm looking a way to retrieve the content of CDATA using XSLT. Is there any chance , please?

    Thanks,
  • jkmyoung
    Recognized Expert Top Contributor
    • Mar 2006
    • 2057

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

    Comment

    • mickey0
      New Member
      • Jan 2008
      • 142

      #3
      that's correct; but If I had something like
      Code:
      .......
      <tag1>
          Hello
         <![CDATA[ bye bye ]]
      </tag1>
      your text() will return only "Hello". Any hints,please?

      Comment

      • jkmyoung
        Recognized Expert Top Contributor
        • Mar 2006
        • 2057

        #4
        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.

        Comment

        • mickey0
          New Member
          • Jan 2008
          • 142

          #5
          Originally posted by jkmyoung
          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....

          Comment

          Working...