OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

docbook-apps message

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]


Subject: Importing titlepage.xsl breaks section heading level in html


Hi there,
I've notice some odd behavior in the DocBook xsls: If you import your titlepage xsl after importing the main docbook.xsl file, then all the headings for any section level are <h1>. However if you import the titlepage xsl first, then the headings are <h1>, <h2>, etc as you expect. I've put a minimal demo below. I'm mentioning it because the example customization layer here http://www.sagehill.net/docbookxsl/TitlePageGraphics.html has the titlepage imported after the docbook.xsl file and I've never seen instructions that you should import your titlepage before docbook.xsl. Is this by design or a bug?

Given the following test document:

<book>
  <title>Foo</title>
  <chapter>
	<title>Chap</title>	
	<section>
	  <title>sect1</title>
	  <section>
	    <title>sect2</title>
		<section>
		  <title>sect3</title>
		  <section>
			<title>sect4</title>
			<para>Foo</para>
		  </section>
		</section>
	  </section>
	</section>
  </chapter>
</book>

With the following customization layer:

<xsl:stylesheet
  xmlns="http://www.w3.org/1999/xhtml"; 
  xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
  version="1.0">

  <xsl:import href="http://docbook.sourceforge.net/release/xsl/current/xhtml/docbook.xsl"/>
  <xsl:import href="http://docbook.sourceforge.net/release/xsl/current/xhtml/titlepage.xsl"/>

  <!-- indent="yes" is just for the readability of the output and has no effect on test. -->
  <xsl:output indent="yes"/>

</xsl:stylesheet>

