OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

docbook-apps message

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]


Subject: RE: [docbook-apps] generate.toc and scope parameter


Thanks for the feedback Bob,

I think, with this particular project we are ok since it contains no <xref>
tags that we would use in other projects.  So this object.id solution seems
to work for linking the TOC to the correct language article inside our book.

However, I will have to study your response further so that when we do in
fact use <xref> we will be prepared for what might occur.

Thanks again,

David White

-----Original Message-----
From: Bob Stayton [mailto:bobs@sagehill.net]
Sent: Tuesday, February 21, 2006 10:52 AM
To: David White; docbook-apps@lists.oasis-open.org
Subject: Re: [docbook-apps] generate.toc and scope parameter

Hi David,
That could work.  You might want to scan through the stylesheet files for
templates that use the @id value directly without going through object.id.
I know there are several in fo/block.xsl, but I'm not sure why those
template don't use object.id.

Do you use xref or link?  If so, I think you will need to look at the
xsl:key named 'id' in fo/docbook.xsl.  It is used in the template for xrefs
to find the element with the id that matches a linkend.  I don't think there
is a way for the xsl:key element to process a template like object.id for
each element to fill in its 'use=' attribute.  You may have to modify the
xref template to skip using that key.

Bob Stayton
Sagehill Enterprises
DocBook Consulting
bobs@sagehill.net


----- Original Message -----
From: "David White" <davidw@kencook.com>
To: "'Bob Stayton'" <bobs@sagehill.net>; <docbook-apps@lists.oasis-open.org>
Sent: Tuesday, February 21, 2006 6:18 AM
Subject: RE: [docbook-apps] generate.toc and scope parameter


> Hi Bob,
>
> The solution we found was to modify the object.id template directly.
Having
> it append language code information to the ID.
>
> <xsl:template name="object.id">
> <xsl:param name="object" select="."/>
> <xsl:variable name="lang">
> <xsl:call-template name="l10n.language"/>
> </xsl:variable>
> <xsl:choose>
> <xsl:when test="$object/@id">
> <xsl:value-of select="$lang"/>
> <xsl:value-of select="$object/@id"/>
> <!-- <xsl:value-of select="$object/@id"/>-->
> </xsl:when>
> <xsl:when test="$object/@xml:id">
> <xsl:value-of select="$lang"/>
> <xsl:value-of select="$object/@xml:id"/>
> <!--<xsl:value-of
> select="$object/@xml:id"/>-->
> </xsl:when>
> <xsl:otherwise>
> <xsl:value-of
> select="generate-id($object)"/>
> </xsl:otherwise>
> </xsl:choose>
> </xsl:template>
>
> David White
>
> -----Original Message-----
> From: Bob Stayton [mailto:bobs@sagehill.net]
> Sent: Monday, February 20, 2006 4:53 PM
> To: David White; docbook-apps@lists.oasis-open.org
> Subject: Re: [docbook-apps] generate.toc and scope parameter
>
> Hi David,
> It is possible to add a scope to a table of contents, but it isn't that
> easy.  But even if you do, you are still faced with the problem of
multiple
> identical IDs in the output.  Using a scope in the stylesheet will
satisfy
> the stylesheet's need to find the right text to put in the reference, but
> when it writes out the link, it is still referring to an ID value that is
> going to appear in multiple places in the FO or HTML output.  If your FO
> processor doesn't complain about that (it should), then the PDF reader
will
> be confused, or probably just link with the first instance.  You don't
have
> that problem with index scope because each indexterm has a uniquely
> generated id.
>
> The stylesheets rely heavily on the content having unique ids.  Trying to
> get the stylesheets to work with duplicate IDs will force you to modify a
> lot of templates. When you think you have it all working, something will
> still bite you.   You will be much better off making the IDs unique
before
> they are processed.  Believe me.
>
> If you can't do it in the source, then consider doing it with a
> preprocessing step that appends the lang value to the id value in the
source
> before it is processed.  If you must do it in one pass, then take a look
at
> fo/profile-docbook.xsl for the general method of doing two-step
processing
> with one stylesheet pass.  You basically preprocess the root element "/"
in
> a certain mode ("profile" mode in that stylesheet), save the result in a
> variable, use EXSLT to convert that variable to a node-set, and then
process
> the node-set with the regular stylesheet.
>
> Bob Stayton
> Sagehill Enterprises
> DocBook Consulting
> bobs@sagehill.net
>
>
> ----- Original Message -----
> From: "David White" <davidw@kencook.com>
> To: <docbook-apps@lists.oasis-open.org>
> Sent: Monday, February 20, 2006 11:53 AM
> Subject: [docbook-apps] generate.toc and scope parameter
>
>
> > Hello everyone!
> >
> > I'm still working on my issues with our multi-lingual book which
contains
> > articles with matching id's.  This causes are TOCs rendered in each
> article
> > to be wrong.  So, I'm looking at how our index's are done since they
are
> > being rendered the way we need our TOCs to work.
> >
> > I have a bit of XSLT code that looks like this;
> >
> > <xsl:choose>
> >
> > <xsl:when test="/book/article[@lang = $lang]">
> >
> > <xsl:call-template name="generate-index">
> >
> > <xsl:with-param name="scope" select="/book/article[@lang = $lang]"/>
> >
> > </xsl:call-template>
> >
> > </xsl:when>
> >
> > <xsl:otherwise>
> >
> > <xsl:call-template name="generate-index">
> >
> > <xsl:with-param name="scope" select="."/>
> >
> > </xsl:call-template>
> >
> > </xsl:otherwise>
> >
> > </xsl:choose>
> >
> >
> >
> > Is it possible to have a generate-toc use a scope as well so that it
> makes a
> > TOC only for an article of a given language?
> >
> >
> >
> > Thanks!
> >
> > David White
> >
> >
>
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: docbook-apps-unsubscribe@lists.oasis-open.org
> For additional commands, e-mail: docbook-apps-help@lists.oasis-open.org
>
>
>



---------------------------------------------------------------------
To unsubscribe, e-mail: docbook-apps-unsubscribe@lists.oasis-open.org
For additional commands, e-mail: docbook-apps-help@lists.oasis-open.org





[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]