[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: xpath key problems
Birnbaum, David J wrote:
<!-- 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"/> You might want use="preceding::pb[parent::*/name() eq name(current())][1]/@folio" to define your key but I am not sure I understand what you want to do with the key as <xsl:template match="hm281 | hm280 | hm282"> <pointer> <xsl:value-of select="key('msline-pb',.)"/> this passes the contents of the 'hm28x' elements to the key function while above you define the value as something like '282r'. The contents seems to be text like 'P2 P;Q#QP>. RP5R Q!R P3R. ' so I don't see what you want to do with that key. -- Martin Honnen http://msmvps.com/blogs/martin_honnen/
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|