List Info

Thread: generate.toc and scope parameter




generate.toc and scope parameter
user name
2006-02-20 22:52:32
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
bobssagehill.net


----- Original Message ----- 
From: "David White" <davidwkencook.com>
To: <docbook-appslists.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-unsubscribelists.oasis-open.org
For additional commands, e-mail: docbook-apps-helplists.oasis-open.org

[1]

about | contact  Other archives ( Real Estate discussion Medical topics )