Wrox Programmer Forums
Go Back   Wrox Programmer Forums > XML > XSLT
|
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 software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old March 17th, 2008, 01:47 PM
Authorized User
 
Join Date: Feb 2006
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:choose>
                        <xsl:when test="$fieldtype='url'">
                            <a href="{$fieldvalue}">
                                <xsl:value-of select="$fieldvalue" />
                            </a>
                        </xsl:when>
                        <xsl:when test="$fieldtype='user'">
                            <xsl:value-of select="$fieldvalue" disable-output-escaping="yes" />
                        </xsl:when>
                        <xsl:otherwise>
                            <xsl:value-of select="$fieldvalue" />
                        </xsl:otherwise>
                    </xsl:choose>


It renders: apples;cherries;grapes,peaches

Instead I would like it to render as:

apples
cherries
grapes
peaches

Could I get some advice as to how to go about doing this? Thank you in advance for any help provided!
 
Old March 17th, 2008, 05:14 PM
mhkay's Avatar
Wrox Author
 
Join Date: Apr 2004
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
Default

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
http://www.saxonica.com/
Author, XSLT Programmer's Reference and XPath 2.0 Programmer's Reference





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





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.