Hi all!

I'm trying to use the key and document functions to match some alternative inflections from one source file with the
appropriate main headword in my main source file. I've asked the xsl-list about the following error, and they've suggested
it might be a problem with xalan-j instead, and sent me to you.


I've run into an error I haven't been able to make sense of yet, and I'm hoping someone here will know. The error reads

(Location of error unknown)XSLT error (javax.xml.transform.Transformer Exception): java.lang.ArrayIndexOutOfBoundsException: 5182 >= 5182

I'm running xalan-java 2.5, and this is a slightly shortened version of the command line:

java org.apache.xalan.xslt.Process -in /inbox/13248/xmlin/English-French_Dictionary.xml -xsl ~/bin/xslt/oro2oeb4dak.xsl
-out /inbox/13248/lit/English-French_Dictionary-dak.html -param bilingual english -param inflectiono alternate
(all in one line of course)


Following are samples of my input data and my stylesheet:

main source file fragment:

<?xml version="1.0" encoding="us-ascii"?>
<!DOCTYPE OPR PUBLIC "-//xxx//DTD xxx//" "Oro-v315.dtd">
<OPR>
<letter value="A">
<e eid="e1" etype="feature"><hg><hw>a</hw> <pos>determiner</pos></hg><sg><se1><b>an</b> avant voyelle ou h muet. <se2 type="usage">For expressions such as <b>make a noise, make a fortune &rarr;noise, fortune.</b></se2> <se2 type="variant">un/une. <b>&tilde; tree</b> un arbre; <b>&tilde; chair</b> une chaise.</se2> <se2 type="variant">(<ctx><r>per</r></ctx>) <b>ten francs &tilde; kilo</b> dix francs le kilo; <b>three times &tilde; day</b> trois fois par jour.</se2> <se2 type="note">When talking about what people do or are, <b>a</b> is not translated into French: <b>she's a teacher</b> <i>elle est professeur;</i> <b>he's a widower</b> <i>il est veuf</i>.</se2></se1></sg></e>
<e eid="e2"><hg><hw>aback</hw> <pos>adv</pos></hg><sg><se1><b>taken &tilde;</b> d&eacute;concert&eacute;.</se1></sg></e>
<e eid="e3"><hg><hw>abandon</hw> <pos>vt</pos></hg><sg><se1>abandonner. &bull; <pos>n</pos> abandon <pos>m.</pos></se1></sg></e>
...
</letter>
...
</OPR>


english_alternate.xml fragment:

<?xml version="1.0" encoding="us-ascii"?>
<!DOCTYPE OPR PUBLIC "-//xxx//DTD xxx//" "Oro-v315.dtd">
<inflections>
<se id="e1"><formg><form>a</form><form>a's</form><form>A</form><form>A's</form></formg><hw>a</hw><hm>1</hm></se>
<se id="e2"><formg><form>a</form></formg><hw>a</hw><hm>2</hm></se>
<se id="e3"><formg><form>aback</form></formg><hw>aback</hw></se>
<se id="e4"><formg><form>abandon</form><form>abandoned</form><form>abandoning</form><form>abandons</form></formg><hw>abandon</hw></se>
...
</inflections>


XSL (in part):

<xsl:param name="bilingual" select="'title'" />

<xsl:param name="inflection" select="'regular'" />

<xsl:key name="entry-by-hw" match="se" use="concat(hw,'-',hm)" />

<xsl:variable name="alternate-inflections">
<xsl:choose>
<xsl:when test="$inflection = 'alternate'">
<xsl:variable name="inflection_name" select="concat($bilingual,'_alternate.xml')" />
<xsl:apply-templates select="document($inflection_name,/)" />
</xsl:when>
<xsl:otherwise />
</xsl:choose>
</xsl:variable>


<xsl:template ...
...
<xsl:if test="$inflection = 'alternate'">
<xsl:variable name="current_hw" select="concat(ancestor::e/hg/hw[1],'-',ancestor::e/hg/hom[1])" />
<xsl:for-each select="$alternate-inflections">
<xsl:variable name="match" select="key('entry-by-hw',$current_hw)" />
<xsl:for-each select="$match/formg/form">
<xsl:choose>
<xsl:when test=". = ancestor::e/hw" />
<xsl:otherwise>
<tei-ms:orth><object class="hidden"><xsl:apply-templates select="." /></object></tei-ms:orth>
</xsl:otherwise>
</xsl:choose>
</xsl:for-each>
</xsl:for-each>
</xsl:if>
...
</xsl:template>


Any suggestions? Thank you very much!


--Chris

----------------------------------------------------------------------------------------
Texterity ~ XML and PDF ePublishing Services
----------------------------------------------------------------------------------------
Chris Loschen, XML Developer
Texterity, Inc.
144 Turnpike Road
Southborough, MA 01772 USA
tel: +1.508.804.3033
fax: +1.508.804.3110
email: [EMAIL PROTECTED]
http://www.texterity.com/




Reply via email to