xsl-list
[Top] [All Lists]

Re: How to render TEI <div*>s with chapter-like pagination?

2003-04-14 16:25:00
Is there any way to select or process the siblings
in
between one top-level <div*> and the next,
especially
with something that only uses XPath 1.0?


--- David Carlisle <davidc(_at_)nag(_dot_)co(_dot_)uk> wrote:

Yes this is a grouping problem, see the usual places
like Jeni's site.
one way:
<xsl:key name="x"  match="node()"
use="generate-id((..|preceding-sibling::div1|

preceding-sibling::div2|preceding-sibling::div3)[last()])"/>

Then
sitting on the parent


for-each select=".|div1|div2|div3"

the requested set of nodes is
  key('x',generate-id(.))

Turns out that the above doesn't *quite* work because
a  div1 may have a sibling that is a div1. Easy enough
problem to fix, though, at least by a combination of
"for-each" and "if". Still, I wish I knew why

<xsl:key name="x" 
match="node()[not(starts-with(name(), div))]"
use="generate-id((..|preceding-sibling::div1|
preceding-sibling::div2|preceding-sibling::div3)[last()])"/>

doesn't work, or why the following doesn't do what the
xsl:key line you gave me does:

<xsl:key name="x"  match="node()"
use="generate-id(..|preceding-sibling::div1[1]|
preceding-sibling::div2[1]|preceding-sibling::div3[1])"/>


__________________________________________________
Do you Yahoo!?
Yahoo! Tax Center - File online, calculators, forms, and more
http://tax.yahoo.com

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list