[publican-list] Common Content with Sets

Joshua Wulf jwulf at redhat.com
Thu Aug 2 00:35:05 UTC 2012


I see, so the books are in the same set.

Your issue here is that when you xref to the introductory material, there is no way for the processor to know which instance of the introductory material you want to link to. You tell it: "link to this material", but there are two different places in the book where "this material" exists - which one do you want to link to?

There are a couple of strategies to get around this:

1. Include the introductory material only once in the set. 
Does it need to be in the set twice? When the books are built individually it might make sense, but when they are both built together?

2. Wrap the common material.

You make each Intro chapter/section/whatever a link target by giving it a unique ID, then you include your common material *inside that*.

So:

<chapter id="intro-1">
  <title>Introduction</title>
  <xi:include href="intro-section-1"/>
  <xi:include href="intro-section-2"/>
  <xi:include href="intro-section-3"/> 
</chapter>
....
<chapter id="intro-2">
  <title>Introduction</title>
  <xi:include href="intro-section-1"/>
  <xi:include href="intro-section-2"/>
  <xi:include href="intro-section-3"/> 
</chapter>

Then you target "intro-1" and "intro-2" with your xref links.

If you need to link into the sections within the intro, you can use a section with no title and use the <bridgehead> element to give yourself a link target, so:

<chapter id="intro-2">
  <title>Introduction</title>
  <xi:include href="intro-section-1"/>
  <bridgehead id="intro-2-section-2">Intro Section 2 Title</bridgehead>
  <xi:include href="intro-section-2"/>
  <xi:include href="intro-section-3"/> 
</chapter>


But I would examine closely if you in fact need to include the material twice in the same set.

What about this pattern?

Intro

Book A

Book B

Instead?

Then you could have three different assemblies for the set and the two books on their own:

Set:
xi:include Intro content
xi:include Book A content
xi:include Book B content

Book A only:
xi:include Intro content
xi:include Book A content

Book B only:
xi:include Intro content
xi:include Book B content

Hope one of these suggestions helps.

- Josh

----- Original Message -----
> From: "Kendall Moore" <kendall8688 at gmail.com>
> To: "Joshua J Wulf" <jwulf at redhat.com>
> Cc: "Publican discussions" <publican-list at redhat.com>
> Sent: Wednesday, August 1, 2012 10:33:11 PM
> Subject: Re: [publican-list] Common Content with Sets
> 
> Hi Josh,
> 
> Thanks for the response. Let me try to outline what I'm doing a bit
> better here.
> 
> I am attempting to use the common section once in each book. Inside
> of this section, there are sub-sections which have IDs that are
> referenced a few places in each book. Mostly in the sense that I say
> "Please refer to *here* for more detailed information" where here is
> a link to one of the IDs.
> 
> And some code...
> 
> <book id="Book_A">
> ...
> <xi:include href="../common/Introduction.xml" />
> <xi:include href="some_chapter_which_hrefs_intro.xml" />
> ...
> </book>
> 
> <book id="Book_B">
> ...
> <xi:include href="../common/Introduction.xml" />
> <xi:include href="some_chapter_which_hrefs_intro.xml" />
> ...
> </book>
> 
> For this example it may be possible to re-write the Introduction to
> better suit my needs and avoid this, but I will come across the same
> issue with another piece of shared code shortly and figured I may as
> well tackle the issue from the beginning.
> 
> The errors I get when running publican have to do with being unable
> to load Introduction.xml because the IDs are already in use by the
> time the second book attempts to use it.
> 
> Thanks again.
> 
> --
> Kendall
> 
> 
> On Wed, Aug 1, 2012 at 4:39 AM, Joshua J Wulf < jwulf at redhat.com >
> wrote:
> 
> 
> 
> 
> 
> 
> On 08/01/2012 08:37 AM, Kendall Moore wrote:
> 
> 
> Hello Publican users,
> 
> I'm currently stuck trying to do something I would have guessed to be
> a simple task. I have a set of two books, and some of the content
> for them I would like to be shared between the books. I created a
> directory for the common content (at the same level as the
> directories for the two books) and put the XML files which contain
> sections in it. Now, when I try to use an xi:include to grab these
> sections in each of the books, I get an error trying to run publican
> with the '--formats=test' option. The issue seems to be that some of
> the tags inside of these common files have IDs, and each book
> attempts to import the IDs into its own namespace but fails to do so
> because the IDs aren't unique. Specifically, the error(s) look like
> the following:
> 
> ../common/<some_xml_file>:6: validity error : ID <some_id> already
> defined
> 
> If I remove all of the IDs from these common files then there is no
> issue, but unfortunately that is not an option for me. I link to the
> pieces with IDs other places by way of xrefs and need an ID to do so
> (or at least that's my understanding).
> 
> Any help on the subject is greatly appreciated!
> 
> --
> Kendall
> 
> 
> Hi Kendall, yes you need an ID to be the target for an xref.
> 
> You didn't state it, but are you including your common content more
> than once in the same book?
> 
> If you give some more specifics about your use case (maybe even some
> sample code) I can give some suggestions - I've worked around this
> issue several times with different strategies.
> 
> - Josh
> 
> 




More information about the publican-list mailing list