Development XSLT ..... CDATA woes..

Discussion in 'Software' started by Hepath, 12 Nov 2004.

  1. Hepath

    Hepath Minimodder

    Joined:
    20 Oct 2003
    Posts:
    730
    Likes Received:
    0
    Out on the WWW there's a plethora of information telling you that you are parsing a CDATA sectionsin XSLT is exceedingly difficult, as its treated as string content.

    Well - obvisously someone didn't read that... I'm getting [effectively] XHTML passed in a <![CDATA ]]> section and it have to parse it in xslt to change some hrefs to a function call...

    Now. I was hoping some you intellingent people might have also had this problem. I've approached it a couple of ways with no luck - but I've had a brainwave and to behonest I need some help.

    Supposition.
    If you took the text() node (which you knew to be XHTML) and passed that as a node set to another (external) xslt document would the resulting argument be treated as XML and return the transformed xml? If so how? I have a feeling I'm going to have just ignore this and programmatically parse afterwards :(

    the whole point of this is to get href to be a javascript function call passing in the GUID...
    e'g.

    <a href="javascript:doSomething('{34534-....234'}');">

    Here's an small example:

    <MyXmlFile>
    <Body>
    <![CDATA[
    <ul><li><strong><em><u>
    A reception
    <a href="{3C8C6AEC-6C5F-4FEB-B1D6-EB30E24186E8}" class="CMSLink">
    <img alt="Pensions info" src="/NR/rdonlyres/499E067A-FC94-417A-96B0-FB4BC327EA65/0/welcome_squares.gif" border="0" />
    </a>
    page with absolutely nothing to say!
    </u></em></strong></li></ul>
    ]]>
    </Body>
    <A>
    <B></B>
    </A>
    </MyXmlFile>
     
    Last edited: 12 Nov 2004

Share This Page