[projectaon] <footref> and Re: <bookref>

  • From: Thomas Wolmer <angantyr@xxxxxxxxx>
  • To: projectaon@xxxxxxxxxxxxx
  • Date: Sun, 25 Dec 2005 21:48:05 +0100

2005/12/25, Thomas Wolmer <angantyr@xxxxxxxxx>:
> 2005/12/25, Thomas Wolmer <angantyr@xxxxxxxxx>:
> > [ ] Jon - clarify the intentions with <footref> and <bookref>
> >
> > I also noticed that the <bookref> element is not supported by the XSL
> > either. Am I right in assuming that <bookref book="$book"
> > section="$section">blah blah text</bookref> shall be transformed into
> > <a href="../../$series/$book/$section.htm">blah blah text</a>, where
> > $series is always the same as for the book you are transforming and
> > $section defaults to "title" if it's left out?
>
> No wait, we don't have access to the series identity. Better than
> provising it as a parameter or parsing it out from something else,
> would be to let $book include the series, e.g. "lw/11tpot". At the
> same time that one can pretend that this is a logical name that only
> accidently happens to coincide with an ugly file path, it also gives
> the benefits that:
>
> * One can refer to books in another series.
> * Any future foreign language editions where book #X in series A and B
> both have the same abbreviation won't have to come up with some
> contrived solution for this.
>
> My possibly dodgy XSL code for this:
>
> <xsl:template match="bookref">
>  <a>
>   <xsl:attribute name="href">
>    <xsl:variable name="my-section">
>     <xsl:choose>
>      <xsl:when test="@section">
>       <xsl:value-of select="@section" />
>      </xsl:when>
>      <xsl:otherwise>
>       <xsl:text>title</xsl:text>
>      </xsl:otherwise>
>     </xsl:choose>
>    </xsl:variable>
>    <xsl:text>../../</xsl:text><xsl:value-of select="@book"
> /><xsl:text>/</xsl:text><xsl:value-of select="$my-section"
> /><xsl:text>.htm</xsl:text>
>   </xsl:attribute>
>   <xsl:apply-templates />
>  </a>
> </xsl:template>
>
> The current XSL template for <a href="..."> has handling of the 'id'
> attribute. What is this for? I cannot find any place where it is
> currently used.
>
> I haven't checked it in the above yet, in case I misunderstood the 
> intention...

Since I already am in spamming mode I guess I can as well post a basic
XSL template for <footref> too, trivially translated from the <a
class="footnote"> template:

<xsl:template match="footref">
 <xsl:apply-templates />
 <sup>
  <a>
   <xsl:attribute name="href"><xsl:text>#</xsl:text><xsl:value-of
select="@idref" /></xsl:attribute>
   <xsl:attribute name="name"><xsl:value-of select="@id" /></xsl:attribute>
   <xsl:number count="footref" from="/" level="any" format="1" />
  </a>
 </sup>
</xsl:template>

Now I wonder how hard it would be to include a check that the number
of footnotes and footrefs make sense...

--
Thomas

Other related posts: