Hi,
I just tried using an axes method with this problem and it
took more than 15
minutes to crunch through on a 2 GHZ Pentium with lots of
RAM. I need to
How big was your source document?
I have data of the following sort. You will note that minor or major
elements and their senses can have one or more index elements.
<LexicalDatabase>
<minor>
<base>'wah 'nabuuysk</base>
<sense num=" 1">
<index enc="ENG">unexpected</index>
</sense>
</minor>
<minor>
<base>'wah wilâontk</base>
</minor>
<major>
<base>'wàhamaniits'à</base>
<sense num=" 1">
<pos>v</pos>
<def enc="ENG">careless</def>
<index enc="ENG">careless</index>
</sense>
</major>
<major>
<base>xbimooksk</base>
<sense num=" 1">
<pos>n</pos>
<def enc="ENG">half-white </def>
<index enc="ENG">metis</index>
<index enc="ENG">half-white</index>
</sense>
</major>
<major>
<base>xbismsgèè</base>
<sense num=" 1">
<pos>v</pos>
<index enc="ENG">bow your head</index>
<index enc="ENG">bend down</index>
</sense>
</major>
</LexicalDatabase>
What I would like to do is get output a file that has index elements
containing their major or minor entries. It is similar to
grouping by last
name or city except that each person could have one, two or
more of these.
Perhaps "Schools attended" would be a good example. Anyhow,
here is a sample
of what I would like to output.
<IndexList>
<IndexItem value="metis">
<entry base="xbimooksk" baseHom="" />
</IndexItem>
<IndexItem value="microwave">
<entry base="âànuut" baseHom="2"/>
</IndexItem>
<IndexItem value="midday">
<entry base="nsèèlga sah" baseHom=""/>
<entry base="sèèlgyàxsk" baseHom=""/>
</IndexItem>
<IndexItem value="middle (in the _)">
<entry base="lusèèlk" baseHom=""/>
<entry base="xts'a" baseHom=""/>
</IndexItem>
</IndexList>
Your source and desired output don't match (e.g. no "microwave" in source), so
it's bit hard to see how it should work.
<xsl:key name="entries-by-index" match="index" use="."/>
<xsl:template match="LexicalDatabase">
<IndexList>
<xsl:for-each select="*/sense/index[generate-id() =
generate-id(key('entries-by-index', .)]">
<xsl:sort select="." data-type="text"/>
<IndexItem value="{.}">
<xsl:for-each select="key('entries-by-index', .)/../../base">
<entry base="{.}" baseHom=""/>
</xsl:for-each>
</IndexItem>
</xsl:for-each>
</IndexList>
</xsl:template>
Will get you somewhere, but I didn't understand where the value of baseHom
comes from.
J - Wumpscut: Deliverance (Alternative Club Mix)
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list