Re: [xsl] Bibliography References

Subject: Re: [xsl] Bibliography References
From: David Carlisle <davidc@xxxxxxxxx>
Date: Wed, 13 Sep 2006 23:47:36 +0100
always in any cross referencing in xslt the trick is to always generate
the number on the _referenced_ node, often just using <xsl:number/> does
the job, sometimes you need to use count() but whatever it is just code
it once.

then to make a cross reference (whether the reference text is a number
or a section heading or short id etc) the method is the same _go to teh
referenced node_ and generate the text.

so in this case

<xsl:key name="bib" match="To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
In-reply-to: <20060913211639.15613.qmail@xxxxxxxxxxxxxxxxxxxxxxx> (message
	from siarom egrub on Wed, 13 Sep 2006 14:16:39 -0700 (PDT))
Subject: Re: [xsl] Bibliography References
FCC: ~/Mail/sent
References:  <20060913211639.15613.qmail@xxxxxxxxxxxxxxxxxxxxxxx>
--text follows this line--

always in any cross referencing in xslt the trick is to always generate
the number on the _referenced_ node, often just using <xsl:number/> does
the job, sometimes you need to use count() but whatever it is just code
it once.

then to make a cross reference (whether the reference text is a number
or a section heading or short id etc) the method is the same _go to teh
referenced node_ and generate the text.

so in this case

<xsl:key name="bib" match="bibliomixed" use="@id"/>

<!-- make a numbered listing at the end -->
<xsl:template match="bibliomixed">
[<xsl:number/>] <xsl:apply-templates/>
</xsl:template>

<!--make xref-->

<xsl:template match="xref">
 see [<xsl:for-each
 select="key('bib',@xref)"><xsl:number/></xsl:for-each>]
</xsl:template>

see xsl:number is evaluated in both cases on the bibliomixed element,so
it makes the same number on both cases. If instead of [3] you wanted
[National Committee...]or [NatCom2006] or any other format you'd use the
smae basic idea, go the the bibliomixed node then (instead of
xsl:number) generate the same text for both the xref and the listing.

David

Current Thread