Subject: Re: [xsl] Generating numbering for cross-references (LONG) From: Wendell Piez <wapiez@xxxxxxxxxxxxxxxx> Date: Thu, 18 Oct 2001 12:32:52 -0400 |
<xsl:template match="ref"> <xsl:apply-templates select="id(@to)" mode="ref-label"/> </xsl:template>
<xsl:template match="section" mode="ref-label"> <xsl:text>Section </xsl:text> <xsl:number level="multiple" format="1.1.1"/> </xsl:template>
Cheers, Wendell
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">
b. Chapters/sections/subsections/etc, where the reference looks the same as above but points at (eg) <section id="foo"> and needs to generate a decimal-style reference (eg 1.1.1)
c. Reading lists (bibliographies) where the citation says <cite work="foo"/> and the entry says <bibentry 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? ********************************************************************
References can be scattered (randomly distributed) through the document, so <xsl:number> cannot be used at the point of reference as it can be at the target, as it presupposes sequence.
Cheers, Wendell
====================================================================== Wendell Piez mailto:wapiez@xxxxxxxxxxxxxxxx Mulberry Technologies, Inc. http://www.mulberrytech.com 17 West Jefferson Street Direct Phone: 301/315-9635 Suite 207 Phone: 301/315-9631 Rockville, MD 20850 Fax: 301/315-8285 ---------------------------------------------------------------------- Mulberry Technologies: A Consultancy Specializing in SGML and XML ======================================================================
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] Generating numbering for , Thomas B. Passin | Thread | RE: [xsl] Generating numbering for , DPawson |
Re: [xsl] xsl output and d-o-e, David Carlisle | Date | Re: [xsl] Case conversion in XSL?, Wendell Piez |
Month |