This is the mail archive of the
docbook-apps@lists.oasis-open.org
mailing list .
Re: XSL & xref
Here is the test.xml
<?xml version="1.0" ?>
<!DOCTYPE article PUBLIC "-//OASIS//DTD DocBook XML V4.1.2//EN"
"http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd">
<article>
<sect1>
<title>HAHAAH</title>
<qandaset defaultlabel="qanda">
<qandaentry id="e1">
<question id="q1">
<para id="z1">Question 1</para>
</question>
<answer>
<para>Hahaha 1.</para>
<para>Xref to qandaentry <xref linkend="e1"/>.</para>
<para>Xref to question <xref linkend="q1"/>.</para>
<para>Xref to para <xref linkend="z1"/>.</para>
</answer>
</qandaentry>
</qandaset>
</sect1>
</article>
And the command:
xsltproc --catalogs ~/local/docbook-xsl-1.60.1/html/docbook.xsl test.xml
On Tue, Feb 11, 2003 at 10:24:14AM -0800, Bob Stayton wrote:
> On Wed, Feb 05, 2003 at 02:18:42AM +0700, pclouds wrote:
> > To save some typos, i used <xref linkend/> without endterm.
> > The result was <a href="#q1">Q: Q:</a> (which i expect
> > <a href="#q1">Q: Question 1</a>). I can fix it by customizing
> > <xsl:template match="question" mode="object.xref.template">.
> > But i think "Q: Q:" may be a bug, isn't it?
>
> Ugh, that sounds like a bug.
> What settings are you using for the labels?
> Are you setting the 'qanda.defaultlabel' parameter
> on the command line or customization?
> Are you using a 'defaultlabel' attribute on qandaset
> in your document, or a <label> element in the
> question? The default cross reference
> should be "Q: 1.1" if you are using numbering.
>
> Your xref cross references won't contain the question
> text unless you use endterm to point to its para. It is unlikely
> the stylesheets will ever try to print the question text
> automatically, because a question can contain multiple block
> elements.
>
> Bob Stayton 400 Encinal Street
> Publications Architect Santa Cruz, CA 95060
> Technical Publications voice: (831) 427-7796
> The SCO Group fax: (831) 429-1887
> email: bobs@sco.com
>
> >
> > On Wed, Jan 29, 2003 at 12:49:51PM -0800, Bob Stayton wrote:
> > > Actually, that wasn't the problem. I didn't see
> > > that you were using the endterm attribute in
> > > your <xref>.
> > >
> > > When you use endterm, the stylesheet applies its templates
> > > to all the children of the element pointed to, which in
> > > this case includes the <para> element which generates the
> > > <p> tags.
> > >
> > > You can avoid this by putting another id on the para child
> > > and pointing your endterm to that. The children of
> > > para is just the text.
> > >
> > > <qandaset>
> > > <qandaentry>
> > > <question id="q1"><para id="p1">Question 1</para></question>
> > > <answer><para>Here is the
> > > xref <xref linkend="q1" endterm="p1"/><para></answer>
> > > </qandaentry>
> > > </qandaset>
> > >
> > >
> > > Bob Stayton 400 Encinal Street
> > > Publications Architect Santa Cruz, CA 95060
> > > Technical Publications voice: (831) 427-7796
> > > The SCO Group fax: (831) 429-1887
> > > email: bobs@sco.com
> > >
> > >
> > > On Thu, Jan 30, 2003 at 02:07:02AM +0700, pclouds wrote:
> > > > Oh, sorry. I used <qandaset defaultlabel='qanda'> instead of
> > > > <qandaset>
> > > >
> > > > On Wed, Jan 29, 2003 at 09:49:27AM -0800, Bob Stayton wrote:
> > > > > On Wed, Jan 29, 2003 at 01:03:31PM +0700, pclouds wrote:
> > > > > > Hello
> > > > > > I wrote the code like:
> > > > > > <qandaset>
> > > > > > <qandaentry>
> > > > > > <question id="q1"><para>Question 1</para></question>
> > > > > > <answer><para>Here is the
> > > > > > xref <xref linkend="q1" endterm="q1"/><para></answer>
> > > > > > </qandaentry>
> > > > > > </qandaset>
> > > > > >
> > > > > > And <xref> produce: <a href="#q1"><p>Question 1</p></a>
> > > > > > It should be: <a href="#q1">Question 1</a>
> > > > > > Can you show me how to fix this?
> > > > >
> > > > > Are you using a stylesheet customization?
> > > > > The default XSL output for an <xref> to a <question> is
> > > > > <a href="#q1>Q: 1.1</a>. That comes from the gentext
> > > > > template:
> > > > >
> > > > > <l:context name="xref">
> > > > > <l:template name="question" text="Q: %n"/>
> > > > >
> > > > > in common/en.xml (or whatever lang you are using).
> > > > > If you are getting the text of the question, then
> > > > > there is a customization somewhere.
> > > > >
> > > > > --
> > > > >
> > > > > Bob Stayton 400 Encinal Street
> > > > > Publications Architect Santa Cruz, CA 95060
> > > > > Technical Publications voice: (831) 427-7796
> > > > > The SCO Group fax: (831) 429-1887
> > > > > email: bobs@sco.com
> > > >
> > > > --
> > > > Bi Ca; Lao
> > >
> > > --
> > >
> > > Bob Stayton 400 Encinal Street
> > > Publications Architect Santa Cruz, CA 95060
> > > Technical Publications voice: (831) 427-7796
> > > The SCO Group fax: (831) 429-1887
> > > email: bobs@sco.com
> >
> > --
> > Bi Cá?? Lao
>
> --
>
> Bob Stayton 400 Encinal Street
> Publications Architect Santa Cruz, CA 95060
> Technical Publications voice: (831) 427-7796
> The SCO Group fax: (831) 429-1887
> email: bobs@sco.com
--
Bi Cờ Lao