Subject: [xsl] Re: Xslt string operation: Split From: Cristobal Galiano Fernandez <c.galiano@xxxxx> Date: Thu, 07 Jun 2001 13:04:45 +0200 |
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> <a href="#id6">6</a> <a >href="#id7">7</a> --> <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 |
---|
|
<- Previous | Index | Next -> |
---|---|---|
RE: [xsl] Xslt string operation, Michael Kay | Thread | [xsl] util:expr, Richard Humagain |
RE: [xsl] Xslt string operation, Michael Kay | Date | Re: [xsl] xml->xsl->pdf, Joern Clausen |
Month |