Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

xsl template for comma separated data

Status
Not open for further replies.

kuolung

Programmer
Sep 2, 1999
51
0
0
US
hello, please help !!!! I'm new to xml and xsl.
i have the data in comma delimited list:

<dispositionMethod>ST,DE,OT</dispositionMethod>

the data are not always in this order, however, i want to parse each field to something as for option checkbox list in my XSL with output:

match ST
output "storage"
match DE
output "destruction"
match OT
output "other"
and so on...

Thanks so much in advance !!!!
 
Look here for the LineFeedToBr example. It has the basic technique for using recursion to scan across a string, looking for a specific character. Your requirement differs only in what you do with the string fragments as they are produced.

Tom Morrison
 
If you are using XSL 2.0 or extensions you can use the tokenize function:
Code:
<xsl:for-each select="tokenize(dispositionMethod, ',')">
  <xsl:choose>
    <xsl:when test=". = 'ST'">.....</xsl:when>
    .....
  </xsl:choose>
</xsl:for-each>
Otherwise you have to use a recursive template.

Jon

"I don't regret this, but I both rue and lament it.
 
Thanks both k5tm & JontyMC !!!
I got it to work!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top