xml-xalan-j-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Chris Loschen <losc...@texterity.com>
Subject Lookup alternate inflections for headword in secondary file
Date Thu, 15 May 2003 19:45:04 GMT
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 
         -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">
<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>

english_alternate.xml fragment:

<?xml version="1.0" encoding="us-ascii"?>
<!DOCTYPE OPR PUBLIC "-//xxx//DTD xxx//" "Oro-v315.dtd">
<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>

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:when test="$inflection = 'alternate'">
                         <xsl:variable name="inflection_name" 
select="concat($bilingual,'_alternate.xml')" />
select="document($inflection_name,/)" />
                 <xsl:otherwise />

<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:when test=". = ancestor::e/hw" />
class="hidden"><xsl:apply-templates select="." /></object></tei-ms:orth>

Any suggestions? Thank you very much!


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: loschen@texterity.com

View raw message