xsl-list
[Top] [All Lists]

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

2013-08-30 06:45:19
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"
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
    xmlns:xsd="http://www.w3.org/2001/XMLSchema";>

<xsl:variable name="arabletters"
select="'&#x0627;&#x0628;&#x062A;&#x062B;&#x062C;&#x062D;&#x062E;&#x062F;&#x0630;&#x0631;&#x0632;&#x0633;&#x0634;&#x0635;&#x0636;&#x0637;&#x0638;&#x0639;&#x063A;&#x0641;&#x0642;&#x0643;&#x0644;&#x0645;&#x0646;&#x0647;&#x0648;&#x064A;'"/>

<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:call-template>
  </xsl:if>
  <xsl:value-of select="substring($arabletters,$unit+1,1)"/>
</xsl:template>

<!-- test with a sequence of <item>s  -->
<xsl:template match="row">
  <xsl:variable name="pos" select="count(preceding-sibling::row)+1" />
  <item>
    <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>
  </item>
</xsl:template>

</xsl:stylesheet>



On 28/08/2013, Wolfgang Laun <wolfgang(_dot_)laun(_at_)gmail(_dot_)com> 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(_dot_)laun(_at_)gmail(_dot_)com> 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(_at_)gmail(_dot_)com> 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

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: 
<mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--





--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--