#1115 orderedlist missing type with epub

output: ePub
open-accepted
XSL (1066)
7
2010-09-16
2010-07-26
No

Given the simple file:

<?xml version="1.0" encoding="utf-8"?>
<book>
<chapter id="chapter1">
<title>Example</title>
<para>
Ordered list should have lower case alphas but it doesn't.

<orderedlist numeration="loweralpha">
<listitem>
<para>One</para>
</listitem>
<listitem>
<para>Two</para>
</listitem>
<listitem>
<para>Three</para>
</listitem>
<listitem>
<para>Four</para>
</listitem>
</orderedlist>

</para>
</chapter>
</book>

And processing with the following:

% xsltproc docbook-xsl-ns-1.75.2/epub/docbook.xsl file.xml

The ordered list is generated as follows:

<ol class="orderedlist"><li class="listitem">
<p>One</p>
</li><li class="listitem">
<p>Two</p>
</li><li class="listitem">
<p>Three</p>
</li><li class="listitem">
<p>Four</p>
</li></ol>

and is missing the "type" attribute to indicate the type of enumeration.

Thanks.

Discussion

  • Keith Fahlgren

    Keith Fahlgren - 2010-07-26

    EPUB requires valid XHTML 1.1, which does not allow the type attribute. How would you like the type of enumeration to be represented in XHTML 1.1 markup instead?

     
  • Keith Fahlgren

    Keith Fahlgren - 2010-07-26
    • labels: 1168228 --> XSL
    • milestone: --> output: ePub
    • status: open --> open-accepted
     
  • Oliver K. Smith

    Oliver K. Smith - 2010-07-27

    Thank you for your prompt response.

    I'm new to XHTML and epub so I had to check a few things.

    As I understand XHTML, the class attribute is intended to assign a class name or set of class names to an element typically for use by CSS formatting. Multiple class names must be separated by white space characters. XHTML class names can be composed of letters, numbers, hypens, underscores or periods and a name should start with a letter or an underscore.

    I suggest the following general approach: Wherever appropriate, simply pass the Docbook attributes to the class list for the XHTML element in the following format:

    attribute_value

    For example, assume the following Docbook code:

    <orderedlist numeration="lowerroman">

    Presently the generated XHTML code looks like this:

    <ol class="orderedlist">

    I suggest the generated XHTML code look like this:

    <ol class="orderedlist numeration_lowerroman">

    This approach is compatible with the current approach because it simply adds additional classes to an element.

    In the CSS associated with the generated XHTML document, there needs to be something like this:

    <style type="text/css">

    ol.numeration_lowerroman { list-style: lower-alpha }

    </style>

    The CSS of course has nothing to do with Docbook per se, I just mention it for informational purposes.

    By the way, using the XHTML DIV and SPAN tags don't permit CSS to assign the needed enumeration type to the OL tag. The class attribute of the OL tag has to be used to assign style.

    Please let me know if I can be of any assistance with this.

    Thanks.

     
  • Oliver K. Smith

    Oliver K. Smith - 2010-09-16

    I think there is a better way to fix this.

    Instead of mapping the Docbook:

    <orderedlist numeration="loweralpha">

    to an XHTML ordered list, it should probably be mapped to an XHTML table.

     
  • Keith Fahlgren

    Keith Fahlgren - 2010-09-16

    Can you clarify what you mean by mapping it to an XHTML table? I thought your suggestion about using XHTML classes was a good one.

     
  • Keith Fahlgren

    Keith Fahlgren - 2010-09-16
    • priority: 5 --> 7
     
  • Oliver K. Smith

    Oliver K. Smith - 2010-09-16

    Here's my new idea. It doesn't require extra CSS to get the results you'd expect.

    Translate the following Docbook XML:

    <orderedlist numeration="loweralpha">
    <listitem>
    <para>One</para>
    </listitem>
    <listitem>
    <para>Two</para>
    </listitem>
    <listitem>
    <para>Three</para>
    </listitem>
    <listitem>
    <para>Four</para>
    </listitem>
    </orderedlist>

    into the following XHTML:

    <table>
    <tr>
    <td align="right" valign="top">a.&nbsp;</td>
    <td align="left" valign="top">One</td>
    </tr>
    <tr>
    <td align="right" valign="top">b.&nbsp;</td>
    <td align="left" valign="top">Two</td>
    </tr>
    <tr>
    <td align="right" valign="top">c.&nbsp;</td>
    <td align="left" valign="top">Three</td>
    </tr>
    <tr>
    <td align="right" valign="top">d.&nbsp;</td>
    <td align="left" valign="top">Four</td>
    </tr>
    </table>

    And yes, you do need the align and valign attributes.

    Not only will this technique work for lowercase, but for all the Docbook numeration, inheritnum, and continuation attributes.

    The downside of this technique--well, it's not obvious to me--is how to support the Docbook spacing attribute. Perhaps this isn't really important.

    Thanks.

     
  • Oliver K. Smith

    Oliver K. Smith - 2010-09-17

    patch file to correct orderedlist numeration/loweralpha bug

     
  • Oliver K. Smith

    Oliver K. Smith - 2010-09-17

    I've attached a patch file that fixes the bug.

    Please consider applying it to a 1.76.0 release.

    The patch file is applied to the following file distributed with the 1.76.0 release:

    % patch docbook-xsl-ns/xhtml-1_1/lists.xsl < lists.patch

    Please let me know of you have any questions, etc.

    Thanks.

     
  • Oliver K. Smith

    Oliver K. Smith - 2010-09-17

    Ooops.

    I should have written:

    "Please consider applying it to a 1.76.1 release."

    Thanks.

     
  • Adam Witwer

    Adam Witwer - 2010-09-17

    This would be a welcome change, assuming we use @class instead of @type as the attribute, to keep the XHTML valid.

     
  • Oliver K. Smith

    Oliver K. Smith - 2010-09-17

    That patch I submitted does not make use of attributes and generates valid XHTML.

    Therefore, there is no need for the user to apply a style to get the expected results. From my perspective, this is the preferred approach.

    The patch is very simple because it uses code that that already exists in the file for a similar purpose.

    Please review the patch and let me know if you have any questions.

    Thanks

     
  • Oliver K. Smith

    Oliver K. Smith - 2010-09-19

    I've attached an updated patch file that fixes the bug.

    Please consider applying it to a 1.76.1 release.

    The patch file is applied to the following file distributed with the
    1.76.0 release:

    % patch docbook-xsl-ns/xhtml-1_1/lists.xsl < lists2.patch

    Just a reminder:

    XHTML does not support ordered lists with lowercase alphas.

    HTML does not support the "start" attribute for orderedlists that is available in Docbook.

    The XSL style sheets support the start attribute for orderedlists by implementing them as tables.

    The modification simply causes the XSL style sheet to now implement orderedlists with lowercase alphas as tables independent of a start attribute.

    Thanks.

     
  • Keith Fahlgren

    Keith Fahlgren - 2010-09-19

    Please attach lists2.patch

     
  • Oliver K. Smith

    Oliver K. Smith - 2010-09-19

    updated patch file to correct orderedlist numeration/loweralpha bug

     
  • Oliver K. Smith

    Oliver K. Smith - 2010-09-19

    Ooops. Sorry about that.

     

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

JavaScript is required for this form.





No, thanks