Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6868251
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T03:24:39+00:00 2026-05-27T03:24:39+00:00

I am new to xsl xml transformation. For now, I have an xml file

  • 0

I am new to xsl xml transformation. For now, I have an xml file that contains the following information:

<bio>
<published>Tue, 7 Oct 2008 14:47:26 +0000</published>
<summary><![CDATA[
   Dream Theater is an American <a
   href="http://www.last.fm/tag/progressive%20metal" class="bbcode_tag"
   rel="tag">progressive metal</a> band formed in 1985 under the name
   &quot;<a href="http://www.last.fm/music/Majesty"
   class="bbcode_artist">Majesty</a>&quot; by <a
   href="http://www.last.fm/music/John+Myung"
   class="bbcode_artist">John Myung</a>,
   <a href="http://www.last.fm/music/John+Petrucci"
   class="bbcode_artist">John Petrucci</a>
]]>
</summary>
</bio>

And my xsl file contains this:

<h3><xsl:value-of select="lfm/artist/bio/published"/></h3>
<p>
   <xsl:value-of select="lfm/artist/bio/summary" disable-output-escaping="yes"/>
</p>
<html>
   <body>
      <xsl:value-of select="lfm/artist/bio/content"/>
   </body>
</html>

What I’m trying to do now is to extract the tag-structured data out of the <summary><[CDATA[]]></summary> and show it in the browser as in this example:

<a href="http://www.last.fm/tag/progressive%20metal" class="bbcode_tag" rel="tag">progressive metal</a>
<a href="http://www.last.fm/music/Majesty" class="bbcode_artist">Majesty</a>
<a href="http://www.last.fm/music/John+Myung" class="bbcode_artist">John Myung</a>
<a href="http://www.last.fm/music/John+Petrucci" class="bbcode_artist">John Petrucci</a>

For now when I open the xml page, it shows all the CDATA content, even with those html tags… I want to get those tags to do their job properly in html form.

sorry for the terrible description..hope you guys can get what i mean here…

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T03:24:40+00:00Added an answer on May 27, 2026 at 3:24 am

    The CDATA is just (a part of) a text node and what seems like markup inside it is one-dimensional text (badly destroyed markup) and this cannot be accomplished (in XSLT 1.0 and XSLT 2.0) without calling an extension function.

    <p><xsl:copy-of select="my:parse(lfm/artist/bio/summary)"></p>

    In XSLT 3.0 there may be a new standard function parse-xml() that does exactly this.

    Update:

    Here is a complete code example, assuming you are using XslCompiledTransform in .NET:

    <xsl:stylesheet version="1.0"
     xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
     xmlns:msxsl="urn:schemas-microsoft-com:xslt"
     xmlns:my="my:my">
     <xsl:output omit-xml-declaration="yes" indent="yes"/>
     <xsl:strip-space elements="*"/>
    
     <xsl:template match="node()|@*">
      <xsl:copy>
       <xsl:apply-templates select="node()|@*"/>
      </xsl:copy>
     </xsl:template>
    
     <xsl:template match="summary/text()">
      <xsl:copy-of select="my:parse(.)/*/*"/>
     </xsl:template>
    
     <msxsl:script language="c#" implements-prefix="my">
      public XmlDocument parse(string text)
      {
        XmlDocument doc = new XmlDocument();
        doc.LoadXml("&lt;t>"+text+"&lt;/t>");
    
        return doc;
      }
     </msxsl:script>
    </xsl:stylesheet>
    

    When this transformation is applied on the provided XML document:

    <bio>
     <published>Tue, 7 Oct 2008 14:47:26 +0000</published>
     <summary><![CDATA[Dream Theater is an American <a href="http://www.last.fm/tag/progressive%20metal" class="bbcode_tag" rel="tag">progressive metal</a> band formed in 1985 under the name &quot;<a href="http://www.last.fm/music/Majesty" class="bbcode_artist">Majesty</a>&quot; by <a href="http://www.last.fm/music/John+Myung" class="bbcode_artist">John Myung</a>, <a href="http://www.last.fm/music/John+Petrucci" class="bbcode_artist">John Petrucci</a>]]>
     </summary>
    </bio>
    

    the wanted, correct result (the CDATA is replaced by the reconstituted markup) is produced:

    <bio>
      <published>Tue, 7 Oct 2008 14:47:26 +0000</published>
      <summary>
        <a href="http://www.last.fm/tag/progressive%20metal" class="bbcode_tag" rel="tag">progressive metal</a>
        <a href="http://www.last.fm/music/Majesty" class="bbcode_artist">Majesty</a>
        <a href="http://www.last.fm/music/John+Myung" class="bbcode_artist">John Myung</a>
        <a href="http://www.last.fm/music/John+Petrucci" class="bbcode_artist">John Petrucci</a>
      </summary>
    </bio>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a problem with namespace position in result xml file after xsl transformation.
Very new to XSL (and XML for that matter), but I need to step
The task I'm facing right now is the following: I have two XML files,
I have a complicated XML and I am trying to write a XSL transformation
I am very new to XSL Transformation here is the question. If I have
Good day! I'm trying to build up an xsl transformation file that do the
Possible Duplicate: Producing a new line in XSLT if have the following xslt file:
I'm new in xml, sorry for the dumb question. I'm trying to create xsl
This code:: xslProcessor = new XSLTProcessor(); xslProcessor.importStylesheet(xsl); result = xslProcessor.transformToFragment(xml, document); works fine in
I've written a servlet that takes some xml and xsl and produces a PDF,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.