forrest-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Piroumian Konstantin <KPiroum...@protek.com>
Subject RE: Sections & anchors
Date Sat, 18 May 2002 15:21:50 GMT
> From: Robert Koberg [mailto:rob@koberg.com] 
> Piroumian Konstantin wrote:
> 
> >This is me again making noise.
> >
> >I see that the latest document2html.xsl generates anchors to sections
> >automatically (somebody told that he don't like automatic 
> documents ;) ). Is
> >there an idea on how to create links to those anchors? If 
> they are generated
> >during the tranformation then it's impossible to have jumps 
> in the document
> >like "See 'section 1' for this". 
> >
> >Any idea?
> >  
> >
> 
> I am not looking at the XSLT, but i assume it is using XPath's 
> generate-id()?? If so, you would use this the same way you 
> would with a 
> hard-coded ID. generate-id() will give you the same value for 
> the same 
> node everytime you pass through the document. For example:
> 
> 
> <article>
>    <section>
>       <title>blah b;ah b;ah</title>
>       <para>blah b;ah b;ah</para>
>    </section>
>    <section>
>       <title>bloh b;oh b;oh</title>
>       <para>bloh b;oh b;oh</para>
>    </section>
> </article>
> 
> then you can do something like:
> 
> <xsl:template match="section" mode="toc">
>    <xsl:variable name="id" select="generate-id()"/>
>    <ul>
>       <a href="#{$id}">
>          <xsl:apply-templates select="title"/>
>       </a>
>    </ul>
> </xsl:template>
> 
> <xsl:template match="section" mode="toc">
>    <xsl:variable name="id" select="generate-id()"/>
>    <span class="section">
>       <a id="{$id}">
>          <xsl:apply-templates select="title"/>
>       </a>
>    </span>
> </xsl:template>

Yes, I know and this is implemented already in document2html.xsl. But you
got me a little wrong. I'd like to have in the content part a link to other
section, say:
 <article>
    <section>
       <title>blah b;ah b;ah</title>
       <para>blah b;ah b;ah. See <jump href="../section[2]"/></para>
    </section>
    <section>
       <title>bloh b;oh b;oh</title>
       <para>bloh b;oh b;oh</para>
    </section>
 </article>

Is it possible without dynamic XPath evaluation (which is supported only in
XSLT 2.0)?

KP

> 
> best,
> -Rob
> 

Mime
View raw message