Re: complex positioning problem
I'd try doing this by first processing the entire document expanding my citations into an (ad-hoc, locally-namespaced) markup format that provides each citation or footnote reference with whatever information it needs apart from the first/subsequent rule (that is, as if they were thence to be rendered all alike irrespective of their positions in the final list), and then in a second pass introduce the Ibid/Idem, op.cit., etc. based on their positions relative to one another. The rest of the second pass could be an identity transform otherwise, assuming there's nothing else it is useful for it to do.
Well in that pass, their relative positions are determinable in reference to "document order". So, for example, they could be collected in a variable in which position() could be checked, or even axes used to look at the immediate preceding one, etc.
Of course, XSLT 2.0 / XPath 2.0 also lets you construct sequences, which could provide an even more direct way to do this, though perhaps not quite as clean.
I append your code and a bit of spec from earlier in case anyone has time today to try it (using either or any approach), noting that this sample should be extended to exhibit the requirement:
<?xml version="1.0" encoding="utf-8"?> <article xmlns="http://docbook.org/docbook-ng"> <info> <title>Test</title> </info> <section> <info> <title>Introduction</title> </info> <para>Some citations: <citation><biblioref linkend="one"/><biblioref linkend="two"/></citation></para> </section> <bibliography> <modsCollection xmlns="http://www.loc.gov/mods/v3"> <mods ID="one"> <name type="personal"> <namePart type="given">John</namePart> <namePart type="family">Doe</namePart> <role> <roleTerm type="text">author</roleTerm> </role> </name> <titleInfo> <title>Some Title</title> </titleInfo> <originInfo> <dateIssued>1999</dateIssued> </originInfo> </mods> <mods ID="two"> <name type="personal"> <namePart type="given">John</namePart> <namePart type="family">Doe</namePart> <role> <roleTerm type="text">author</roleTerm> </role> </name> <titleInfo> <title>Another Title</title> </titleInfo> <originInfo> <dateIssued>1999</dateIssued> </originInfo> </mods> </modsCollection> </bibliography> </article>
The most difficult one is note (footnote/endnote) style, whereby rendering of citations is determined by their relative position within the text. For example, we have:
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