|
Subject: Re: [xsl] xpath key problems From: Martin Honnen <Martin.Honnen@xxxxxx> Date: Sun, 21 Nov 2010 19:42:11 +0100 |
<!-- Two problems, the first of which is fatal:
1. Doesn't work; key returns nothing
Change @use to "." and it returns the current element
Change @use to any function (e.g., string-length(.) or name(.)) and it returns nothing (?)
Same results with . or current() or self::node() or nothing; does the choice matter here?
2. Very slow
Is this inevitable with the long axes or can it be optimized (Saxon HE 9.2.1.2)?
Likely to get *much* slower when we also count lines (see below)
-->
<!-- desired result: @folio value for most immediately preceding<pb> in same ms (specific hm28x)
1. get all preceding<pb> elements
2. restrict the set to those in the same ms
3. take the last (immediately preceding) one of those
-->
<!-- interim simplifications
Must handle first page of each ms specially, since there is no preceding<pb>
Contents of each ms line requires additional templates
Eventually must also count<lb> elements between that most recent preceding<pb> and current location;
full pointer will be something like 312r14, where 312r is the page and 14 is the line on the page
-->
<xsl:key name="msline-pb" match="hm281 | hm280 | hm282"
use="preceding::pb[parent::*/name() eq name()][1]/@folio"/>
<xsl:template match="hm281 | hm280 | hm282">
<pointer>
<xsl:value-of select="key('msline-pb',.)"/>
Martin Honnen http://msmvps.com/blogs/martin_honnen/
| Current Thread |
|---|
|
| <- Previous | Index | Next -> |
|---|---|---|
| Re: [xsl] xpath key problems, Syd Bauman | Thread | Re: [xsl] xpath key problems, Piet van Oostrum |
| Re: [xsl] xpath key problems, Syd Bauman | Date | Re: [xsl] xpath key problems, Piet van Oostrum |
| Month |