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 June 11th, 2007, 02:36 PM
Authorized User
 
Join Date: Feb 2006
Posts: 14
Thanks: 0
Thanked 0 Times in 0 Posts
Default convert list of ';' separated values --> elements

Hi all,

I'm receiving XML generated by MS Access that looks like this:

<Link>http://www.google.com;NA</Link>

My XSLT is not reading this as 2 separate elements.

It does understand:
<root>
<Link>
   <Value>http://www.google.com></Value>
<Link>
<Link>
   <Value>NA</Value>
<Link>
<root>

When trying to process it such as:

<td colspan="1" style="font-size:8pt; padding-left:5px;" class="cellBorders">
                        <xsl:choose>
                          <xsl:when test="Link != ''">
                            <xsl:if test="Link = 'NA'">
                              <center style="padding-top:5px;">
                                N/A
                              </center>
                            </xsl:if>
                            <xsl:if test="Link != 'NA'">
                              <a target="_blank">
                                <xsl:attribute name="href">
                                  <xsl:value-of select="Link"/>
                                </xsl:attribute>
                                <img src="images\coursesubmit.gif" style="border:0px; padding-left:3px;padding-top:2px;"></img>
                              </a>
                            </xsl:if>
                          </xsl:when>
                          <xsl:otherwise>
                            <img src="images\gap.gif"></img>
                          </xsl:otherwise>
                        </xsl:choose>
                      </td>

Is there a way to separate the ';' into 2 separate elements?

Thanks!!!

 
Old June 11th, 2007, 02:56 PM
mhkay's Avatar
Wrox Author
 
Join Date: Apr 2004
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
Default

In XSLT 2.0 use the tokenize() function or the xsl:analyze-string instruction.

If you're stuck with XSLT 1.0, take a look at the string-handling library at www.exslt.org.

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
Populate a list box from comma separated values CoderNH Access VBA 3 October 20th, 2008 08:37 AM
Comma Separated values aldwinenriquez SQL Server 2005 3 June 1st, 2007 08:52 PM
comma separated list MunishBhatia SQL Server 2000 11 March 21st, 2007 03:56 PM
selecting elements from comma separated list rjonk XSLT 4 September 29th, 2006 08:46 AM
comma separated list of attributes rjonk XSLT 3 September 27th, 2006 11:52 AM





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