RE: string split

Subject: RE: string split
From: "Pawson, David" <DPawson@xxxxxxxxxxx>
Date: Tue, 19 Sep 2000 14:52:25 +0100
> bash$ sed -e "s@\\([0-9]\\)\\,*@<a 
> href='#id\\1'>\\1</a>\\&nspb;@g" dp5.xml 
> <doc>
> <elem><a href='#id5'>5</a>&nspb;<a href='#id6'>6</a>&nspb;<a 
> href='#id7'>7</a>&nspb;</elem>
> </doc>

I've never seen modem noise on email before!

Jarno Elovirta and Don Bruey both provided an answer off-list,
which had a far better signal to noise ratio.

I had 'forgotten' that I can output content from the named
template :-| I was trying to collect it into a variable in
the calling template. Live and learn.


Jarno's solution:

<xsl:template match="doc/elem">
  <xsl:call-template name="links">
    <xsl:with-param name="str" select="."/>

<xsl:template name="links">
  <xsl:param name="str"/>
    <xsl:when test="contains($str,',')">
      <a href="#id{substring-before($str,',')}"><xsl:value-of
      <xsl:call-template name="links">
        <xsl:with-param name="str" select="substring-after($str,',')"/>
      <a href="#id{$str}"><xsl:value-of select="$str"/></a>

 XSL-List info and archive:

Current Thread