Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > XML > XSLT
Password Reminder
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
XSLT General questions and answers about XSLT. For issues strictly specific to the book XSLT 1.1 Programmers Reference, please post to that forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the XSLT section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old March 17th, 2008, 01:47 PM
Authorized User
Join Date: Feb 2006
Location: Seattle, WA, USA.
Posts: 14
Thanks: 0
Thanked 0 Times in 0 Posts
Default splitting up items separated by semicolon

Hi all,

I'm very new to XSLT and I have the following code the renders the following:

<xsl:if test="$fieldtitle"></xsl:if>
                        <xsl:when test="$fieldtype='url'">
                            <a href="{$fieldvalue}">
                                <xsl:value-of select="$fieldvalue" />
                        <xsl:when test="$fieldtype='user'">
                            <xsl:value-of select="$fieldvalue" disable-output-escaping="yes" />
                            <xsl:value-of select="$fieldvalue" />

It renders: apples;cherries;grapes,peaches

Instead I would like it to render as:


Could I get some advice as to how to go about doing this? Thank you in advance for any help provided!
Reply With Quote
  #2 (permalink)  
Old March 17th, 2008, 05:14 PM
mhkay's Avatar
Wrox Author
Points: 18,438, Level: 59
Points: 18,438, Level: 59 Points: 18,438, Level: 59 Points: 18,438, Level: 59
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
Join Date: Apr 2004
Location: Reading, Berks, United Kingdom.
Posts: 4,954
Thanks: 0
Thanked 290 Times in 285 Posts

Without seeing your source document I can't tell where the semicolons are coming from so I can't tell you how to get rid of them. (In fact I can't tell where the fruit names are coming from either.) You haven't even shown the code that declares the variables such as $fieldtype - there's simply nothing to go on here.

A couple of comments:

(1) <xsl:if test="$fieldtitle"></xsl:if>

An empty xsl:if is legal but totally useless.

(2) disable-output-escaping="yes"

You almost certainly don't want to be doing that. It's a low-level feature for advanced users only, and it makes your stylesheet less portable.

Michael Kay
Author, XSLT Programmer's Reference and XPath 2.0 Programmer's Reference
Reply With Quote

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
comma separated list MunishBhatia SQL Server 2000 11 March 21st, 2007 03:56 PM
hi pls help on this semicolon data arvind@allfon XML 5 February 20th, 2007 08:09 AM
missing semicolon absolutelymk Access 2 May 5th, 2006 10:10 AM
Missing semicolon? jakeone Access 4 February 15th, 2005 12:26 PM
displaying 6 items only having 20 items Lakshmi KS VB Components 1 February 17th, 2004 10:34 AM

All times are GMT -4. The time now is 08:28 PM.

Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.