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

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:when test="$object/@id">
				<xsl:value-of select="$lang"/>
				<xsl:value-of select="$object/@id"/>
				<!-- <xsl:value-of select="$object/@id"/>-->
			<xsl:when test="$object/@xml:id">
				<xsl:value-of select="$lang"/>
				<xsl:value-of select="$object/@xml:id"/>

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

----- 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
> 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

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