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]

RE: automatic generation of figure numbers


Dhruv Raheja writes:
 > The first 3 instances have unique/different "file" values, which means that 
 > they point to different image files. However the 4th instance has the same 
 > value for the  "file" attribute as the 1st instance. This measn that 
 > somewhere in the document I feel the need to refer to "Figure 1" again , 
 > i.e. I may have multiple occurences of "Figure 1" in the document. 

I am afraid my reaction is "I would not start from here". I would
assign a unique ID to each real <figure>, and if I wanted to refer
again to Figure 1, I'd use a new element <figureref id="whatever"/>,
which matched <figure id="whatever">. Then

 <xsl:template match="figureref">
  <a href="{id(@idref)/@file}">
    Figure <xsl:apply-templates select="id(idref)" mode="xref"/>
  </a>
 </xsl:template>

 <xsl:template match="figure" mode="xref">
   <xsl:number level="any">
 </xsl:template>

use the power of XSLT & XPATH.....

Sebastian


 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]