RE: [xsl] for-each...

Subject: RE: [xsl] for-each...
From: "Avula, Raj" <RAvula@xxxxxxxxxxx>
Date: Wed, 19 Dec 2001 14:40:29 -0800
		<xsl:if test="position()!=last()">
			<xsl:text>.</xsl:text>
		</xsl:if>


--Raj..

> -----Original Message-----
> From:	gabor farkas [SMTP:xlat@xxxxxxxx]
> Sent:	Wednesday, December 19, 2001 2:30 PM
> To:	XSL-List@xxxxxxxxxxxxxxxxxxxxxx
> Subject:	[xsl] for-each...
> 
> hi,
> 
> i have a tree of <chapter>s in my xml files,
> and i use this code to generate chapter numbers ( like chapter 1.5.3):
> 
> <xsl:template name = "chapter-prefix">
>         <xsl:for-each select="ancestor-or-self::chapter">
>                 <xsl:value-of select="count(preceding-sibling::chapter)+1"
> />
>                 <xsl:text>.</xsl:text>
>         </xsl:for-each>
> </xsl:template>
> 
> and it works...
> but it generates for example. 1.5.4. and i want 1.5.4 , i don't need
> that last dot.
> 
> i know i can do it like this:
> 
> <xsl:template name = "chapter-prefix">
> 
> <xsl:variable name="temp">
>         <xsl:for-each select="ancestor-or-self::chapter">
>                 <xsl:value-of select="count(preceding-sibling::chapter)+1"
> />
>                 <xsl:text>.</xsl:text>
>         </xsl:for-each>
> </xsl:variable>
> <xsl:value-of select="substring($temp,0,string-length($temp))"/>
> 
> </xsl:template>
> 
> but isn't there any more elegant solution?
> 
> bye,
> gabor
> 
> 
>  XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
> 

"MMS <firstam.com>" made the following
 annotations on 12/19/01 14:41:34
------------------------------------------------------------------------------
"THIS E-MAIL MESSAGE AND ANY FILES TRANSMITTED HEREWITH, ARE INTENDED SOLELY FOR THE USE OF THE INDIVIDUAL(S) ADDRESSED AND MAY CONTAIN CONFIDENTIAL, PROPRIETARY OR PRIVILEGED INFORMATION.  IF YOU ARE NOT THE ADDRESSEE INDICATED IN THIS MESSAGE (OR RESPONSIBLE FOR DELIVERY OF THIS MESSAGE TO SUCH PERSON) YOU MAY NOT REVIEW, USE, DISCLOSE OR DISTRIBUTE THIS MESSAGE OR ANY FILES TRANSMITTED HEREWITH.  IF YOU RECEIVE THIS MESSAGE IN ERROR, PLEASE CONTACT THE SENDER BY REPLY E-MAIL AND DELETE THIS MESSAGE AND ALL COPIES OF IT FROM YOUR SYSTEM."

==============================================================================


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


Current Thread