#431 maketoc.xsl produces garbage with element reference

closed-fixed
XSL (1066)
5
2003-07-08
2003-05-26
No

Consider the following file:

-------[ reftest.xml ]-----------
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE book PUBLIC
"-//OASIS//DTD DocBook XML V4.2//EN"

"http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
<book>
<title>Test</title>
<chapter>
<title>Test chapter 001</title>
<section>
<title>Test section 001</title>
<para>test</para>
</section>
<section>
<title>Test section 002</title>
<para>test</para>
</section>
</chapter>
<chapter>
<title>Test chapter 002</title>
<section>
<title>Test section 003</title>
<para>test</para>
</section>
<section>
<title>Test section 004</title>
<para>test</para>
</section>
</chapter>
<reference>
<title>Test reference 001</title>
<refentry>
<refnamediv>
<refname>Test refname 001</refname>
<refpurpose>Test purpose 001</refpurpose>
</refnamediv>
<refsection>
<title>Test refsection 001</title>
<para>test</para>
</refsection>
</refentry>
</reference>
</book>
---------------------------------

Running Saxon

saxon -o /tmp/toc.xml tests/reftest.xml
$DB/xhtml/maketoc.xsl

or xsltproc

xsltproc --output /tmp/toc.xml $DB/xhtml/maketoc.xsl
tests/reftest.xml

it produces the following file toc.xml:

-----------[ toc.xml ]-----------
<?xml version="1.0" encoding="utf-8"?>

<!DOCTYPE toc
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<toc xmlns="http://www.w3.org/1999/xhtml"
role="chunk-toc">
<tocentry linkend=""><?dbhtml filename="index.html"?>
<tocentry linkend=""><?dbhtml filename="ch01.html"?>
<tocentry linkend=""><?dbhtml
filename="ch01s02.html"?>
</tocentry>
</tocentry>
<tocentry linkend=""><?dbhtml filename="ch02.html"?>
<tocentry linkend=""><?dbhtml
filename="ch02s02.html"?>
</tocentry>
</tocentry>
<tocentry linkend=""><?dbhtml filename="rn01.html"?>
<li><a href="rn01re01.html">Test refname 001</a> -
Test purpose 001</li> </tocentry>
</tocentry>
</toc>
---------------------------------

The tocentry with <?dbhtml filename="rn01.html"?>
contains some
(X)HTML elements which should not been there.

Therefore it is not possible to call "chunktoc.xsl" without
editing
this file and deleting the corresponding elements.

As far as I could see this happens only with reference
elements.

-----
Versions:
Saxon 6.5.2
xsltproc 1.0.30
DocBook-XSLT: 1.61.2

Discussion

  • Robert Stayton

    Robert Stayton - 2003-07-08
    • assigned_to: nobody --> bobstayton
    • status: open --> closed-fixed
     
  • Robert Stayton

    Robert Stayton - 2003-07-08

    Logged In: YES
    user_id=193218

    This problem is caused by maketoc.xsl relying on all entries
    using the subtoc template, which is redefined in maketoc.xsl.
    But refentry in autotoc.xsl does not use subtoc. So I added
    <xsl:template match="refentry" mode="toc"> in maketoc.xsl
    to call subtoc. Checked into CVS 7 July 2003.

     

Log in to post a comment.