[xsl] translate array delimiters in XSLT

Subject: [xsl] translate array delimiters in XSLT
From: Cas Tuyn <Cas.Tuyn@xxxxxxxx>
Date: Fri, 18 Mar 2005 17:36:55 +0100

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 select="@software">
    <xsl:value-of select="."/>,

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="."/>

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

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


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.

Current Thread