Skip to content

Instantly share code, notes, and snippets.

@paregorios
Created October 29, 2015 17:02
Show Gist options
  • Save paregorios/58b186811d1ef1b11497 to your computer and use it in GitHub Desktop.
Save paregorios/58b186811d1ef1b11497 to your computer and use it in GitHub Desktop.
Define custom collation in XSL 2 for Saxon 9.6
<xsl:variable
name="mixed-collation"
select="concat('http://saxon.sf.net/collation?rules=',
encode-for-uri('&lt; 0 &lt; 1 &lt; 2 &lt; 3 &lt; 4 &lt; 5 &lt; 6 &lt; 7 &lt; 8 &lt; 9 &lt; a,A &lt; b,B &lt; c,C &lt; d,D &lt; e,E &lt; f,F &lt; g,G &lt; h,H &lt; i,I &lt; j,J &lt; k,K &lt; l,L &lt; m,M &lt; n,N &lt; o,O &lt; p,P &lt; q,Q &lt; r,R &lt; s,S &lt; t,T &lt; u,U &lt; v,V &lt; w,W &lt; x,X &lt; y,Y &lt; z,Z &amp; A = Á &amp; A = Ä &amp; A = Ẵ &amp; A = Ằ &amp; C = Ç &amp; D = Đ &amp; E = É &amp; E = Ễ &amp; O = Ö &amp; a = à &amp; a = á &amp; a = â &amp; a = ä &amp; ae = æ &amp; c = ç &amp; e = è &amp; e = é &amp; e = ê &amp; i = í &amp; i = î &amp; i = ï &amp; n = ñ &amp; o = ó &amp; o = ô &amp; o = ö &amp; o = ø &amp; u = û &amp; u = ü &amp; c = č &amp; e = ē &amp; g = ğ &amp; i = ĭ &amp; i = İ &amp; i = ı &amp; l = ł &amp; n = ń &amp; o = ō &amp; s = ś &amp; s = ş &amp; S = Š &amp; s = š &amp; H = Ḥ &amp; h = ḥ &amp; H = Ḫ &amp; h = ḫ &amp; K = Ḳ &amp; k = ḳ &amp; s = ṣ &amp; T = Ṭ &amp; t = ṭ &amp; v = ṿ &amp; z = ẓ'))"/>
<xsl:for-each select="*">
<xsl:sort select="." collation="{$mixed-collation}"/>
<!-- do something useful here -->
</xsl:for-each>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment