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

Re: Xslt string operation: Split

Subject: Re: Xslt string operation: Split
From: Cristobal Galiano Fernandez <c.galiano@xxxxx>
Date: Thu, 07 Jun 2001 13:04:45 +0200
xslt split
XSLT split

Non tested.

Cristóbal galiano Fdez


<!-- 2000-09-19. StrSplit.XSL  (*Modificar*)
     2000-10-10. "Chris Bayes" <Chris@xxxxxxxxxxx>
     """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""

     -Split
         .Servirá como base para realizar el template
     -Parámetros
         str       -> Cadena de trabajo                                  (I)
     """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""

>Given
><doc>
><elem>5,6,7</elem>
></doc>
>
>I need an output of
>
><a href="#id5">5</a>&nbsp;<a href="#id6">6</a>&nbsp;<a
>href="#id7">7</a>&nbsp;-->


 <xsl:template name="StrSplit">
        <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: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:otherwise>
        </xsl:choose>
</xsl:template>
</xsl:stylesheet>

Michael Kay escribió:

> > is there a way in which is a string passed in as a parameter
> > to the xsl like
> > this
> >
> > "23,45,234,678"
> >
> > sliced up into
> > 23
> > 45
> > 234
> > 678
> >
> > is there any way to do this
>
> You need a recursive template; see the example under "xsl:call-template" in
> Chapter 4 of my XSLT Programmer's Reference.
>
> Mike Kay
>
>  XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


 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.