Re: [xsl] managing footnotes in nested elements

Subject: Re: [xsl] managing footnotes in nested elements
From: David Carlisle <davidc@xxxxxxxxx>
Date: Mon, 24 Sep 2007 12:20:58 +0100
> 1. I want to test whether a particular table node (the context node)
> contains any descendant footnote elements where (a) the footnote "level"
> attribute has the value "table", and (b) the footnote's nearest table
> ancestor is the context node.


> 2. The next step is to generalise this test so that the context node may be
> anything, i.e. for the current node, X say, there is at least one footnote
> element with its level attribute = "X", and that footnote's nearest ancestor
> X is in fact the context node X.


> but it's not working.
mainly because you are using . (which is the fotnote element being
tested) not current() (which is the current node at the start of the

Although looking at your original post I wouldn't do this test at all.

You only need to look all the way down at footnotes and then look back
to check you haven't gone inside a nested table because you were too
agressive in collecting footnotes in the first place.

so instead of

>    <xsl:apply-templates
>        select="descendant::footnote[@level=$local]"
>         mode="footnote"/>

I'd (perhaps) do

   <xsl:apply-templates  select="*"  mode="footnote"/>

On most elements you just want to recurse (on elements, not text) so:

<xsl:template match="*" mode="foornote">
   <xsl:apply-templates  select="*" mode="footnote"/>

on table elements you want to stop looking (you'll handle the nested
table later)

<xsl:template match="table" mode="foornote"/>

and foootnote elements you want to do whatever it is you want to do:

<xsl:template match="footnote[@level='footnote']" mode="foornote">
  make a footnote


The Numerical Algorithms Group Ltd is a company registered in England
and Wales with company number 1249803. The registered office is:
Wilkinson House, Jordan Hill Road, Oxford OX2 8DR, United Kingdom.

This e-mail has been scanned for all viruses by Star. The service is
powered by MessageLabs. 

Current Thread