This is the mail archive of the mailing list for the DocBook project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [docbook] Using xrefs to "embed" cross-reference content

On Thu, Apr 24, 2003 at 03:05:15PM +0200, Florian G. Haas wrote:
> Hello!
> Anyone interested, please share your thoughts on the following issue. Suppose 
> I have an imageobject, a table, or even a paragraph which should appear more 
> than once in a DocBook XML document (for example, in the main body text and 
> again in an appendix). It would be more than ugly to just copy and paste the 
> markup for this purpose, since that would cause redundancy and instead of 
> subsequently being able to change, delete, or add content in one place, it 
> would have to be done in multiple places.
> So I wonder if I could use xrefs to "embed" the content of the linked element, 
> rather than produce a hyperlinked cross reference. Like so:
> <para> 
>   <xref linkend="some-other-element" endterm="some-other-element"/>
> <para>
> Using this structure appears to achieve the desired result using docbook-xsl 
> 1.56.1 for FO output (the full contents of the element with id 
> "some-other-element" are rendered, rather than a mere link). I wonder, 
> though, if this approach is really the most elegant one available. Is this 
> really how one is supposed to use endterm with xref?

Ingenious. 8^)

But this is not the intended use of endterm with xref.
It is meant as a mechanism for generating cross reference
text for a link to the target id.  In HTML output,
your paragraph will be one big hyperlink that links to
an identical paragraph.  If you turn on cross reference
page numbers with the '' parameter,
then your page reference will go to an identical paragraph.

Also, I'm not sure this will be a reliable mechanism
in the stylesheets.  The stylesheet processes just the
*children* of the target element pointed to by endterm.
What happens when your endterm points to a figure?
Does it include the figure title?  Does it number it?
Is the number the same as the original?

As someone else mentioned, putting the content in
a separate file and including it in more than
one place is another solution.  Entities are one option,
as is XInclude.  


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 at sco dot com

To unsubscribe, e-mail: docbook-unsubscribe at lists dot oasis-open dot org
For additional commands, e-mail: docbook-help at lists dot oasis-open dot org

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]