|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] RE: automatic generation of figure numbers
> 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
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|

Cart








