[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

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
kay generation
> 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

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.