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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T08:18:25+00:00 2026-05-11T08:18:25+00:00

I have some data in an XML element that looks like this: <item value=category1,category2>Item

  • 0

I have some data in an XML element that looks like this:

<item value='category1,category2'>Item Name</item> 

The bit I’m interested in is the value attribute. I’m able to get the data contained in this attribute into a template which looks like this:

<xsl:template name='RenderValues'>     <xsl:param name='ValueList' />     <xsl:value-of select='$ValueList' /> <!-- outputs category1,category2--> </xsl:template> 

What I want to do is to process the comma separated values in an efficient manner. What is the best way to render something like the following from inside the RenderValues template?

<a href='x.asp?item=category1'>category1</a> <a href='x.asp?item=category2'>category2</a> 
  • 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. 2026-05-11T08:18:26+00:00Added an answer on May 11, 2026 at 8:18 am

    In XSLT 2.0/XPath 2.0 use the standard XPath 2.0 function tokenize().

    In XSLT 1.0 one needs either to write a recursively called template or, more conveniently, use the str-split-to-words function/template of the FXSL library.

    Here is an example of the latter:

    <xsl:stylesheet version='1.0'  xmlns:xsl='http://www.w3.org/1999/XSL/Transform'  xmlns:ext='http://exslt.org/common'  > <!--                                                 -->    <xsl:import href='strSplit-to-Words.xsl'/> <!--                                                 -->    <xsl:output indent='yes' omit-xml-declaration='yes'/> <!--                                                 -->     <xsl:template match='/*'>       <xsl:variable name='vwordNodes'>         <xsl:call-template name='str-split-to-words'>           <xsl:with-param name='pStr' select='string(@value)'/>           <xsl:with-param name='pDelimiters'                            select='', &#10;''/>         </xsl:call-template>       </xsl:variable> <!--                                                 -->       <xsl:apply-templates select='ext:node-set($vwordNodes)/*'/>     </xsl:template> <!--                                                 -->     <xsl:template match='word' priority='10'>       <a href='x.asp?item={.}'><xsl:value-of select='.'/></a>     </xsl:template> <!--                                                 --> </xsl:stylesheet> 

    When the above transformation is applied on the provided XML document:

    <item value='category1,category2'>Item Name</item> 

    the wanted result is produced:

    <a href='x.asp?item=category1' xmlns:ext='http://exslt.org/common'>category1</a> <a href='x.asp?item=category2' xmlns:ext='http://exslt.org/common'>category2</a> 

    The pDelimiters parameter of this template allow multiple delimiting characters to be specified. In the above example, any separating character can be either a comma, a space or a new line character.

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

Sidebar

Ask A Question

Stats

  • Questions 255k
  • Answers 255k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer I think it might happen because at some point, the… May 13, 2026 at 10:20 am
  • Editorial Team
    Editorial Team added an answer Unfortunately cross compiling in this direction is not (easily) possible… May 13, 2026 at 10:20 am
  • Editorial Team
    Editorial Team added an answer Here is a memory-friendly function that should be able to… May 13, 2026 at 10:20 am

Related Questions

I have a Lua program that is consuming data from an external device. The
I am using a class library which represents some of its configuration in .xml.
I want to take an XML file and replace an element's value. For example
I'm writing a web interface to MySQL that executes a couple queries and returns

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.