This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: problem with xsl:number



Hi Bryan..
<xsl:number> would give  you the position of the element in the source
tree. Try giving a node value to the count attribute..
<xsl:number count = "node you wana count"/>
HTH
laura

>From: "Bryan Rasmussen" <bry@itnisk.com>
>Reply-To: xsl-list@lists.mulberrytech.com
>To: <xsl-list@lists.mulberrytech.com>
>Subject: [xsl] problem with xsl:number
>Date: Wed, 27 Mar 2002 12:54:27 +0100
>
>
>hey I was just hoping someone knew why a problem I ran into today occurred.
>I had a variable in a template matching a tag image as follows:
>
><xsl:template match="image">
><xsl:variable name="imgCount"><xsl:number/></xsl:variable>
><xsl:variable name="class"><xsl:choose><xsl:when test="$imgCount mod
>2">odd</xsl:when><xsl:otherwise>even</xsl:otherwise></xsl:choose></xsl:varia
>ble>
><img src="{concat($floc,@scr)}" class="{concat('img',$class)}"
>id="{concat('img', $class, $imgCount)}"/>
></xsl:template>
>
>the $floc is a global parameter, not pertinent in this case.
>
>this matches a relatively flat file; I had the following fragment
><p><image scr="some.jpg"/></p>
><p><image scr="other.jpg"/></p>
>
>xsl:number returned 1 both times, is this a problem with my not having 
>given
>a specific level for the number generated? I ended up fixing it another way
>but it bugged me(don't want to try testing for explanation cause the xslt 
>is
>included in someone elses project on another computer.)
>Hope someone can explain this rather strange result. processor is msxml 4
>
>
>  XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
>




_________________________________________________________________
Join the world’s largest e-mail service with MSN Hotmail. 
http://www.hotmail.com


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]