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

RE: string split

Subject: RE: string split
From: "Pawson, David" <DPawson@xxxxxxxxxxx>
Date: Tue, 19 Sep 2000 14:52:25 +0100
bash string split
> 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.

DaveP

Jarno's solution:

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

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


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


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.