[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

Re: [xsl] Arabic alphabetical lists (xslt 1.0)

Subject: Re: [xsl] Arabic alphabetical lists (xslt 1.0)
From: Wolfgang Laun <wolfgang.laun@xxxxxxxxx>
Date: Fri, 30 Aug 2013 13:45:01 +0200

Here's a viable solution, as confirmed by Patricia. For XSLT 2.0:
s/div/idiv/ (and use a function):

<xsl:stylesheet version="1.0"

<xsl:variable name="arabletters"

<xsl:template name="hijai-order">
  <xsl:param name="number"/>
  <xsl:variable name="num-1" select="$number - 1"/>
  <xsl:variable name="unit" select="$num-1 mod string-length($arabletters)"/>
  <!--xsl:value-of select="$unit"/-->
  <xsl:variable name="tens" select="$num-1 div string-length($arabletters)"/>
  <xsl:if test="$tens != 0">
    <xsl:call-template name="hijai-order">
       <xsl:with-param name="number" select="$tens"/>
  <xsl:value-of select="substring($arabletters,$unit+1,1)"/>

<!-- test with a sequence of <item>s  -->
<xsl:template match="row">
  <xsl:variable name="pos" select="count(preceding-sibling::row)+1" />
    <xsl:value-of><xsl:call-template name="hijai-order">
<xsl:with-param name="number" select="$pos"/>
</xsl:call-template>  <xsl:value-of select="$pos"/></xsl:value-of>


On 28/08/2013, Wolfgang Laun <wolfgang.laun@xxxxxxxxx> wrote:
> Another deviation in the list on ask.metafilter.com (as well as in the one
> I
> can produce with my KSLT 2.0 processor) is that it simply iterates a range
> of Unicode code points; this appears to be the sort order used in
> modern Arabic dictionaries. If Wikipedia is correct, this is based on
> 28 Unicode letters from the codepage at U+0600, i.e.: 0627 - 0628,
> 062A - 063A, 0641 - 0648, 064A. Note the gaps.
> -W
> On 28/08/2013, Wolfgang Laun <wolfgang.laun@xxxxxxxxx> wrote:
>> After a look at Unicode code table U+0600..U+06FF I suspect that XSLT
>> processors rely on the underlying Java for producing the arabic
>> alphabet in order to get a set of symbols for creating the "numbering"
>> letter combinations.
>> An XSLT 2.0 processor (Saxon) produces 36 single letter numbers, which
>> isn't right either: it contains the teh marbutah and  U+063B through
>> U+063F, and the tatweel, none of which is, I think, correct.
>> I'm afraid you may have to roll your own, code something to create the
>> correct sequence of letters from an integer. If you need help with
>> this, there's others on this list better equipped to do it in XSLT
>> 1.0.
>> HTH
>> -W
>> On 28/08/2013, Patricia Piolon <skyanth@xxxxxxxxx> wrote:
>>> Hi!
>>> I've been trying to ask a question here a number of times but my
>>> message keeps getting bounced, presumably because of the special
>>> characters?
>>> My question is about xslt-generated alphabetical lists with Arabic
>>> characters, also posted here:
>>> http://ask.metafilter.com/247029/Please-tell-me-about-Arabic-alphabetical-lists.
>>> Could you please read the question in the link and reply here?
>>> Sorry for the convoluted way of asking this question; I'm not going to
>>> spend any more time trying to find out why this listbot hates my mail
>>> so much, so this is my last attempt.
>>> -- Patricia

Current Thread