docbook-apps

  • 1.  Adding registered trademark to title on book title page

    Posted 10-09-2008 17:53
    Hello,

    I'd like to add a registered trademark symbol to a title on the recto
    side of a book title page. I don't think changing the contents of the
    title tag makes sense since I'll want to use that elsewhere without
    the mark. In addition, I'll probably want to control how the mark
    prints (maybe a smaller font, etc.) separately from the title.

    Any advice on how best accomplish this?

    Thanks,
    Ken



  • 2.  Processing Xincludes using document() and xml:id (docbook 5)

    Posted 10-09-2008 20:56
    Hi all,

    My employer is rolling out an XML CMS that has issues resolving xincludes. The workaround that I need to perform is writing a short XSL to preprocess my files and resolve Xincludes manually.

    My script worked fine on a couple of test docbook 4 test files that used the id attribute to identify nodes, but as soon as I switched to my docbook 5 files and changed the referenced attribute to xml:id, I began getting the following: error message:

    "The URI http://www.w3.org/XML/1998/namespace does not identify an external Java class"

    Now, the namespace quoted, is of course, the default XML namespace. During the process of flailing about, I did try explicitly binding xml to its namespace (xmlns:xml='http://www.w3.org/XML/1998/namespace') but had no effect.

    The script as it stands looks like this:


    <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    xmlns:exsl="http://exslt.org/common" xmlns:fo="http://www.w3.org/1999/XSL/Format"
    xmlns:ng="http://docbook.org/docbook-ng" xmlns:db="http://docbook.org/ns/docbook"
    xmlns:xi="http://www.w3.org/2001/XInclude" exclude-result-prefixes="db ng exsl" version="1.0">

    <xsl:template match="/">
    <xsl:apply-templates/>
    </xsl:template>

    <xsl:template match="@*|node()">
    <xsl:copy>
    <xsl:apply-templates select="@*|node()"/>
    </xsl:copy>
    </xsl:template>

    <xsl:template match="xi:include">

    <xsl:variable name="id_value1">
    <xsl:value-of select="substring-before(@xpointer, ')')"/>
    </xsl:variable>
    <xsl:variable name="id_value2">
    <xsl:value-of select="substring-after($id_value1, '(')"/>
    </xsl:variable>
    <xsl:for-each select="document(@href,/)">
    <xsl:copy-of select="xml:id($id_value2)"/>
    </xsl:for-each>
    </xsl:template>
    </xsl:stylesheet>

    Thanks in advance for any help.
    Jeff.



  • 3.  FIXED: [docbook-apps] Processing Xincludes using document() and xml:id (docbook 5)

    Posted 10-09-2008 21:55
    Hi all,

    Fixed the problem by changing the:

    <xsl:copy-of select="xml:id($id_value2)"/>

    to:

    <xsl:copy-of select="//*[@xml:id=$id_value2]"/>

    Still, if anyone could explain to me why:

    <xsl:copy-of select="id($id_value2)"/>

    worked fine but:

    <xsl:copy-of select="xml:id($id_value2)"/>

    failed, I'd be most interested.

    Cheers,
    Jeff.

    -----Original Message-----
    From: Jeff Hooker [mailto:Jeff_Hooker@pmc-sierra.com]
    Sent: Thursday, October 09, 2008 1:56 PM
    To: docbook-apps@lists.oasis-open.org
    Subject: [docbook-apps] Processing Xincludes using document() and xml:id
    (docbook 5)


    Hi all,

    My employer is rolling out an XML CMS that has issues resolving xincludes. The workaround that I need to perform is writing a short XSL to preprocess my files and resolve Xincludes manually.

    My script worked fine on a couple of test docbook 4 test files that used the id attribute to identify nodes, but as soon as I switched to my docbook 5 files and changed the referenced attribute to xml:id, I began getting the following: error message:

    "The URI http://www.w3.org/XML/1998/namespace does not identify an external Java class"

    Now, the namespace quoted, is of course, the default XML namespace. During the process of flailing about, I did try explicitly binding xml to its namespace (xmlns:xml='http://www.w3.org/XML/1998/namespace') but had no effect.

    The script as it stands looks like this:


    <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    xmlns:exsl="http://exslt.org/common" xmlns:fo="http://www.w3.org/1999/XSL/Format"
    xmlns:ng="http://docbook.org/docbook-ng" xmlns:db="http://docbook.org/ns/docbook"
    xmlns:xi="http://www.w3.org/2001/XInclude" exclude-result-prefixes="db ng exsl" version="1.0">

    <xsl:template match="/">
    <xsl:apply-templates/>
    </xsl:template>

    <xsl:template match="@*|node()">
    <xsl:copy>
    <xsl:apply-templates select="@*|node()"/>
    </xsl:copy>
    </xsl:template>

    <xsl:template match="xi:include">

    <xsl:variable name="id_value1">
    <xsl:value-of select="substring-before(@xpointer, ')')"/>
    </xsl:variable>
    <xsl:variable name="id_value2">
    <xsl:value-of select="substring-after($id_value1, '(')"/>
    </xsl:variable>
    <xsl:for-each select="document(@href,/)">
    <xsl:copy-of select="xml:id($id_value2)"/>
    </xsl:for-each>
    </xsl:template>
    </xsl:stylesheet>

    Thanks in advance for any help.
    Jeff.



  • 4.  RE: [docbook-apps] Adding registered trademark to title on book title page

    Posted 10-23-2008 14:36
    > -----Original Message-----
    > From: Ken Morse
    >
    > I'd like to add a registered trademark symbol to a title on the recto
    > side of a book title page. I don't think changing the contents of the
    > title tag makes sense since I'll want to use that elsewhere without
    > the mark. In addition, I'll probably want to control how the mark
    > prints (maybe a smaller font, etc.) separately from the title.
    >
    > Any advice on how best accomplish this?


    The block containing the book title on a recto titlepage is output by the
    division.title template in division.xsl (it is also used for formatting
    titles for set, part, and reference).

    Customize this template by adding the following immediately after
    <xsl:copy-of select="$title"/>:

    <xsl:if test="parent::*[local-name() = 'book'] or
    ancestor::*[2][local-name() = 'book']">
    <fo:inline color="red">™</fo:inline>
    </xsl:if>

    This appends the trademark symbol (here coloured red) to book titles.

    Mauritz