forrest-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Robert Koberg <...@koberg.com>
Subject Re: Sections & anchors
Date Sat, 18 May 2002 15:18:43 GMT
too quick... the second template should be without the mode...

<xsl:template match="section">
  <xsl:variable name="id" select="generate-id()"/>
  <span class="section">
     <a id="{$id}">
        <xsl:apply-templates select="'µ*ne"/>
     </a>
  </span>
</xsl:template>

Robert Koberg wrote:

>
>
> 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="genÏQ e-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="'µ*ne"/>
>      </a>
>   </span>
> </xsl:template>
>
> best,
> -Rob
>



Mime
View raw message