xsl-list
[Top] [All Lists]

Re: Numbering cross refs

2003-12-11 06:32:49


The way to get numbered cross refs to work is
1) get the numbering of the item (figure, chapter, table, ...)
   to work
2  when making the cross ref, go to the node that is referenced (with
   for-each or apply-templates in a special mode)
3) produce the number with the same code as in step 1.


In your case you have
  <xsl:number count="figure" level="any" from="mainfunc" format="1"/>
for step 1 so for step 2 you want
<xsl:template match="xref">
    <fo:basic-link background-color="lightblue"
internal-destination="{(_at_)xrefid}">
    <xsl:text>Fig. </xsl:text>
    <xsl:for-each select="id(@xrefid)"/>
  

so at this point (assuming that you have a dtd and your figure ids are
of type ID so id() function works.) you are at teh figure, so now you
can do
 <xsl:number count="figure" level="any" from="mainfunc" format="1"/>

then just finish up
  </xsl:for-each>
</fo:basic-link>
</xsl:template>

If you haven't declared your ids to be of type id you can declare a key
instead and use key() rather than id()

Without seeing a (small) input file I'm a bit confused as you have
internal-destination="{(_at_)xrefid}"
which implies that your source doc has ids that you can use in teh
generated FO for cross referencing, but in teh figure itself
<xsl:template match="figure">
and
<xsl:template match="graphic">
you are not accessing any id attribute and using generate-id to put a
machine generated if into the FO which won't have any relationship to
the id used in your fo:basic-link.

I suspect you don't want id="{generate-id(.)}£ but instead 
id="{(_at_)id}"
or whatever the attribute is called that stores teh value taht is used
in the xrefid attribute of xref.

David



-- 
http://www.dcarlisle.demon.co.uk/matthew

________________________________________________________________________
This e-mail has been scanned for all viruses by Star Internet. The
service is powered by MessageLabs. For more information on a proactive
anti-virus service working around the clock, around the globe, visit:
http://www.star.net.uk
________________________________________________________________________

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



<Prev in Thread] Current Thread [Next in Thread>