Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. XML / XSL
  4. CDATA and XSL

CDATA and XSL

Scheduled Pinned Locked Moved XML / XSL
questionxmlcsharp
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • P Offline
    P Offline
    pjackson18
    wrote on last edited by
    #1

    I have been trying to transform XML with the .net xml transforms control. One of the elements has CDATA sections, how do I isolate the first CDATA section and read the text from it and not the other? Also when I try to include the image in the xml transform control all I get is the image string and not the image itself. Can I include images when i'm transforming data with xsl and the xml transform control. ]]> Sorry if my question is poorly written, i've never really used xsl. Paul

    PJ

    G 1 Reply Last reply
    0
    • P pjackson18

      I have been trying to transform XML with the .net xml transforms control. One of the elements has CDATA sections, how do I isolate the first CDATA section and read the text from it and not the other? Also when I try to include the image in the xml transform control all I get is the image string and not the image itself. Can I include images when i'm transforming data with xsl and the xml transform control. ]]> Sorry if my question is poorly written, i've never really used xsl. Paul

      PJ

      G Offline
      G Offline
      George L Jackson
      wrote on last edited by
      #2

      AFAIK, when you transform an XML document using XSLT, CDATA sections and regular text are parsed together as one text item. However, you can parse CDATA sections and regular text separately using the XmlDocument class. Given the above information, you can use the Add Extension Object feature of the XsltArgumentList to achieve your purpose. IMHO, the below code is a bit overkill but it does the job. By the way, your second CDATA section will be transformed as text as and not an HTML element. To create a HTML element, you have to create it dynamically or statically in the XSLT code.

      using namespace System;

      using namespace System::IO;

      using namespace System::Text;

      using namespace System::Xml;

      using namespace System::Xml::XPath;

      using namespace System::Xml::Xsl;

      public ref class ParseCdata

      {

      public:

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups