Re: How to use for-each to get comma searated list?

Subject: Re: How to use for-each to get comma searated list?
From: "Farrukh S. Najmi" <najmi@xxxxxxxxx>
Date: Wed, 02 Dec 1998 17:23:03 -0500
Thanks Gabriel for the suggestion. I should have read the spec better.
However, I am still having trouble with the MSIE5.0beta2 processing of
my very simple XSL and XSL (attached to this message). I get an error as
follows:

---begin error in MSIE5.0b2

The XML page cannot be displayed 

Cannot view XML input using XSL style sheet. Please correct the error
and then click the Refresh button, or try again later. 


--------------------------------------------------------------------------------
Keyword xsl:text may not be used here. 
 
---end error in MSIE5.0b2

Is this a bug in IE or am I doing something wrong? Is there a
workaround?

-Regards,
Farrukh

Gabriel Paiz III wrote:
> 
> How about adding an 'if' around comma text:
> 
> <xsl:if match=".[$not$ end()]">
>          <xsl:text>,</xsl:text>
> </xsl:if>
> 
> __________________________________
> SPX - Valley Forge T.I.S.
> 25691 Atlantic Ocean Drive Suite B-7
> Lake Forest, CA 92630
> USA    www.vftis.com
> __________________________________
> 
> Tel:    (949) 460 0094
> Fax:    (949) 460 0095
> e-Mail: gpaiz@xxxxxxxxx
> __________________________________
> 
> > #Following is a simplified target HTML mapping desired
> >
> > <BODY>valueList="3.75,2.25"</BODY>
> >
> > --------------
> >
> > #Following is my simplified XSL file
> >
> > <xsl:template match="/">
> > <BODY>
> >        <xsl:text>valueList="</xsl:text>
> >        <xsl:for-each select="Section/Foo">
> >           <xsl:process select="Value"/>
> >           <xsl:text>,</xsl:text>
> >        </xsl:for-each>
> >        <xsl:text>"</xsl:text>
> > </BODY>
> > </xsl:template>

-- 

Regards,
Farrukh Najmi
<?xml version="1.0"?>
<?xml:stylesheet type="text/xsl" href="./simple.xsl" ?>

<Doc>

<Section>
  <ListElement>3.75</ListElement>
</Section>

<Section>
  <ListElement>2.75</ListElement>
</Section>


</Doc>
<xsl:stylesheet
  xmlns:xsl="http://www.w3.org/TR/WD-xsl";
  xmlns:fo="http://www.w3.org/TR/WD-xsl/FO";
  result-ns="fo">

<xsl:template match="/">

<HTML>

<HEAD>
  <TITLE>List Test</TITLE>
</HEAD>

<BODY bgcolor="#ffffff" >
<P>
       <xsl:text>list="</xsl:text>
       <xsl:for-each select="Section">
          <xsl:process select="ListElement"/>
          <xsl:if test=".[not-last-of-type()]">, </xsl:if>
       </xsl:for-each> 
       <xsl:text>"</xsl:text>

</P>
</BODY>
</HTML>

</xsl:template>

</xsl:stylesheet>

Current Thread