Thanks, I'll fix the example.

Bob Stayton
Sagehill Enterprises
[EMAIL PROTECTED]


  ----- Original Message ----- 
  From: Mimil Mimil 
  To: Bob Stayton 
  Cc: [EMAIL PROTECTED] ; [email protected] 
  Sent: Wednesday, April 02, 2008 5:49 AM
  Subject: Re: [docbook-apps] Duplicate IDs mess up FO TOC


  Hello Bob,

  I think I discovered a little bug in the XML snippet you made. On the test 
dealing with @xml:id you made a concat with @id instead of @xml:id

   <xsl:when test="$object/@xml:id and $preceding.xid != 0">
      <xsl:value-of select="concat($object/@xml:id, $preceding.xid)"/>
    </xsl:when>

  Regards,
  Mimil



  On Wed, Jan 17, 2007 at 7:17 PM, Bob Stayton <[EMAIL PROTECTED]> wrote:

    Here is a solution that will appear in the forthcoming Fourth Edition of my 
book (no release date yet).

    The object.id template is used to generate the output id attribute as well 
as the link for any element.  As long as it produces consistent output for the 
same element, your links should work.

    In this customization, it counts the number of preceding elements with the 
same id.  If the count is greater than zero, then it appends the count to the 
id value.  It works with both @id and @xml:id for db5 documents.

    <xsl:template name="object.id">
     <xsl:param name="object" select="."/>

     <xsl:variable name="id" select="@id"/>
     <xsl:variable name="xid" select="@xml:id"/>

     <xsl:variable name="preceding.id"
          select="count(preceding::[EMAIL PROTECTED] = $id])"/>

     <xsl:variable name="preceding.xid"
          select="count(preceding::[EMAIL PROTECTED]:id = $xid])"/>

     <xsl:choose>
      <xsl:when test="$object/@id and $preceding.id != 0">
        <xsl:value-of select="concat($object/@id, $preceding.id)"/>
      </xsl:when>
      <xsl:when test="$object/@id">
        <xsl:value-of select="$object/@id"/>
      </xsl:when>
      <xsl:when test="$object/@xml:id and $preceding.xid != 0">
        <xsl:value-of select="concat($object/@id, $preceding.xid)"/>
      </xsl:when>
      <xsl:when test="$object/@xml:id">
        <xsl:value-of select="$object/@xml:id"/>
      </xsl:when>
      <xsl:otherwise>
        <xsl:value-of select="generate-id($object)"/>
      </xsl:otherwise>
     </xsl:choose>
    </xsl:template>

    Bob Stayton
    Sagehill Enterprises
    DocBook Consulting
    [EMAIL PROTECTED]


    ----- Original Message ----- From: "Claus Rasmussen" <[EMAIL PROTECTED]>
    To: <[email protected]>
    Sent: Wednesday, January 17, 2007 7:02 AM
    Subject: [docbook-apps] Duplicate IDs mess up FO TOC




      Hi folks,

      I'm reusing quite a few sections using xincludes and my table of contents
      gets confused when generating PDF output: It can not correctly determine 
the
      page number of all sections since multiple sections have the same ID (the
      ones that are reused).

      I'm fully aware that duplicate ID attributes in my aggregated document 
makes
      it invalid, but ignoring that for a while, would any of you know how to
      solve this problem and get a nice printed TOC?

      Of course there's the laborous approach suggested by Bob
      (http://www.sagehill.net/docbookxsl/DuplicateIDs.html) but that's not 
really
      feasible in this case.

      Best,
      Claus

      -- 
      http://techwriter.dk/


      ---------------------------------------------------------------------
      To unsubscribe, e-mail: [EMAIL PROTECTED]
      For additional commands, e-mail: [EMAIL PROTECTED]







    ---------------------------------------------------------------------
    To unsubscribe, e-mail: [EMAIL PROTECTED]
    For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to