xsl-list
[Top] [All Lists]

RE: [xsl] How to define a custom collation for Saxon8-8J

2006-11-07 08:02:45

Thanks a lot! The version with the "lang" parameter is working. 

When I need specific rules that differ from the standard Java "de" locale, I 
would have to set up my own RuleBasedCollator class. I found samples in the 
Java tutorials how to write down the rules but I'm not well versed enough in 
Java to wrap that properly up so that it works with Saxon. May I bother you 
with asking for a working sample file with the right Java code in it if you 
happen to have that readily available.

Thanks for taking your time to assist me!

Wolfgang


"Michael Kay" <mike(_at_)saxonica(_dot_)com> 07.11.2006 12:40:40 >>>
This will vary from one product to another, but the facilities in Saxon are
defined at

http://www.saxonica.com/documentation/extensibility/collation.html 

You should be able to get a collation suitable for German simply by using
lang="de" on xsl:sort, though it you need to use it for other operations
such as < and > then you will need to use a collation URI, which in Saxon is

http://saxon.sf.net/collation?lang=de 

If you want to set up your own Java RuleBasedCollator you can; if the
relevant class is BasicGerman and it's on the classpath then you can use

http://saxon.sf.net/collation?class=BasicGerman 

If you don't want to use Saxon-specific URIs, then you can implement your
own CollationURIResolver.

Saxon-specific questions are best asked on the saxon-help list or forum at
SourceForge.net

Michael Kay
http://www.saxonica.com/ 

 

-----Original Message-----
From: Wolfgang Schindler [mailto:w(_dot_)schindler(_at_)pons(_dot_)de] 
Sent: 07 November 2006 11:22
To: XSL-List(_at_)lists(_dot_)mulberrytech(_dot_)com 
Subject: [xsl] How to define a custom collation for Saxon8-8J

Hi,

I defined a rudimentary German collation in a basicGerman.java file:

String simpleRule ="a < ä < A < Ä < b < c < d < e < f < g < h 
< i < j < k < l < m < n < o < p < q < r < s < t < u < v < w < 
x < y < z"; RuleBasedCollator basicGerman = new 
RuleBasedCollator (simpleRule); 

(Please note: It's far from perfect and doesn't cover 
everything needed for German)

Then I wanted to use that collation for sorting in XSLT:

<xsl:template match="myroot">
  <myroot>
      <xsl:apply-templates>
              <xsl:sort select="stich" 
collation="file://D:/saxonsa8-8j/basicGerman"/>
                </xsl:apply-templates>
  </myroot>
</xsl:template>

When I execute that XSLT I get the following error:

Error at xsl:sort on line 10 of file:/D:/saxonsa8-8j/sort.xsl:
  XTDE1035: Collation file://D:/saxonsa8-8j/basicGerman has 
not been defined Failed to compile stylesheet. 1 error detected.

How is a collation "defined" for XSLT sorting?

Many thanks in advance!

Wolfgang


--~------------------------------------------------------------------
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>
--~--




--~------------------------------------------------------------------
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>
--~--

<Prev in Thread] Current Thread [Next in Thread>