[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

RE: translate array delimiters in XSLT

Subject: RE: translate array delimiters in XSLT
From: "Aron Bock" <aronbock@xxxxxxxxxxx>
Date: Fri, 18 Mar 2005 16:47:20 +0000
xslt translate
Cas, search this list for references to Sal Mangano's "XSL Cookbook"; it contains templates for text-replace, split(), etc.

--A

From: Cas Tuyn <Cas.Tuyn@xxxxxxxx>
Reply-To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Subject:  translate array delimiters in XSLT
Date: Fri, 18 Mar 2005 17:36:55 +0100

Hi,

To display a list of software releases with ", " delimited that are
mentioned in XML as ";" delimited:

<procedure software="3.3.7;3.3.8;3.3.9;3.4.0;3.4.2;3.4.4">

I had written in the perl function that cleans up the XML, this sinple
regular expression:

         if ( $line =~ /software=/ ) {
            $line =~ s#;#, #g ;
         }

Obviously this only worked for software values on the same line and not
for software values that spanned multiple lines, so I now want to
transfer this 'logic' from Perl to XSLT. I removed the 3 lines from the
Perl program, and changed this XSLT:

<xsl:for-each select="@software">
    <xsl:value-of select="."/>
</xsl:for-each>

to:

<xsl:for-each select="@software">
    <xsl:value-of select="."/>,
</xsl:for-each>

but that only produced one "," behind the last SW release, not inbetween.

Reading in Michael Kay's XSLT book on the translate() function made me
try this:

<xsl:for-each select="translate(@software,';',', ')">
    <xsl:value-of select="."/>
</xsl:for-each>

but that did not prove valid XSLT, even with string() around the array
@software.

Anyone has a tip to convert ";" to ", " without reverting to Perl?

Cas


--
The information contained in this communication and any attachments is confidential and may be privileged, and is for the sole use of the intended recipient(s). Any unauthorized review, use, disclosure or distribution is prohibited. If you are not the intended recipient, please notify the sender immediately by replying to this message and destroy all copies of this message and any attachments. ASML is neither liable for the proper and complete transmission of the information contained in this communication, nor for any delay in its receipt.



_________________________________________________________________
Express yourself instantly with MSN Messenger! Download today - it's FREE! http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.