xsl-list
[Top] [All Lists]

Re: navigation, TEI

2004-06-23 14:11:40
Thanks for the answers! At the moment, the solution i found:

step 1. - indexing the generated ids of the div/head
<xsl:key name="divs" 
         match="//*[substring-after(name(),'div') &lt; 5]/head"
         use="generate-id()" />

(one problem here: i couldn't use variable here, so
  match="//*[ substring-after(name(),'div') &lt; $oneNumber ]/head"
doesn't work.)

step 2. - get the generated ids instead of fragment trees
          and
          using the general $splitLevel variable instead of listing each div 
levels
          (in one hand it's more slower than i expected but in the other
          hand it uses a very useful parameter...)

<xsl:when 
test="preceding-sibling::*[substring-after(name(),'div')&lt;$splitLevel]/head">
  <xsl:value-of select="generate-id( 
(preceding::*[substring-after(name(),'div')&lt;$splitLevel]/head)[last()] )" />
</xsl:when>

step 3. - 'dereferencing' [it's a kind of Perl-ish expression] the id
 with the 'key' function (eliminating the problems came from fragment
 trees) instead of the very-very slow '//node()[generate-id()=$generatedID]'
 expression

<xsl:apply-templates select="key('divs', $prev)/self::*" />

The life and XSL are great! (and so hard as well)

All the best!

Kiraly Peter
http://www.arcanum.hu
<Prev in Thread] Current Thread [Next in Thread>