#145 new attribute to classify index terms

closed-fixed
XSL (399)
5
2004-08-16
2003-04-01
Stefan Seefeld
No

It would be desirable to be able to generate mutiple
indices, for various
used defined types. With a new classifier attribute in
both, the indexterm
and the index element this is possible.

<index classifier="foobar"/> would then generate an
index of all terms
defined with the "foobar" classifier, while <index/>
would index all
terms.

http://www.gnu.org/manual/texinfo/html_mono/texinfo.html#Indices
explains how such a feature could be put to good use.

Discussion

  • Logged In: YES
    user_id=118135

    Stefan,

    Have you looked at the existing "profiling" (conditional text)
    capability provided in the standard DocBook XSL stylesheet
    distribution?

    Take a look at the URL below for some how-to documentation
    on profiling (from Bob Stayton).

    http://sagehill.net/xml/docbookxsl/SpecialHandling.html#Profiling

    So unless I'm misunderstanding, I think the capability you're
    asking for is already supported by the current XSL stylesheets,
    and there is no need to add an attribute to the DTD to support
    it.

    But if you believe differently and want to request the addition
    of a new attribute to the DTD, you need to file the request
    as an RFE. The place for submitting RFEs is:

    https://sourceforge.net/tracker/?func=add&group_id=21935&atid=384107

     
  • Stefan Seefeld
    Stefan Seefeld
    2003-04-02

    Logged In: YES
    user_id=764

    Michael,

    thanks for pointing me towards the profiling stuff. I
    believe it is
    not appropriate for what I have in mind, as it seems to be only
    concerned about optional xml segments.

    In contrast, I want to preserve all items (indexterms), but
    classify
    them with a user provided string. This allows to generate
    classifier-specific indexes.

    As an example imagine my document containing lots of
    definitions which I want to index. However, there are different
    kinds of items defined, such as types, variables, functions,
    etc.

    I thus want to generate an 'type index', 'variable index',
    'function index', etc.

    So I do think that profiling isn't the right tool, but may
    be I misunderstood it...

     
  • Logged In: YES
    user_id=118135

    Hi Stefan,

    No, you didn't misunderstand -- the 'profiling' support is just
    for conditionally or optionally omitting certain parts of a
    source document.

    After reading through your feature request more carefully
    and also reading through the RFE you submitted, I can
    see a big value in what you're suggesting (generation of
    multiple indexes based on 'types' of indexterms). I know
    that other authoring applications like FrameMaker support
    that, so it'd be nice to see it supported in the DocBook
    system as well.

    That said, this could be implemented in the stylesheets
    without (for now) any changes being made to the DTD.
    That is, the stylesheets could be made to support use
    of one of the existing common attributes for this purpose,
    probably either "condition" or "role".

    But for the long term, I think adding an attribute to
    indexterm to "formalize" would be a good idea. I think
    I'd be inclined to go with an attribute named "type" instead
    of "classifier", though.

     
  • Stefan Seefeld
    Stefan Seefeld
    2003-04-04

    patch enables 'typed' indexes in the html generating stylesheets, based on 'type' attribute.

     
    Attachments
  • Stefan Seefeld
    Stefan Seefeld
    2003-04-04

    Logged In: YES
    user_id=764

    attached is a patch to enable typed indexes in html documents
    (diff against docbook-xsl-1.60.1). This patch uses the 'type'
    attribute, as suggested by Michael Smith.

     
    • labels: 321157 --> XSL
     
  • Logged In: YES
    user_id=804589

    Stefan, does you patch actually work for you ? It doesn't
    for me.
    Here is a version which works for me.

     
  • Logged In: YES
    user_id=804589

    Hmm, don't know how to attach files in this tracker, thus
    I'll have to paste my patch here:

    --- stuff/docbook-xsl-1.60.1/html/autoidx.xsl Mon Jan 20
    18:16:31 2003
    +++ gnome/gtk-doc/index.xsl Fri Jun 20 02:44:42 2003
    @@ -90,11 +90,12 @@
    <xsl:template name="generate-index">
    <xsl:param name="scope" select="(ancestor::book|/)[last()]"/>

    - <xsl:variable name="terms"
    - select="//indexterm[count(.|key('letter',
    + <xsl:variable name="role" select="@role"/>
    +
    + <xsl:variable name="terms"
    select="//indexterm[contains(@role, $role) and
    count(.|(key('letter',

    translate(substring(&primary;, 1, 1),

    &lowercase;,
    -
    &uppercase;))[&scope;][1]) = 1
    +
    &uppercase;))[contains(@role, $role)])[&scope;][1]) = 1
    and not(@class =
    'endofrange')]"/>

    <xsl:variable name="alphabetical"
    @@ -116,6 +117,7 @@
    <xsl:apply-templates
    select="$others[count(.|key('primary',

    &primary;)[&scope;][1]) = 1]"
    mode="index-symbol-div">
    + <xsl:with-param name="role" select="$role"/>
    <xsl:with-param name="scope" select="$scope"/>
    <xsl:sort select="translate(&primary;,
    &lowercase;, &uppercase;)"/>
    </xsl:apply-templates>
    @@ -123,10 +125,12 @@
    </div>
    </xsl:if>

    - <xsl:apply-templates
    select="$alphabetical[count(.|key('letter',
    + <xsl:apply-templates
    select="$alphabetical[contains(@role, $role)
    + and count(.|key('letter',

    translate(substring(&primary;, 1, 1),
    -
    &lowercase;,&uppercase;))[&scope;][1]) = 1]"
    +
    &lowercase;,&uppercase;))[contains(@role, $role) and
    &scope;][1]) = 1]"
    mode="index-div">
    + <xsl:with-param name="role" select="$role"/>
    <xsl:with-param name="scope" select="$scope"/>
    <xsl:sort select="translate(&primary;, &lowercase;,
    &uppercase;)"/>
    </xsl:apply-templates>
    @@ -135,6 +139,7 @@

    <xsl:template match="indexterm" mode="index-div">
    <xsl:param name="scope" select="."/>
    + <xsl:param name="role" select="''"/>

    <xsl:variable name="key"
    select="translate(substring(&primary;, 1,
    1),&lowercase;,&uppercase;)"/>
    @@ -152,6 +157,7 @@
    <xsl:apply-templates select="key('letter',
    $key)[&scope;]

    [count(.|key('primary', &primary;)[&scope;][1])=1]"
    mode="index-primary">
    + <xsl:with-param name="role" select="$role"/>
    <xsl:with-param name="scope" select="$scope"/>
    <xsl:sort select="translate(&primary;,
    &lowercase;, &uppercase;)"/>
    </xsl:apply-templates>
    @@ -162,6 +168,7 @@

    <xsl:template match="indexterm" mode="index-symbol-div">
    <xsl:param name="scope" select="/"/>
    + <xsl:param name="role" select="''"/>

    <xsl:variable name="key"
    select="translate(substring(&primary;, 1, 1),

    &lowercase;,&uppercase;)"/>
    @@ -169,6 +176,7 @@
    <xsl:apply-templates select="key('letter', $key)
    [count(.|key('primary',
    &primary;)[&scope;][1]) = 1]"
    mode="index-primary">
    + <xsl:with-param name="role" select="$role"/>
    <xsl:with-param name="scope" select="$scope"/>
    <xsl:sort select="translate(&primary;, &lowercase;,
    &uppercase;)"/>
    </xsl:apply-templates>
    @@ -176,7 +184,9 @@

    <xsl:template match="indexterm" mode="index-primary">
    <xsl:param name="scope" select="."/>
    + <xsl:param name="role" select="''"/>

    + <xsl:if test="contains(@role, $role)">
    <xsl:variable name="key" select="&primary;"/>
    <xsl:variable name="refs" select="key('primary',
    $key)[&scope;]"/>
    <dt>
    @@ -210,6 +220,7 @@
    </xsl:apply-templates>
    </dl>
    </dd>
    + </xsl:if>
    </xsl:if>
    </xsl:template>

     
  • Logged In: YES
    user_id=804589

    Norm, any chance to look at my patch for using the role
    attribute to create "typed indices" ? That feature would be
    really handy in many situations, e.g. I would like to use it for

    creating indices of deprecated and newly added interfaces in
    api references.

     
  • Robert Stayton
    Robert Stayton
    2004-08-16

    • assigned_to: nwalsh --> bobstayton
    • status: open --> closed-fixed
     
  • Robert Stayton
    Robert Stayton
    2004-08-16

    Logged In: YES
    user_id=193218

    Actually the 'type' attribute on indexterm in DocBook 4.3 is
    for that purpose. Support was added to XSL for the next
    release. If you are using 4.2 or earlier, you can use role
    instead.