I've had my nose too close to the grindstone to see this. It looks like a candidate for Key, but I haven't grokked the fullness of keys yet. This should be really obvious but I'm probably lacking enough sleep or caffeine or something. Given some para text containing an IDREF reference to something in the bibliography of the document, eg <cit doc="someid">something</cit> , and some biblio references at the end to be sorted, each with an ID attribute, how can I replicate in the <ref> template the value which HTML will generate for the <li> that I am placing round each bib reference after sorting at the end of the doc? In other words, how do I hoik back an xsl:number from elsewhere in the tree post-sorting but pre-serialization? I can kludge round it by re-doing the entire sort locally each time a <cit> node gets handled, and testing the IDs against the IDREF, but that makes me think of steamhammers and nuts. Fragment: <para>Some text referring to <cit doc="bar">PF</cit>.</para> <para>Some more text referring to <cit doc="foo">MB</cit></para> [...] <!-- doc is declared as IDREF in the DTD, bar below is an ID --> <refs> <book id="bar"> <author>Peter <name>Foo</name></author> <title>Bars I Have Known</title> <etc>Blah</etc> </book> <article id="foo"> <author>Michael <name>Bar</name></author> <title>Foos I Have Barred</title> <doctitle>World Foo Encyclopaedia</doctitle> <etc>Blort</etc> </article> </refs> I'm trying to do this: <xsl:template match="cit"> <xsl:apply-templates/> <sup> <a> <xsl:attribute name="href"> <xsl:text>#</xsl:text> <xsl:value-of select="@doc"/> </xsl:attribute> <!-- need to replicate number generated in refs <xsl:value-of select="WTF?"/> -->? </a> </sup> </xsl:template> <xsl:template match="refs"> <h3>References</h3> <ol> <xsl:for-each select="book|article"> <xsl:sort select="author/name"/> <li><!-- Need to generate number --> <xsl:apply-templates/> </li> </xsl:for-each> </ol> </xsl:template> Should you have the time, you can get the abbreviated instance at http://oimelc.ucc.ie/bibref.xml | http://oimelc.ucc.ie/bibref.xsl (warning, use right-click, that's a Cocoon server). And my apologies to the purists for the goddessawful hybrid bib ref format...it was none of my doing, honest. ///Peter -- XSL: Think like a tree, not a chainsaw. 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