Menu

#991 Processing instructions and comments are ommitted

closed-fixed
nobody
XSL (1066)
5
2008-07-01
2008-06-13
No

When the namespace aware version of Docbook XSL processes a Docbook 4 XML document which is a no namespace document first it adds the Docbook namespace to each element of the XML document before applying the XSL templates on it. This step of adding the Docbook namespace omits the processing instruction nodes and the comment nodes of the XML document so that these nodes are ignored by the XSL templates. These nodes should not be ignored.

For example I have an XML document in which the processing instruction

<?hard-pagebreak?>

is used for inserting a page break in the XSL-FO document generated by Docbook XSL. An example XML document:

<!DOCTYPE article PUBLIC "-//OASIS//DTD DocBook XML V4.4//EN" "http://www.docbook.org/xml/4.4/docbookx.dtd">
<article>
<title>Article Title</title>
<sect1>
<title>Preface</title>
<para>Testing hard page break</para>
</sect1>
<sect1>
<title>Chapter 1</title>
<para>There is some text in the first paragraph.</para>
<?hard-pagebreak?>
<sect2>
<title>Subchapter 1.1</title>
<para>I want this this subchapter on a new page.</para>
</sect2>
</sect1>
</article>

The Docbook customization layer applied to the XML document:

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0" xmlns:fo="http://www.w3.org/1999/XSL/Format">
<xsl:import href="file:///E:/kit/Docbook/docbook-xsl-ns-1.74.0/fo/docbook.xsl"/>

<xsl:template match="processing-instruction('hard-pagebreak')">
<fo:block break-after='page'/>
</xsl:template>
</xsl:stylesheet>

The template of this stylesheet is not fired which is not correct. If I use the no namespace version of Docbook XSL the template is fired which is correct.

Discussion

  • Mauritz Jeanson

    Mauritz Jeanson - 2008-06-15

    Logged In: YES
    user_id=582041
    Originator: NO

    A fix for this issue has been added to the current codebase.
    Please test the fix with the latest snapshot from:

    http://docbook.sourceforge.net/snapshots/

     
  • Mauritz Jeanson

    Mauritz Jeanson - 2008-06-15
    • status: open --> pending-fixed
     
  • Sorin Ristache

    Sorin Ristache - 2008-06-16

    Logged In: YES
    user_id=1849711
    Originator: YES

    I am sorry, the latest snapshot does not fix this issue. I tried with docbook-xsl-ns-snapshot.zip from May 23, 2008. I see that the snapshot build was triggered by a commit with the comment "Enabled use of the keep-together PI on task elements." but my example does not use a keep-together PI.

    Anyway the problem which I reported was more general (all the processing instruction nodes and the comment nodes of a DocBook 4 document which is a no namespace document are skipped by the preprocessing step of the DocBook XSL stylesheets that adds a namespace node with the DocBook 5 namespace to each element node of the initial DocBook 4 document and only after that the regular XSL templates of the DocBook XSL stylesheets are fired for processing of the DocBook document.

     
  • Sorin Ristache

    Sorin Ristache - 2008-06-16
    • status: pending-fixed --> open-fixed
     
  • Mauritz Jeanson

    Mauritz Jeanson - 2008-06-16
    • status: open-fixed --> pending-fixed
     
  • Mauritz Jeanson

    Mauritz Jeanson - 2008-06-16

    Logged In: YES
    user_id=582041
    Originator: NO

    I'm sorry too. There are currently problems with the snapshot build system.

    But I did fix the bug. See http://docbook.svn.sourceforge.net/viewvc/docbook?view=rev&revision=8052

     
  • Sorin Ristache

    Sorin Ristache - 2008-06-16

    Logged In: YES
    user_id=1849711
    Originator: YES

    I don't know, maybe a problem with the build system. I am sure that I tested with docbook-xsl-ns-snapshot.zip built on 23 May 2008 by the DocBook build system. The build from 23 May 2008 seems to be the latest snapshot build.

     
  • Sorin Ristache

    Sorin Ristache - 2008-06-16
    • status: pending-fixed --> open-fixed
     
  • Mauritz Jeanson

    Mauritz Jeanson - 2008-06-16
    • status: open-fixed --> pending-fixed
     
  • Mauritz Jeanson

    Mauritz Jeanson - 2008-06-16

    Logged In: YES
    user_id=582041
    Originator: NO

    Once again:

    1. The bug is fixed. See http://docbook.svn.sourceforge.net/viewvc/docbook?view=rev&revision=8052.

    It should be very easy to apply this patch to your stylesheets.

    2. The snapshot build system is currently broken. I am very sorry about that. We are working on it.

     
  • SourceForge Robot

    Logged In: YES
    user_id=1312539
    Originator: NO

    This Tracker item was closed automatically by the system. It was
    previously set to a Pending status, and the original submitter
    did not respond within 14 days (the time period specified by
    the administrator of this Tracker).

     
  • SourceForge Robot

    • status: pending-fixed --> closed-fixed