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. .//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 |
---|
|
<- Previous | Index | Next -> |
---|---|---|
RE: [xsl] managing footnotes in nes, Trevor Nicholls | Thread | [xsl] New user issue: use of Muenc, Dunk, Michael (Mike) |
RE: [xsl] [XSL]Display Different Re, Alice Ju-Hsuan Wei | Date | RE: [xsl] [XSL]Display Different Re, Michael Kay |
Month |