« Return to Thread: Re: Glossary sorting in Japanese

RE: Glossary sorting in Japanese

by Richard Hamilton-2 :: Rate this Message:

Reply to Author | View in Thread

A few thoughts on this:

The sortas glossary sorting fix should also work with the
fo stylesheets.  I did a similar quick fix with Akagi-san
a few months ago and it worked well (then I forgot about
it entirely, or I would have filed an RFE myself; my bad:).

There are a few differences in the way I did this that may
be worth considering:

- I put the concat(.....) function inside an entity, then
  used the entity in each occurrence rather than copy all
  that code.  Since this happens in a bunch more places in
  the fo code, it seemed like the cleanest way to go.
- I wrapped the concat(.....) inside a normalize-space
  function.  This may just be belts and suspenders, but
  it does mean that a stray space in a sortas or glossterm
  value won't muck things up.

Also, it looks like the latest stylesheets assign the lowercase
and uppercase entities to a variable of the same name and use
that instead.  I'm not sure why, but it does mean that the code
should probably use $lowercase and $uppercase instead of &uppercase;
and &lowercase;.

Sorry I didn't file an RFE when this first came up, it would
have saved at least a little trouble.

Dick Hamilton


> -----Original Message-----
> From: David Cramer [mailto:dcramer@...]
> Sent: Tuesday, December 18, 2007 3:04 PM
> To: Akagi K; docbook-apps@...
> Subject: RE: [docbook-apps] Glossary sorting in Japanese
>
>
> Actually, the glossentry element already takes a sortas attribute:
> http://docbook.org/tdg/en/html/glossentry.html
> but it appears that the xsls aren't currently using it. You should be
> able add the Hiragana or Katanakana versions to the sortas on the
> glossentry and then do this in the templates from glossary.xsl in your
> customization layer (using the same concat trick from
> autoidx-kosek.xsl
> and autoidx-kimber.xsl):
>
> <xsl:sort lang="{$language}" select="translate(concat(@sortas,
> glossterm[not(parent::glossentry/@sortas) or
> parent::glossentry/@sortas
> = '']), &lowercase;, &uppercase;)"/>
>
> Instead of the current:
>
> <xsl:sort lang="{$language}" select="translate(glossterm, &lowercase;,
> &uppercase;)"/>
>
> This line appears more than once, so change them all. This is a bug in
> the xsls, so please log it at sourceforge if it's not there already. I
> would love to see the kosek and kimber approaches applied to the
> glossary too for grouping glossterms into glossdivs in the same way
> indexterms are automatically grouped into indexdivs.
>
>
> Also, I'm surprised by the need to translate all the characters to the
> same case. Is that really required?
>
> David
>
> > -----Original Message-----
> > From: Akagi K [mailto:akobayashi@...]
> > Sent: Tuesday, December 18, 2007 12:10 PM
> > To: docbook-apps@...
> > Subject: Re: [docbook-apps] Glossary sorting in Japanese
> >
> >
> > Further to the glossary sorting issue in Japanese, we are
> > using the id for glossentry and notice that they DO GET
> > SORTED, but in an arbitrary manner.
> > Is this a fluke, or is there some sort order that is
> > influencing it? What might that be, so that I can edit it?
> >
> > Thanks
> > Akagi
> >
> >
> > Jirka Kosek wrote:
> > >
> > > Akagi Kobayashi wrote:
> > >
> > >> The Kosek method can be used successfully to sort Hiragana and
> > >> Katanakana characters (I'm sure). I have added those after the
> > >> alphabet to the sort list. Attaching the test xml fyi.
> > >
> > > I haven't received file, but I would be happy to add it
> > into standard
> > > distribution. You can send it to me off-list.
> > >
> > >> Before I look into the Kimber method - I have an idea
> for sorting
> > >> words in kanji.
> > >>
> > >> Could you tell me whether using the glossentry id= link
> > might work?
> > >> This is explained in Chapter 16 - Linking to a glossary entry
> > >> http://www.sagehill.net/docbookxsl/LinkToGlossary.html
> > >> So the kanji word will be set as the glossterm; and its
> reading in
> > >> hiragana will be set as the glossentry id.
> > >
> > > You can do this, but stylesheets doesn't support sorting of
> > glossterms
> > > based on id values, so you will have to customize stylesheets.
> > >
> > > I think that adding sortas attribute to glossterm is the
> > right solution.
> > > If time permits we will discuss this request during today's
> > DocBook TC
> > > meeting.
> > >
> > > --
> > > ------------------------------------------------------------------
> > >   Jirka Kosek      e-mail: jirka@...      http://xmlguru.cz
> > > ------------------------------------------------------------------
> > >        Professional XML consulting and training services
> > >   DocBook customization, custom XSLT/XSL-FO document processing
> > > ------------------------------------------------------------------
> > >  OASIS DocBook TC member, W3C Invited Expert, ISO/JTC1/SC34 member
> > > ------------------------------------------------------------------
> > >  Want to speak at XML Prague 2007 => http://xmlprague.cz/cfp.html
> > >
> > >
> > >  
> > >
> >
> > --
> > View this message in context:
> > http://www.nabble.com/Re%3A-Glossary-sorting-in-Japanese-tp101
> 76176p14402503.html
> > Sent from the docbook apps mailing list archive at Nabble.com.
> >
> >
> >
> ---------------------------------------------------------------------
> > To unsubscribe, e-mail:
> docbook-apps-unsubscribe@...
> > For additional commands, e-mail:
> > docbook-apps-help@...
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: docbook-apps-unsubscribe@...
> For additional commands, e-mail:
> docbook-apps-help@...
>
>



---------------------------------------------------------------------
To unsubscribe, e-mail: docbook-apps-unsubscribe@...
For additional commands, e-mail: docbook-apps-help@...

 « Return to Thread: Re: Glossary sorting in Japanese