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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T21:03:07+00:00 2026-05-17T21:03:07+00:00

I have an xml document that looks like this. <?xml version=1.0?> <services> <service sn=1

  • 0

I have an xml document that looks like this.

<?xml version="1.0"?>
<services>
    <service sn="1" family="2 Week Wait">
    <service_name>2 Week Wait Dermatology</service_name>
    <speciality>2 Week Wait</speciality>
    <clinic_types>2 Week Wait Skin</clinic_types>
    <tag>Malignant neoplasm of skin , Pigmented skin lesion </tag>
</service>

I’ve managed to get everything how I want but for one last tweak I’d like to have the Comma Separated Values display as a unordered list.

I’m using this line of XSL to output the list,

<ul>
     <li>
           <xsl:value-of select="translate(tag,',','<![CDATA[</li><li>]]>')" disable-output-escaping="yes" />
     </li>
<ul>

I’m getting an error saying that the resulting XML isn’t formatted properly. I’ve tried to replace the replacement section with other stuff and it’s worked. I’ve also tried using the HTML ASCII codes for the tags with no luck so I’m really confused with what I’m doing wrong.

Any help appreciated,
Thanks

  • 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-17T21:03:07+00:00Added an answer on May 17, 2026 at 9:03 pm

    XSLT is XML; the select expression is embedded inside an attribute value so it must apply another round of XML-escaping. Since a CDATA section can’t live in an attribute value, that has to be applied manually:

    <xsl:value-of select="translate(tag,',','&lt;/li>&lt;li>')" disable-output-escaping="yes" />
    

    However, applying disable-output-escaping to the output of translate is questionable: what if the text had < or & characters in it? You’d be turning text content into active markup, with validity and potential security problems.

    Normally it would be better to add markup from XSLT itself. You can split a string in XSLT 2.0 using the tokenize function:

    <ul>
        <xsl:for-each select="tokenize(tag,',')">
            <li><xsl:value-of select="."/></li>
        </xsl:for-each>
    </ul>
    

    (If you’re using XSLT 1.0 this has to be done as a recursive template using substring_before/after, which is a pain.)

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

Sidebar

Related Questions

I have to parse an XML document that looks like this: <?xml version=1.0 encoding=UTF-8
Say I have a xml document that looks like this <foo> <bar id=9 />
I have an XML document that looks like this: <kmsg xmlns=http://url1 xmlns:env=url1 xmlns:xsi=http://www.w3.org/2001/XMLSchemainstance xsi:schemaLocation=http://location
I have some XML that looks something like this: <Root> <Documents> <Document id=1/> </Documents>
I have a simple xml document that looks like the following snippet. I need
I have a XML document which looks something like this: <events> <event category=gymnastics subcategory=rhythmic
I have an xml file that looks like this: <args> <sometag value=abc /> <anothertag
In my Python app, I have an XML document that I'd like to transform
I've got a 2-part question... I have some XML that looks like: <trans-unit id=70
I have an XML document that I'm trying to style via CSS. A relevant

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.