|
Subject: [xsl] Muenchian method on nodes with two or more items for indexing From: "Larry Hayashi" <larry_hayashi@xxxxxxxxxxx> Date: Thu, 19 Sep 2002 22:26:07 -0500 |
<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>
<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>
I did the above using the Muenchian method but found that if a major or minor element contained more than one index element, it would only put the first one in the resulting index list. The second one did not appear.
<xsl:key name="entries-by-index" match="LexicalDatabase/*"
use=".//index"/>
<xsl:template match="LexicalDatabase">
<xsl:for-each select="*[generate-id() = generate-id(key('entries-by-
index', .//index)[1])]">
<xsl:sort select=".//index" data-type="text"/>
<IndexItem>
<xsl:attribute name="value"><xsl:value-of select=".//index"/>
</xsl:attribute>
<xsl:for-each select="key('entries-by-index', .//index)">
<entry>
...
_________________________________________________________________ Send and receive Hotmail on your mobile device: http://mobile.msn.com
| Current Thread |
|---|
|
| <- Previous | Index | Next -> |
|---|---|---|
| Re: [xsl] combine node values, Edwin Colaco | Thread | RE: [xsl] Muenchian method on nodes, Jarno . Elovirta |
| Re: [xsl] replace < and > wit, Ming Yu | Date | [xsl] Mutiple values for variable, Kunal H. Parikh |
| Month |