docbook-apps

  • 1.  Customizing the topic element

    Posted 08-30-2012 13:29
    Hi,

    I am still trying to make it possible to xinclude a group of elements to
    multiple places in a document, and be able to validate every file. The
    simplified use-case is the following:

    file1.xml:
    ...
    <procedure>

    <step>Step 1
    <step>Step 2
    <step>
    <xinclude href="file2.xml">
    </procedure>
    <procedure>

    <step>Step 1
    <step>Step 2
    <step>
    <xinclude href="file3.xml">
    </procedure>
    ...
    file2.xml (includes steps common for both procedures):
    <topic>
    <step>Common step 1
    <step>Common step 2
    <step>
    </topic>


    My problem is that when including file2, I get error messages:
    "Element step in namespace 'http://docbook.org/ns/docbook' encountered in topic,
    but no template matches."

    That's not surprising, so I added a custom template that (I hope) calls the
    proper template for every element found in topic/step:
    <xsl:template match="d:topic/d:step">
    <xsl:for-each select="./*">
    <xsl:apply-templates select="."/>
    </xsl:for-each>
    </xsl:template>

    However, in the output the steps from the topic are located at the top of the
    procedure (and are not numbered), so it looks like:
    Common step 1
    Common step 2
    1. Step 1
    2. Step 2

    (Instead of
    1. Step 1
    2. Step 2
    Common step 1
    Common step 2
    (Similar thing happens when xincluding a topic containing listitems into an
    itemizedlist.)
    )

    How can I tell the stylesheets to treat the child nodes of a topic as if the
    topic node weren't there?

    Kind Regards,

    Robert




  • 2.  Re: [docbook-apps] Customizing the topic element

    Posted 08-31-2012 10:39
    Nevermind, seems that another customization had a bug, that broke this one as
    well. Now it is working as expected.

    Robert

    On 08/30/2012 03:28 PM, Robert Fekete wrote:

    > Hi,
    >
    > I am still trying to make it possible to xinclude a group of elements to
    > multiple places in a document, and be able to validate every file. The
    > simplified use-case is the following:
    >
    > file1.xml:
    > ...
    > <procedure>
    >
    > <step>Step 1
    > <step>Step 2
    > <step>
    > <xinclude href="file2.xml">
    > </procedure>
    > <procedure>
    >
    > <step>Step 1
    > <step>Step 2
    > <step>
    > <xinclude href="file3.xml">
    > </procedure>
    > ...
    > file2.xml (includes steps common for both procedures):
    > <topic>
    > <step>Common step 1
    > <step>Common step 2
    > <step>
    > </topic>
    >
    >
    > My problem is that when including file2, I get error messages:
    > "Element step in namespace 'http://docbook.org/ns/docbook' encountered in topic,
    > but no template matches."
    >
    > That's not surprising, so I added a custom template that (I hope) calls the
    > proper template for every element found in topic/step:
    > <xsl:template match="d:topic/d:step">
    > <xsl:for-each select="./*">
    > <xsl:apply-templates select="."/>
    > </xsl:for-each>
    > </xsl:template>
    >
    > However, in the output the steps from the topic are located at the top of the
    > procedure (and are not numbered), so it looks like:
    > Common step 1
    > Common step 2
    > 1. Step 1
    > 2. Step 2
    >
    > (Instead of
    > 1. Step 1
    > 2. Step 2
    > Common step 1
    > Common step 2
    > (Similar thing happens when xincluding a topic containing listitems into an
    > itemizedlist.)
    > )
    >
    > How can I tell the stylesheets to treat the child nodes of a topic as if the
    > topic node weren't there?
    >
    > Kind Regards,
    >
    > Robert
    >
    >
    > ---------------------------------------------------------------------
    > 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] Customizing the topic element

    Posted 08-31-2012 10:42
    Ehh, I was writing too fast. The problem described in my initial email is still
    not solved, any help is appreciated.

    On 08/31/2012 12:38 PM, Robert Fekete wrote:

    > Nevermind, seems that another customization had a bug, that broke this one as
    > well. Now it is working as expected.
    >
    > Robert
    >
    > On 08/30/2012 03:28 PM, Robert Fekete wrote:
    >
    >> Hi,
    >>
    >> I am still trying to make it possible to xinclude a group of elements to
    >> multiple places in a document, and be able to validate every file. The
    >> simplified use-case is the following:
    >>
    >> file1.xml:
    >> ...
    >> <procedure>
    >>
    >> <step>Step 1
    >> <step>Step 2
    >> <step>
    >> <xinclude href="file2.xml">
    >> </procedure>
    >> <procedure>
    >>
    >> <step>Step 1
    >> <step>Step 2
    >> <step>
    >> <xinclude href="file3.xml">
    >> </procedure>
    >> ...
    >> file2.xml (includes steps common for both procedures):
    >> <topic>
    >> <step>Common step 1
    >> <step>Common step 2
    >> <step>
    >> </topic>
    >>
    >>
    >> My problem is that when including file2, I get error messages:
    >> "Element step in namespace 'http://docbook.org/ns/docbook' encountered in topic,
    >> but no template matches."
    >>
    >> That's not surprising, so I added a custom template that (I hope) calls the
    >> proper template for every element found in topic/step:
    >> <xsl:template match="d:topic/d:step">
    >> <xsl:for-each select="./*">
    >> <xsl:apply-templates select="."/>
    >> </xsl:for-each>
    >> </xsl:template>
    >>
    >> However, in the output the steps from the topic are located at the top of the
    >> procedure (and are not numbered), so it looks like:
    >> Common step 1
    >> Common step 2
    >> 1. Step 1
    >> 2. Step 2
    >>
    >> (Instead of
    >> 1. Step 1
    >> 2. Step 2
    >> 3. Common step 1
    >> 4. Common step 2
    >> (Similar thing happens when xincluding a topic containing listitems into an
    >> itemizedlist.)
    >> )
    >>
    >> How can I tell the stylesheets to treat the child nodes of a topic as if the
    >> topic node weren't there?
    >>
    >> Kind Regards,
    >>
    >> Robert
    >>
    >>
    >> ---------------------------------------------------------------------
    >> To unsubscribe, e-mail: docbook-apps-unsubscribe@lists.oasis-open.org
    >> For additional commands, e-mail: docbook-apps-help@lists.oasis-open.org
    >>
    >>
    >
    >
    >
    > ---------------------------------------------------------------------
    > To unsubscribe, e-mail: docbook-apps-unsubscribe@lists.oasis-open.org
    > For additional commands, e-mail: docbook-apps-help@lists.oasis-open.org
    >
    >





  • 4.  Re: [docbook-apps] Customizing the topic element

    Posted 09-07-2012 11:12
    Ok, just FYI so others will know that there is a solution to the problem:
    The output is messed up because after resolving the xincludes, the <topic> tag
    is around the xincluded steps. I wasn't able to make it go away from XSL, so
    after resolving the xincludes but before creating the output format I run a
    shell script on the XML file that removes the lines that begin with <topic or
    </topic . Not elegant, but gets the job done.

    Robert

    On 08/31/2012 12:41 PM, Robert Fekete wrote:

    > Ehh, I was writing too fast. The problem described in my initial email is still
    > not solved, any help is appreciated.
    >
    > On 08/31/2012 12:38 PM, Robert Fekete wrote:
    >
    >> Nevermind, seems that another customization had a bug, that broke this one as
    >> well. Now it is working as expected.
    >>
    >> Robert
    >>
    >> On 08/30/2012 03:28 PM, Robert Fekete wrote:
    >>
    >>> Hi,
    >>>
    >>> I am still trying to make it possible to xinclude a group of elements to
    >>> multiple places in a document, and be able to validate every file. The
    >>> simplified use-case is the following:
    >>>
    >>> file1.xml:
    >>> ...
    >>> <procedure>
    >>>
    >>> <step>Step 1
    >>> <step>Step 2
    >>> <step>
    >>> <xinclude href="file2.xml">
    >>> </procedure>
    >>> <procedure>
    >>>
    >>> <step>Step 1
    >>> <step>Step 2
    >>> <step>
    >>> <xinclude href="file3.xml">
    >>> </procedure>
    >>> ...
    >>> file2.xml (includes steps common for both procedures):
    >>> <topic>
    >>> <step>Common step 1
    >>> <step>Common step 2
    >>> <step>
    >>> </topic>
    >>>
    >>>
    >>> My problem is that when including file2, I get error messages:
    >>> "Element step in namespace 'http://docbook.org/ns/docbook' encountered in topic,
    >>> but no template matches."
    >>>
    >>> That's not surprising, so I added a custom template that (I hope) calls the
    >>> proper template for every element found in topic/step:
    >>> <xsl:template match="d:topic/d:step">
    >>> <xsl:for-each select="./*">
    >>> <xsl:apply-templates select="."/>
    >>> </xsl:for-each>
    >>> </xsl:template>
    >>>
    >>> However, in the output the steps from the topic are located at the top of the
    >>> procedure (and are not numbered), so it looks like:
    >>> Common step 1
    >>> Common step 2
    >>> 1. Step 1
    >>> 2. Step 2
    >>>
    >>> (Instead of
    >>> 1. Step 1
    >>> 2. Step 2
    >>> 3. Common step 1
    >>> 4. Common step 2
    >>> (Similar thing happens when xincluding a topic containing listitems into an
    >>> itemizedlist.)
    >>> )
    >>>
    >>> How can I tell the stylesheets to treat the child nodes of a topic as if the
    >>> topic node weren't there?
    >>>
    >>> Kind Regards,
    >>>
    >>> Robert
    >>>
    >>>
    >>> ---------------------------------------------------------------------
    >>> To unsubscribe, e-mail: docbook-apps-unsubscribe@lists.oasis-open.org
    >>> For additional commands, e-mail: docbook-apps-help@lists.oasis-open.org
    >>>
    >>>
    >>
    >>
    >>
    >> ---------------------------------------------------------------------
    >> To unsubscribe, e-mail: docbook-apps-unsubscribe@lists.oasis-open.org
    >> For additional commands, e-mail: docbook-apps-help@lists.oasis-open.org
    >>
    >>
    >
    >
    >
    > ---------------------------------------------------------------------
    > 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] Customizing the topic element

    Posted 09-25-2012 17:09
    Hi,
    You would need to modify the template for procedure to get the steps back in
    the correct order. In the template with match="procedure" in fo/lists.xsl,
    the $preamble variable is set to gather up everything in the procedure that
    is not a title or a step, in accordance with the content model for
    procedure. It also creates a $steps variable containing the step elements.
    If you adjust the definitions of those two variables to account for topic
    child of procedure, you should be able to retain the order of the imported
    steps.

    Bob Stayton
    Sagehill Enterprises
    bobs@sagehill.net

    --------------------------------------------------
    From: "Robert Fekete" <frobert@balabit.com>
    Sent: Thursday, August 30, 2012 6:28 AM
    To: "DocBook Apps" <docbook-apps@lists.oasis-open.org>
    Subject: [docbook-apps] Customizing the topic element

    > Hi,
    >
    > I am still trying to make it possible to xinclude a group of elements to
    > multiple places in a document, and be able to validate every file. The
    > simplified use-case is the following:
    >
    > file1.xml:
    > ...
    > <procedure>
    >
    > <step>Step 1
    > <step>Step 2
    > <step>
    > <xinclude href="file2.xml">
    > </procedure>
    > <procedure>
    >
    > <step>Step 1
    > <step>Step 2
    > <step>
    > <xinclude href="file3.xml">
    > </procedure>
    > ...
    > file2.xml (includes steps common for both procedures):
    > <topic>
    > <step>Common step 1
    > <step>Common step 2
    > <step>
    > </topic>
    >
    >
    > My problem is that when including file2, I get error messages:
    > "Element step in namespace 'http://docbook.org/ns/docbook' encountered in
    > topic, but no template matches."
    >
    > That's not surprising, so I added a custom template that (I hope) calls
    > the proper template for every element found in topic/step:
    > <xsl:template match="d:topic/d:step">
    > <xsl:for-each select="./*">
    > <xsl:apply-templates select="."/>
    > </xsl:for-each>
    > </xsl:template>
    >
    > However, in the output the steps from the topic are located at the top of
    > the procedure (and are not numbered), so it looks like:
    > Common step 1
    > Common step 2
    > 1. Step 1
    > 2. Step 2
    >
    > (Instead of
    > 1. Step 1
    > 2. Step 2
    > Common step 1
    > Common step 2
    > (Similar thing happens when xincluding a topic containing listitems into
    > an itemizedlist.)
    > )
    >
    > How can I tell the stylesheets to treat the child nodes of a topic as if
    > the topic node weren't there?
    >
    > Kind Regards,
    >
    > Robert
    >
    >
    > ---------------------------------------------------------------------
    > To unsubscribe, e-mail: docbook-apps-unsubscribe@lists.oasis-open.org
    > For additional commands, e-mail: docbook-apps-help@lists.oasis-open.org
    >
    >



  • 6.  Re: [docbook-apps] Customizing the topic element

    Posted 09-26-2012 07:42
    Hi Bob,

    thank you very much for your help.
    I'll try it.

    Regards,

    Robert

    On 09/25/2012 07:09 PM, Bob Stayton wrote:

    > Hi,
    > You would need to modify the template for procedure to get the steps back in the
    > correct order. In the template with match="procedure" in fo/lists.xsl, the
    > $preamble variable is set to gather up everything in the procedure that is not a
    > title or a step, in accordance with the content model for procedure. It also
    > creates a $steps variable containing the step elements. If you adjust the
    > definitions of those two variables to account for topic child of procedure, you
    > should be able to retain the order of the imported steps.
    >
    > Bob Stayton
    > Sagehill Enterprises
    > bobs@sagehill.net
    >
    > --------------------------------------------------
    > From: "Robert Fekete" <frobert@balabit.com>
    > Sent: Thursday, August 30, 2012 6:28 AM
    > To: "DocBook Apps" <docbook-apps@lists.oasis-open.org>
    > Subject: [docbook-apps] Customizing the topic element
    >
    >> Hi,
    >>
    >> I am still trying to make it possible to xinclude a group of elements to
    >> multiple places in a document, and be able to validate every file. The
    >> simplified use-case is the following:
    >>
    >> file1.xml:
    >> ...
    >> <procedure>
    >>
    >> <step>Step 1
    >> <step>Step 2
    >> <step>
    >> <xinclude href="file2.xml">
    >> </procedure>
    >> <procedure>
    >>
    >> <step>Step 1
    >> <step>Step 2
    >> <step>
    >> <xinclude href="file3.xml">
    >> </procedure>
    >> ...
    >> file2.xml (includes steps common for both procedures):
    >> <topic>
    >> <step>Common step 1
    >> <step>Common step 2
    >> <step>
    >> </topic>
    >>
    >>
    >> My problem is that when including file2, I get error messages:
    >> "Element step in namespace 'http://docbook.org/ns/docbook' encountered in
    >> topic, but no template matches."
    >>
    >> That's not surprising, so I added a custom template that (I hope) calls the
    >> proper template for every element found in topic/step:
    >> <xsl:template match="d:topic/d:step">
    >> <xsl:for-each select="./*">
    >> <xsl:apply-templates select="."/>
    >> </xsl:for-each>
    >> </xsl:template>
    >>
    >> However, in the output the steps from the topic are located at the top of the
    >> procedure (and are not numbered), so it looks like:
    >> Common step 1
    >> Common step 2
    >> 1. Step 1
    >> 2. Step 2
    >>
    >> (Instead of
    >> 1. Step 1
    >> 2. Step 2
    >> Common step 1
    >> Common step 2
    >> (Similar thing happens when xincluding a topic containing listitems into an
    >> itemizedlist.)
    >> )
    >>
    >> How can I tell the stylesheets to treat the child nodes of a topic as if the
    >> topic node weren't there?
    >>
    >> Kind Regards,
    >>
    >> Robert
    >>
    >>
    >> ---------------------------------------------------------------------
    >> To unsubscribe, e-mail: docbook-apps-unsubscribe@lists.oasis-open.org
    >> For additional commands, e-mail: docbook-apps-help@lists.oasis-open.org
    >>
    >>
    >