#629 all: indexentry children xsl processing problems

output: all formats
closed-fixed
XSL (1066)
5
2009-03-27
2005-03-23
No

An indexentry with multiple sublevel *ie's can be for
example like the following:

<indexentry>
<primaryie>oscillator, linear, 1, 2</primaryie>
<seealsoie>oscillator, nonlinear</seealsoie>
<secondaryie>braked, 1</secondaryie>
<secondaryie>harmonic, 1</secondaryie>
<tertiaryie>forced, 1</tertiaryie>
<tertiaryie>unvarying braking, 1</tertiaryie>
<seealsoie>stopping</seealsoie>
<tertiaryie>varying braking, 1</tertiaryie>
<secondaryie>impulsive braking, 1</secondaryie>
<seealsoie>brake failure</seealsoie>
<secondaryie>impulsive stimulation, 1</secondaryie>
<tertiaryie>alternating, 1</tertiaryie>
<tertiaryie>with constant signum, 1</tertiaryie>
</indexentry>

The above rendered with docbook xsl to xhtml as the
following (with saxon 6.5.3):

<dt>oscillator, linear, 1, 2</dt>
<dd><dl><dt>braked, 1</dt>
<dd><dl><dt>forced, 1</dt>
<dd><dl><dt>stopping</dt>
<dt>brake failure</dt></dl></dd>
<dt>unvarying braking, 1</dt>
<dd><dl><dt>stopping</dt>
<dt>brake failure</dt></dl></dd>
<dt>varying braking, 1</dt>
<dd><dl><dt>brake failure</dt></dl></dd>
<dt>alternating, 1</dt>
<dt>with constant signum, 1</dt></dl></dd>
<dt>harmonic, 1</dt>
<dd><dl><dt>forced, 1</dt>
<dd><dl><dt>stopping</dt>
<dt>brake failure</dt></dl></dd>
<dt>unvarying braking, 1</dt>
<dd><dl><dt>stopping</dt>
<dt>brake failure</dt></dl></dd>
<dt>varying braking, 1</dt>
<dd><dl><dt>brake failure</dt></dl></dd>
<dt>alternating, 1</dt>
<dt>with constant signum, 1</dt></dl></dd>
<dt>impulsive braking, 1</dt>
<dd><dl><dt>alternating, 1</dt>
<dt>with constant signum, 1</dt></dl></dd>
<dt>impulsive stimulation, 1</dt>
<dd><dl><dt>alternating, 1</dt>
<dt>with constant signum, 1</dt></dl></dd>
</dl></dd>

As one can see, the seealsoie of the primaryie element
didn't rendered at all; tertiaryie elements appears
everywhere (under every secondaryie element) before it
comes; seealsoie elements of the tertiaryie and
secondaryie elements appears under every tertiaryie
element before it comes; but the seealsoie element of
the secondaryie elements didn't rendered in its place at
all.

A workaround for this could be similar to the following
change in the index.xsl (this eliminates the wrong
placements in output of the tertiaryie elements; in the
case of the seealsoie there would be more changes
necessary):

Change this
...
<xsl:template match="secondaryie">
<dt>
<xsl:apply-templates/>
</dt>
<xsl:choose>
<xsl:when test="following-sibling::tertiaryie">
<dd>
<dl>
<xsl:apply-templates select="following-
sibling::tertiaryie"/>
...

to this:
...
<xsl:template match="secondaryie">
<xsl:variable name="secondaryietext" select="."/>
<dt>
<xsl:apply-templates/>
</dt>
<xsl:choose>
<xsl:when test="following-sibling::*[1]
[self::tertiaryie]">
<dd>
<dl>
<xsl:apply-templates select="following-
sibling::tertiaryie[preceding-sibling::secondaryie[1]
=$secondaryietext]"/>
...

I don't know, how it renders to another output formats,
but I think, the source (attached as a valid docbook xml
file) is unambiguous and corresponds to the docbook
DTD and the DocBook Guide. Also I didn't found any
alternative markings of the above example that rendered
the way it should.

Discussion

  • Tom (flaute)

    Tom (flaute) - 2005-03-23

    DocBook index test file

     
  • Robert Stayton

    Robert Stayton - 2005-03-25

    Logged In: YES
    user_id=193218

    This sounds like bugs in the *ie templates. I think the reason
    that they haven't been reported before is that most people
    use indexterm elements embedded in the body of their
    document instead. Those are automatically processed into a
    grouped and sorted index, with active links from the index
    back into the HTML content. That way you don't have to
    author and maintain the index yourself. Have you considered
    using indexterms instead? I'm also curious as to what the
    page numbers refer to in your entries. Is this a copy of the
    index generated for print output?

     
  • Tom (flaute)

    Tom (flaute) - 2005-03-26

    Logged In: YES
    user_id=1244561

    In fact, the problem arose while converting a printed book to
    DocBook format. The page numbers are replaced with 'link's
    (inserted by hand) to the specific document location marked
    with an 'anchor' or @id.
    Therefore -- although this is a converted document (and it's
    source is also an xhtml document generated by
    the 'Mathematica' program) -- it's possible, that in a latter
    version in the future this converted index will be replaced with
    a generated one (i.e. with 'indextem's), but then I have to
    specify @sortas attributes (because it's not an english
    language document), etc.
    But I think, there could be other similar reasons to build the
    index this way...
    If you think the 'patch' above is acceptable, then perhaps I
    can extend it to the other *ie (see*ie, etc) elements, and
    upload it here, but I'm not too advanced in 'xslt coding' ;-)

     
  • Tom (flaute)

    Tom (flaute) - 2005-04-02
    • milestone: 447634 --> output: all formats
     
  • Tom (flaute)

    Tom (flaute) - 2005-04-02

    Logged In: YES
    user_id=1244561

    it seems that these are not only (x)html output problem, so
    changed the group spec. (At least in fo/index.xsl there could
    be false (or even falsely no) matches at least in *ie
    templates; eg. the preceding-sibling::* in seealsoie @start-
    indent will match every preceding teriaryie, even if the
    matching seealsoie comes right after a latter secondaryie).

     
  • Michael(tm) Smith

    • summary: indexentry children xsl processing problems --> all: indexentry children xsl processing problems
     
  • Robert Stayton

    Robert Stayton - 2009-03-12

    I'm cleaning up old bugs and fixed this in HTML output. I rewrote the templates for indexentry in html/index.xsl so they properly convert the flat list of children to a structured set of dl lists. The test case formats properly in HTML now. Next is FO output so I can close the bug.

     
  • Robert Stayton

    Robert Stayton - 2009-03-12
    • assigned_to: nobody --> bobstayton
     
  • Robert Stayton

    Robert Stayton - 2009-03-12
    • status: open --> pending-fixed
     
  • Robert Stayton

    Robert Stayton - 2009-03-12

    I reviewed the indexentry templates for FO output, and the only thing I had to fix were the determination of the indent for the seealsoie. Now it also formats like the HTML outputs. I think this bug is fixed now.

     
  • SourceForge Robot

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

    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).

     

Log in to post a comment.

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

Sign up for the SourceForge newsletter:





No, thanks