SitePoint Sponsor

User Tag List

Results 1 to 7 of 7
  1. #1
    SitePoint Enthusiast
    Join Date
    Jan 2005
    Location
    Edmonton, the upper part of AB.
    Posts
    36
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    html tags within xml to be outputted via xslt

    Does anyone know how to put html tags inside of an xml document, and then process the exact code to xhtml via an xslt?
    What i want to do is perform an xsl transfomation on something like this:
    Code:
    <item>
     This link goes <a href="link?value=1">here</a> 
    </item>
    xslt seems to choke on the query mark inside the link.
    How would i go about overcoming this?

  2. #2
    SitePoint Addict Brak's Avatar
    Join Date
    Jul 2004
    Location
    Central Coast, CA
    Posts
    321
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    All you need to do is wrap it in <![CDATA tags, so your XML becomes:
    Code:
    <item>
     <![CDATA[ This link goes <a href="link?value=1">here</a> ]]>
    </item>
    Also, the XSLT tag outputting the content would need disable-output-escaping="yes" on it as well.
    Studio Rockstar's Blog - A journey to quitting the dayjob.

  3. #3
    SitePoint Enthusiast
    Join Date
    Jan 2005
    Location
    Edmonton, the upper part of AB.
    Posts
    36
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Ahhh thanks a lot.
    works great.

    -paul.

  4. #4
    ☆★☆★ silver trophy vgarcia's Avatar
    Join Date
    Jan 2002
    Location
    in transition
    Posts
    21,236
    Mentioned
    1 Post(s)
    Tagged
    1 Thread(s)
    Or
    Code:
    <xsl:copy-of select="item"/>

  5. #5
    SitePoint Enthusiast
    Join Date
    Apr 2003
    Location
    Anywhere
    Posts
    46
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hello.

    I am also having a problem in inserting html tags in xml document.

    for examle

    Code:
    <description>This is my description <br> another line</description>
    Then browser cannot display the above document due to the <br>

  6. #6
    ☆★☆★ silver trophy vgarcia's Avatar
    Join Date
    Jan 2002
    Location
    in transition
    Posts
    21,236
    Mentioned
    1 Post(s)
    Tagged
    1 Thread(s)
    Quote Originally Posted by dominant
    Hello.

    I am also having a problem in inserting html tags in xml document.

    for examle

    Code:
    <description>This is my description <br> another line</description>
    Then browser cannot display the above document due to the <br>
    You have to close the br tag. Example:
    Code:
    <br/>

  7. #7
    SitePoint Enthusiast
    Join Date
    Apr 2003
    Location
    Anywhere
    Posts
    46
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I used the aforementioned code and it worked

    Code:
    <item>
     <![CDATA[ This link goes <a href="link?value=1">here</a> ]]>
    </item>


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •