|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: Generating numbering for cross-references (LONG)
At 01/10/18 02:06 +0100, Peter Flynn wrote:
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. ... 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. But you can temporarily place yourself *at* the relevant part of the tree and calculate the number the same way you are going to when you eventually get around to the normal serialization. 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? ... What I find unbelievable is that no-one has yet done this. It must be one of the most common requirements in document processing, and without it, XSLT simply cannot be used to reproduce simple numeric cross-references like "see Figure 16" or <plug>bibliographic references like Kay[23]</plug> :-) I must have missed something in your description. When I need to do this, I do the following kind of coding: At the point of reference: ...
<xsl:text>See Construct </xsl:text>
<xsl:for-each select="id(@idref)">
<xsl:call-template name="construct-number"/>
</xsl:for-each>
...At the point of definition: ... <xsl:text>Construct </xsl:text> <xsl:call-template name="construct-number"/> ... And elsewhere for maintenance: <xsl:template name="construct-number">
...
<xsl:number ...>
</xsl:template>By using the named template I'm sure it is always consistent. I hope this helps. .................. Ken
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|

Cart








