xsl-list
[Top] [All Lists]

RE: [xsl] "grouping" footnote numbers

2011-10-11 05:06:32
From: David Carlisle [mailto:davidc(_at_)nag(_dot_)co(_dot_)uk]

count="xref[@type='fn']"/></sup></a>

The secret for numbering any kind of cross reference in xslt is to
number the thing being referenced, not the reference. Here you want to
number the footnotes, and you want the cross reference to use the numbr
of teh references footnote, so

Thank you very much for your solution. I realise I forgot to specify where the 
goalposts were in my original post, as I'm dealing with XML chunked up into 
fragments in a CMS, so the footnote text, scattered into little documents, is 
not that readily available.

Fortunately, the requirement is to restart numbering on each page, so I think 
pursuing a solution that numbers the xrefs within the current document based on 
their @href is still what I want.

So I am hereby moving the goalposts to a more suitable location. :) Your 
example still got me nearly there:

Given this XML:
---------------

<p>blah blah <xref href="footnote-xyz"/></p>

<p>more blah <xref href="footnote-xyz"/></p>

<p>last blah <xref href="footnote-abc"/></p>

This XSL:
---------

<xsl:key name="fn" match="xref" use="@href"/>
...
<sup>
  <xsl:for-each-group select="key('fn', @href)" group-by="@href">
    <xsl:number level="any"/>
  </xsl:for-each-group>
</sup>

Produces this output:
---------------------

<p>blah blah <sup>1</sup></p>

<p>more blah <sup>1</sup></p>

<p>last blah <sup>3</sup></p>

But I would like to get:
------------------------

<p>blah blah <sup>1</sup></p>

<p>more blah <sup>1</sup></p>

<p>last blah <sup>2</sup></p>


So the desired output is for the references to "footnote-xyz" to both be 
numbered "1", but the reference to "footnote-abc" to be numbered "2". I'm sooo 
close. :)


--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--