Subject: Re: [xsl] Generating numbering for cross-references (LONG) From: "Christopher R. Maden" <crism@xxxxxxxxx> Date: Wed, 17 Oct 2001 23:17:53 -0700 |
In a typical research document, an author needs to make many cross-references. XML provides ID and IDREF attributes for this purpose, and lots of DTDs are written to make use of them. I'm having a problem instatiating three classes of numeric cross-reference in XSLT, namely:
a. Tables and figures, as in `See <ref to="foo"/>' where you have <table id="foo"> or <figure id="foo">
In normal processing of the document text, you use <xsl:number> to assign counters to tables, figures, chapters, sections, bib entries, etc. At serialization, these numbers get values in the normal way, but those values are not available or accessible to other places in the stylesheet because the language is side-effect free. You cannot reach over to the relevant part of the tree (by ID) and pluck a copy of a number which has not yet been generated.
******************************************************************** At the point where a reference is made, what is the XPath expression you need to generate the number which will be the value which will eventually get assigned to the target? ********************************************************************
<xsl:template match="ref"> <xsl:apply-templates select="id(@to)" mode="ref"/> </xsl:template>
<xsl:template match="table" mode="ref"> <xsl:text>Table </xsl:text> <xsl:number/> </xsl:template>
-Chris -- Christopher R. Maden, Principal Consultant, HMM Consulting Int'l, Inc. DTDs/schemas - conversion - ebooks - publishing - Web - B2B - training <URL: http://www.hmmci.com/ > <URL: http://crism.maden.org/consulting/ > PGP Fingerprint: BBA6 4085 DED0 E176 D6D4 5DFC AC52 F825 AFEC 58DA
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
[xsl] Generating numbering for cros, Peter Flynn | Thread | Re: [xsl] Generating numbering for , Peter Flynn |
[xsl] xsl:template doesn't work pro, RABi | Date | Re: [xsl] xsl output and d-o-e, Joerg Pietschmann |
Month |