I've spent some time trying to get a custom collation to work on an
indigenous language using Saxon. I eventually figured out how to do it
but am still a little perplexed. I have not programmed in java before
but was able to copy and adapt some java code to create a class that
extends the RuleBasedCollator (refer to:
http://www.ibm.com/developerworks/library/x-xsltsorting/ and
http://java.sun.com/javase/6/docs/api/java/text/RuleBasedCollator.html)
Could someone explain to me why this works:
java net.sf.saxon.Transform -o testout.xml "LIFTExport.xml"
"LIFTCustomCollated.xsl"
but this does not:
Transform.exe -s:"LIFTExport.xml" -xsl:"LIFTCustomCollated.xsl" -o:testout.xml
with the following stylesheet (of particular interest the xsl:sort collation):
<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml"/>
<xsl:template match="/">
<xsl:apply-templates/>
</xsl:template>
<xsl:template match="lift">
<lift>
<xsl:apply-templates mode="copy" select="@*"/>
<xsl:apply-templates select="header"/>
<xsl:apply-templates select="entry">
<xsl:sort select="lexical-unit/form[(_at_)lang='tsi']/text"
order="ascending"
collation="http://saxon.sf.net/collation?class=com.lhtrees.xslt.LangXCollation;"
/>
</xsl:apply-templates>
</lift>
</xsl:template>
<xsl:template match="header">
<header>
<xsl:apply-templates mode="copy"/>
</header>
</xsl:template>
<xsl:template match="entry">
<entry>
<xsl:apply-templates mode="copy"/>
</entry>
</xsl:template>
<!-- Deep copy template -->
<xsl:template match="*|text()|@*" mode="copy">
<xsl:copy>
<xsl:apply-templates mode="copy" select="@*"/>
<xsl:apply-templates mode="copy"/>
</xsl:copy>
</xsl:template>
<!-- Handle default matching -->
<xsl:template match="*"/>
</xsl:stylesheet>
I am using saxon9. When I use the Transform.exe command line I get the
following error:
Warning: Failed to load com.lhtrees.xslt.LangXCollation
Warning: Failed to load com.lhtrees.xslt.LangXCollation
Error at xsl:sort on line 23 column 91 of liftCustomCollated.xsl:
XTDE1035: Collation
http://saxon.sf.net/collation?class=com.lhtrees.xslt.LangXCollation;
has not been defined
Failed to compile stylesheet. 1 error detected.
I'm glad it works with java net.sf.saxon.Transform but would like to
understand the difference.
Thank you for any enlightenment you can give.
Larry
--~------------------------------------------------------------------
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>
--~--