[XSL-LIST Mailing List Archive Home]
[By Thread]
[By Date]
RE: automatic generation of figure numbers
Subject: RE: automatic generation of figure numbers From: Kay Michael <Michael.Kay@xxxxxxx> Date: Wed, 4 Oct 2000 19:07:21 +0100 |
> Mike Kay suggested (I am thankful to him for that) the following code: > > <xsl:template match="figure"> > <xsl:variable name="fig"><!--variable for the figure number--> > <xsl:for-each select="//figure[@file=current()/@file][1]"> > <xsl:number level="any" > count="figure[not(@file=preceding::file/@file)]"/> > </xsl:for-each> > </xsl:variable> > <xsl:value-of select="$fig"/> > </xsl:template> > > Also Mike, I am unable to follow logic of the code (which > is entirely my shortcoming). Could you/anybody else explain > it to me I've made a couple of little corrections. The xsl:variable statement first (in the for-each part) finds the first <figure> in the document whose @file attribute is the same as the @file value of the current <figure>. Then (in the xsl:number part) it assigns a sequence number to this <figure>, getting its position among all those <figure>s in the document whose @file attribute is not the same as the @file attribute of some preceding figure. Then (in the xsl:value-of) it writes the result to the output. Mike Kay XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
RE: automatic generation of figure , Sebastian Rahtz | Thread | Re:automatic generation of figure n, Dhruv Raheja |
Re: where to put the filter?, John E. Simpson | Date | RE: passing parameters to xslt from, Kay Michael |
Month |