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 8247699
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T22:56:17+00:00 2026-06-07T22:56:17+00:00

I have XML file: … <Chart id=c01> <expires>2012-07-19 12:20:00</expires> <data><![CDATA[…]]></data> </Chart> … where CDATA

  • 0

I have XML file:

...
    <Chart id="c01">
      <expires>2012-07-19 12:20:00</expires>
      <data><![CDATA[...]]></data>
    </Chart>
...

where CDATA is B64 encoded PNG image, and whanted to transform XML to HTML to view the image.

For that purpose I set XSL to output text and dump CDATA:

<xsl:output method="text"/>

<xsl:template match="//data/text()">
  <xsl:value-of select="."/>
</xsl:template>

In the same template I wrap basic HTML structure, which I excluded here for clearance.

The problem is this: If I use XPath on XML file //data/text() I get just CDATA text, but with above XSL I get also “2012-07-19 12:20:00” from <expires> XML element, in the output.

I guess it’s some basic thing I’m missing, but why is date also outputed and how can I avoid it in output?

  • 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-06-07T22:56:19+00:00Added an answer on June 7, 2026 at 10:56 pm

    Probably the shortest way to achieve this is:

     <xsl:template match="*[not(self::data)]/text()"/>
    

    The complete transformation:

    <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
     <xsl:output omit-xml-declaration="yes" indent="yes"/>
    
     <xsl:template match="*[not(self::data)]/text()"/>
    </xsl:stylesheet>
    

    When this transformation is applied on the XML document:

    <t>
        <Chart id="c01">
            <expires>2012-07-19 12:20:00</expires>
            <data><![CDATA[ImageBlob]]></data>
        </Chart>
    </t>
    

    the wanted, correct result is produced:

    ImageBlob
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have XML file with this data <?xml version="1.0" encoding="windows-1251" ?> <ValCurs Date="06/06/2012" name="Курби
i have xml file which contains CDATA i need to update the CDATA as
I have XML file (output of some application) like this: <data> <call function=get_user_data> <output>
I have xml file with collection image urls and I want upload this url
I have an xml file providing data for a datagrid in Flex 2 that
I have xml file with data that i have to display in table. Now
i have xml file which contains lots of data. now i want to pick
I have xml file with such structure: ... <outer> ... <inner/> ... </outer> ...
What is the easiest way to convert xml to html? I have xml file
I have an XML file from which I am parsing some content to display

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.