I get the the following output (notice that all the section headings are <h1> (e.g. <h1 class="title"><a id="d0e16"/>sect4</h1>):

<?xml version="1.0" encoding="UTF-8"?>

<!DOCTYPE html
  PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";>
<html xmlns="http://www.w3.org/1999/xhtml";>
   <head>
      <title>Foo</title>
      <meta name="generator" content="DocBook XSL Stylesheets V1.75.2"/>
   </head>
   <body>
      <div class="book" title="Foo">
         <div class="titlepage">
            <div>
               <div>
                  <h1 class="title">
                     <a id="d0e1"/>Foo</h1>
               </div>
            </div>
            <hr/>
         </div>
         <div class="toc">
            <p>
               <b>Table of Contents</b>
            </p>
            <dl>
               <dt>
                  <span class="chapter">
                     <a href="#d0e4">1. Chap</a>
                  </span>
               </dt>
               <dd>
                  <dl>
                     <dt>
                        <span class="section">
                           <a href="#d0e7">sect1</a>
                        </span>
                     </dt>
                     <dd>
                        <dl>
                           <dt>
                              <span class="section">
                                 <a href="#d0e10">sect2</a>
                              </span>
                           </dt>
                        </dl>
                     </dd>
                  </dl>
               </dd>
            </dl>
         </div>
         <div class="chapter" title="Chapter 1. Chap">
            <div class="titlepage">
               <div>
                  <div>
                     <h1 class="title">
                        <a id="d0e4"/>Chap</h1>
                  </div>
               </div>
            </div>
            <div class="toc">
               <p>
                  <b>Table of Contents</b>
               </p>
               <dl>
                  <dt>
                     <span class="section">
                        <a href="#d0e7">sect1</a>
                     </span>
                  </dt>
                  <dd>
                     <dl>
                        <dt>
                           <span class="section">
                              <a href="#d0e10">sect2</a>
                           </span>
                        </dt>
                     </dl>
                  </dd>
               </dl>
            </div>
            <div class="section" title="sect1">
               <div class="titlepage">
                  <div>
                     <div>
                        <h1 class="title">
                           <a id="d0e7"/>sect1</h1>
                     </div>
                  </div>
               </div>
               <div class="section" title="sect2">
                  <div class="titlepage">
                     <div>
                        <div>
                           <h1 class="title">
                              <a id="d0e10"/>sect2</h1>
                        </div>
                     </div>
                  </div>
                  <div class="section" title="sect3">
                     <div class="titlepage">
                        <div>
                           <div>
                              <h1 class="title">
                                 <a id="d0e13"/>sect3</h1>
                           </div>
                        </div>
                     </div>
                     <div class="section" title="sect4">
                        <div class="titlepage">
                           <div>
                              <div>
                                 <h1 class="title">
                                    <a id="d0e16"/>sect4</h1>
                              </div>
                           </div>
                        </div>
                        <p>Foo</p>
                     </div>
                  </div>
               </div>
            </div>
         </div>
      </div>
   </body>
</html>

However if I reverse the order of the imports like so:

<xsl:stylesheet
  xmlns="http://www.w3.org/1999/xhtml"; 
  xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
  version="1.0">

  <xsl:import href="http://docbook.sourceforge.net/release/xsl/current/xhtml/titlepage.xsl"/>
  <xsl:import href="http://docbook.sourceforge.net/release/xsl/current/xhtml/docbook.xsl"/>

  <!-- indent="yes" is just for the readability of the output and has no effect on test. -->
  <xsl:output indent="yes"/>

</xsl:stylesheet>

I get the expected output (notice <h5 class="title"><a xmlns:saxon="http://icl.com/saxon"; id="d0e16"/>sect4</h5>):

<?xml version="1.0" encoding="UTF-8"?>

<!DOCTYPE html
  PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";>
<html xmlns="http://www.w3.org/1999/xhtml";>
   <head>
      <title>Foo</title>
      <meta name="generator" content="DocBook XSL Stylesheets V1.75.2"/>
   </head>
   <body>
      <div class="book" title="Foo">
         <div class="titlepage">
            <div>
               <div>
                  <h1 class="title">
                     <a id="d0e1"/>Foo</h1>
               </div>
            </div>
            <hr/>
         </div>
         <div class="toc">
            <p>
               <b>Table of Contents</b>
            </p>
            <dl>
               <dt>
                  <span class="chapter">
                     <a href="#d0e4">1. Chap</a>
                  </span>
               </dt>
               <dd>
                  <dl>
                     <dt>
                        <span class="section">
                           <a href="#d0e7">sect1</a>
                        </span>
                     </dt>
                     <dd>
                        <dl>
                           <dt>
                              <span class="section">
                                 <a href="#d0e10">sect2</a>
                              </span>
                           </dt>
                        </dl>
                     </dd>
                  </dl>
               </dd>
            </dl>
         </div>
         <div class="chapter" title="Chapter 1. Chap">
            <div class="titlepage">
               <div>
                  <div>
                     <h2 class="title">
                        <a xmlns:saxon="http://icl.com/saxon"; id="d0e4"/>Chapter 1. Chap</h2>
                  </div>
               </div>
            </div>
            <div class="toc">
               <p>
                  <b>Table of Contents</b>
               </p>
               <dl>
                  <dt>
                     <span class="section">
                        <a href="#d0e7">sect1</a>
                     </span>
                  </dt>
                  <dd>
                     <dl>
                        <dt>
                           <span class="section">
                              <a href="#d0e10">sect2</a>
                           </span>
                        </dt>
                     </dl>
                  </dd>
               </dl>
            </div>
            <div class="section" title="sect1">
               <div class="titlepage">
                  <div>
                     <div>
                        <h2 class="title" style="clear: both">
                           <a xmlns:saxon="http://icl.com/saxon"; id="d0e7"/>sect1</h2>
                     </div>
                  </div>
               </div>
               <div class="section" title="sect2">
                  <div class="titlepage">
                     <div>
                        <div>
                           <h3 class="title">
                              <a xmlns:saxon="http://icl.com/saxon"; id="d0e10"/>sect2</h3>
                        </div>
                     </div>
                  </div>
                  <div class="section" title="sect3">
                     <div class="titlepage">
                        <div>
                           <div>
                              <h4 class="title">
                                 <a xmlns:saxon="http://icl.com/saxon"; id="d0e13"/>sect3</h4>
                           </div>
                        </div>
                     </div>
                     <div class="section" title="sect4">
                        <div class="titlepage">
                           <div>
                              <div>
                                 <h5 class="title">
                                    <a xmlns:saxon="http://icl.com/saxon"; id="d0e16"/>sect4</h5>
                              </div>
                           </div>
                        </div>
                        <p>Foo</p>
                     </div>
                  </div>
               </div>
            </div>
         </div>
      </div>
   </body>
</html>

Thanks,
David


[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]