docbook-apps

  • 1.  Appending image after xref (TOC vs. xref-to-suffix mode)

    Posted 09-12-2013 07:38
    Hi,

    I'm struggeling about the xref-to-suffix mode and how to use it
    correctly.

    Let's assume I would like to append some image for all <xref/>s. One
    solution could be to customize the xref template and insert the image
    there. Depending on what you need and where, this could be more work
    than it need to be, so I would like to avoid this.

    Another solution could be to to write a template for the
    "xref-to-suffix" mode (which does nothing by default):

    <xsl:template match="*" mode="xref-to-suffix">

    </xsl:template>

    This works and would be exactly what I need. However, the image appears
    also in the TOC. How can I avoid this? I would like to have the image
    only inline inside paras.

    Another issue:
    If I understand it correctly, when I'm inside the "xref-to-suffix" mode
    the current node is the "target node" (the element being referenced).
    This confirms the following snippet from the <xref/> template:

    <xsl:when test="$target">
    <xsl:if test="not(parent::citation)">
    <xsl:apply-templates select="$target"
    mode="xref-to-prefix"/>
    </xsl:if>

    <xsl:apply-templates select="$target" mode="xref-to">
    <xsl:with-param name="referrer" select="."/>
    <xsl:with-param name="xrefstyle" select="$xrefstyle"/>
    </xsl:apply-templates>

    <xsl:if test="not(parent::citation)">
    <xsl:apply-templates select="$target"
    mode="xref-to-suffix"/>
    </xsl:if>
    </xsl:when>

    So, if I need the @linkend from the xref for some reason, I have no
    chance to get it, right? It seems, the xref-to-prefix and
    xref-to-suffix modes need a referrer parameter as well as the xref-to
    mode.

    Or do I miss something? Thanks!


    --
    Gruß/Regards,
    Thomas Schraitle



  • 2.  Re: [docbook-apps] Appending image after xref (TOC vs. xref-to-suffix mode)

    Posted 09-12-2013 17:01
    Hi Thomas,
    I think you are understanding it correctly, and this seems to be a
    deficiency. I agree that the "xref-to-suffix" and "xref-to-prefix" modes
    should get the referrer element as a param, as well as xrefstyle like
    "xref-to" does.

    Bob Stayton
    Sagehill Enterprises
    bobs@sagehill.net

    --------------------------------------------------
    From: "Thomas Schraitle" <tom_schr@web.de>
    Sent: Thursday, September 12, 2013 12:37 AM
    To: <docbook-apps@lists.oasis-open.org>
    Subject: [docbook-apps] Appending image after xref (TOC vs. xref-to-suffix
    mode)

    > Hi,
    >
    > I'm struggeling about the xref-to-suffix mode and how to use it
    > correctly.
    >
    > Let's assume I would like to append some image for all <xref/>s. One
    > solution could be to customize the xref template and insert the image
    > there. Depending on what you need and where, this could be more work
    > than it need to be, so I would like to avoid this.
    >
    > Another solution could be to to write a template for the
    > "xref-to-suffix" mode (which does nothing by default):
    >
    > <xsl:template match="*" mode="xref-to-suffix">
    >
    > </xsl:template>
    >
    > This works and would be exactly what I need. However, the image appears
    > also in the TOC. How can I avoid this? I would like to have the image
    > only inline inside paras.
    >
    > Another issue:
    > If I understand it correctly, when I'm inside the "xref-to-suffix" mode
    > the current node is the "target node" (the element being referenced).
    > This confirms the following snippet from the <xref/> template:
    >
    > <xsl:when test="$target">
    > <xsl:if test="not(parent::citation)">
    > <xsl:apply-templates select="$target"
    > mode="xref-to-prefix"/>
    > </xsl:if>
    >
    > <xsl:apply-templates select="$target" mode="xref-to">
    > <xsl:with-param name="referrer" select="."/>
    > <xsl:with-param name="xrefstyle" select="$xrefstyle"/>
    > </xsl:apply-templates>
    >
    > <xsl:if test="not(parent::citation)">
    > <xsl:apply-templates select="$target"
    > mode="xref-to-suffix"/>
    > </xsl:if>
    > </xsl:when>
    >
    > So, if I need the @linkend from the xref for some reason, I have no
    > chance to get it, right? It seems, the xref-to-prefix and
    > xref-to-suffix modes need a referrer parameter as well as the xref-to
    > mode.
    >
    > Or do I miss something? Thanks!
    >
    >
    > --
    > Gruß/Regards,
    > Thomas Schraitle
    >
    > ---------------------------------------------------------------------
    > To unsubscribe, e-mail: docbook-apps-unsubscribe@lists.oasis-open.org
    > For additional commands, e-mail: docbook-apps-help@lists.oasis-open.org
    >
    >
    >



  • 3.  Re: [docbook-apps] Appending image after xref (TOC vs. xref-to-suffix mode)

    Posted 09-13-2013 07:10
    Hi,

    On Thu, 12 Sep 2013 10:00:48 -0700
    "Bob Stayton" <bobs@sagehill.net> wrote:

    > [...]
    > I think you are understanding it correctly, and this seems to be a
    > deficiency. I agree that the "xref-to-suffix" and "xref-to-prefix"
    > modes should get the referrer element as a param, as well as
    > xrefstyle like "xref-to" does.

    Ok, I've submitted the change to r9805. Now, the "xref-to-suffix" and
    "xref-to-prefix" modes have the same signature than "xref-to". I think,
    this should solve the referrer issue. Please check if this is
    correct. :)

    However, the problem with the TOC still persists. Can this be avoided
    somehow?

    Thanks!

    --
    Gruß/Regards,
    Thomas Schraitle



  • 4.  Re: [docbook-apps] Appending image after xref (TOC vs. xref-to-suffix mode)

    Posted 09-13-2013 17:15
    Hi Thomas,
    I'm not able to duplicate the problem of the content of
    mode="xref-to-suffix" appearing in the TOC. I see the suffix appearing only
    in xrefs.

    That mode is not normally used to generate TOC entries. Are you doing
    something special with the TOC?

    Bob Stayton
    Sagehill Enterprises
    bobs@sagehill.net

    --------------------------------------------------
    From: "Thomas Schraitle" <tom_schr@web.de>
    Sent: Friday, September 13, 2013 12:09 AM
    To: "Bob Stayton" <bobs@sagehill.net>
    Cc: <docbook-apps@lists.oasis-open.org>
    Subject: Re: [docbook-apps] Appending image after xref (TOC vs.
    xref-to-suffix mode)

    > Hi,
    >
    > On Thu, 12 Sep 2013 10:00:48 -0700
    > "Bob Stayton" <bobs@sagehill.net> wrote:
    >
    >> [...]
    >> I think you are understanding it correctly, and this seems to be a
    >> deficiency. I agree that the "xref-to-suffix" and "xref-to-prefix"
    >> modes should get the referrer element as a param, as well as
    >> xrefstyle like "xref-to" does.
    >
    > Ok, I've submitted the change to r9805. Now, the "xref-to-suffix" and
    > "xref-to-prefix" modes have the same signature than "xref-to". I think,
    > this should solve the referrer issue. Please check if this is
    > correct. :)
    >
    > However, the problem with the TOC still persists. Can this be avoided
    > somehow?
    >
    > Thanks!
    >
    > --
    > Gruß/Regards,
    > Thomas Schraitle
    >
    > ---------------------------------------------------------------------
    > To unsubscribe, e-mail: docbook-apps-unsubscribe@lists.oasis-open.org
    > For additional commands, e-mail: docbook-apps-help@lists.oasis-open.org
    >
    >
    >



  • 5.  Re: [docbook-apps] Appending image after xref (TOC vs. xref-to-suffix mode)

    Posted 09-14-2013 15:44
    Hi Bob,

    Am Freitag, 13. September 2013, 10:15:06 schrieb Bob Stayton:
    > I'm not able to duplicate the problem of the content of
    > mode="xref-to-suffix" appearing in the TOC. I see the suffix appearing only
    > in xrefs.
    >
    > That mode is not normally used to generate TOC entries. Are you doing
    > something special with the TOC?

    You are right. I had probably some other things in place which influenced the
    output.

    Everything works as expected now. Thanks for your hints!


    --
    Gruß/Regards
    Thomas Schraitle