[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: managing footnotes in nested elements

Subject: Re: managing footnotes in nested elements
From: David Carlisle <davidc@xxxxxxxxx>
Date: Mon, 24 Sep 2007 12:20:58 +0100
Re:  managing footnotes in nested elements
> 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.

.//footnote[@level='table'][generate-id(ancestor::table[1])=generate-id(current())]

> 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.

.//footnote[@level='table'][generate-id(ancestor::*[name()=name(current())][1])=generate-id(current())]

> 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
expression)


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"/>
</xsl:template>

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
</xsl:template>

David


________________________________________________________________________
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

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.