xsl-list
[Top] [All Lists]

RE: navigation, TEI

2004-06-23 08:18:06
This provides a good example of why it's so much nicer and easier, when working with TEI and XSLT, to use unnumbered divs instead of the div0...div9 stuff. Numbered divs can be preprocessed into unnumbered divs easily enough, and all these nasty XPath expressions boil down to preceding-sibling::div etc.

Cheers,
Wendell

At 02:22 AM 6/23/2004, Jarno wrote:
> I'm working on extending the TEI xsl stylesheet set with a more
> complex 'prev-next' navigation bar. For the linking i need two
> parameters: the text of the link, and the id of the link.
> I use a template to get the appropriate node:
>
> <xsl:template name="getPrev">
>   <xsl:variable name="nodeSet">
>     <xsl:text>self::div0 | self::div1 | self::div2 |
> self::div3 | self::div4</xsl:text>
>   </xsl:variable>

Here you're binding $nodeSet to a Result Tree Fragment and?

>   <xssl:choose>
>     <xsl:when test="(preceding-sibling::*[$nodeSet]/head)[last()]">

? here if will always returnn true...
...
How about

  <xsl:template name="getPrevID">
    <xsl:choose>
<!--here you don't need to test for the last, because it will be true even if you have just one div# head --> <xsl:when test="preceding-sibling::*[self::div0 | self::div1 | self::div2 | self::div3 | self::div4]/head"> <xsl:value-of select="generate-id(preceding::*[self::div0 | self::div1 | self::div2 | self::div3 | self::div4]/head[last()])" />
      </xsl:when>
<xsl:when test="ancestor::*[self::div0 | self::div1 | self::div2 | self::div3 | self::div4]/head"> <xsl:value-of select="generate-id(ancestor::*[self::div0 | self::div1 | self::div2 | self::div3 | self::div4]/head[last()])" />
      </xsl:when>
    </xsl:choose>
  </xsl:template>


======================================================================
Wendell Piez                            
mailto:wapiez(_at_)mulberrytech(_dot_)com
Mulberry Technologies, Inc.                http://www.mulberrytech.com
17 West Jefferson Street                    Direct Phone: 301/315-9635
Suite 207                                          Phone: 301/315-9631
Rockville, MD  20850                                 Fax: 301/315-8285
----------------------------------------------------------------------
  Mulberry Technologies: A Consultancy Specializing in SGML and XML
======================================================================



<Prev in Thread] Current Thread [Next in Thread>