Martin,
Thanks for your reply. I validated both files, they should be allright now.
I am working with xslt 1.0, at least I am trying.
lem = the entry, contains at the top level a lemid and the entry plus
grammatical category (CAT) and, optionally, grammatical information on plural
(in GRAMH).
meaning = the separate meanings of a given entry word, numbered with BETNR
trn = the translation cluster, contains one mtrn (main translation) and, when
applicable, one or more sytrn (synonym translations)
mtrn = cluster which contains main translation (MTRANS) plus relevant labels
and grammar
sytrn = cluster which contains translations that are synomous to mtrn plus
relevant labels and grammar
revrk / revrs = key word needed for determining at which entry the item should
be grouped. The difference in code is related to the type of translation:
exemplifying sentences, which can never be a head word, have REVRS
exmpl = contains exemplifying sentences VOORB and labels and the vve cluster
vve = contains VVERT
RES = contains a synonym of the entry word indicating the sense it is being
translated, e.g.
dark (obscure) obscuur
dark (black) donker
etc.
I have been juggling with the keys a lot and managed to get a list of entries
and translations, but got lost in the other details.
Thanks again!
Robert.
This is the input:
<?xml version="1.0" encoding="utf-8"?>
<dictionary>
<lem>
<LEMID>17688</LEMID>
<HEADW>obscuur</HEADW>
<CAT>adj</CAT>
<meaning id='BNT-19'>
<BETNR>1</BETNR>
<trn>
<mtrn>
<MTRANS>dark</MTRANS>
<GRAMV>-er</GRAMV>
<REVRK>dark</REVRK>
</mtrn>
<sytrn>
<SYNTR>obscure</SYNTR>
<GRAMV>-r</GRAMV>
<REVRS>obscure</REVRS>
</sytrn>
<sytrn>
<LABEL>formal</LABEL>
<SYNTR>awkward</SYNTR>
<GRAMV>-er</GRAMV>
<REVRS>awkward</REVRS>
</sytrn>
<sytrn>
<SYNHW>eng</SYNHW>
<SYNTR>spooky</SYNTR>
<GRAMV>-kier</GRAMV>
<REVRK>spooky</REVRK>
</sytrn>
</trn>
<exmpl>
<VOORB>een obscuur zaakje</VOORB>
<vve>
<VVERT>an awkward case</VVERT>
<REVRS>awkward</REVRS>
</vve>
</exmpl>
</meaning>
</lem>
<lem>
<LEMID>000000</LEMID>
<HEADW>vreemd</HEADW>
<CAT>adj</CAT>
<meaning id='BNT-20'>
<BETNR>1</BETNR>
<trn>
<mtrn>
<MTRANS>strange</MTRANS>
<GRAMV>-er</GRAMV>
<REVRK>strange</REVRK>
</mtrn>
<sytrn>
<SYNTR>awkward</SYNTR>
<GRAMV>-er</GRAMV>
<REVRS>awkward</REVRS>
</sytrn>
</trn>
<exmpl>
<VOORB>een vreemde kerel</VOORB>
<vve>
<VVERT>an awkward fellow</VVERT>
<REVRS>awkward</REVRS>
</vve>
</exmpl>
</meaning>
</lem>
</dictionary>
The desired output should look like this:
<?xml version="1.0" encoding="utf-8"?>
<dictionary>
<lem>
<HEADW>dark</HEADW>
<CAT>adj</CAT>
<GRAMH>-er</GRAMH>
<meaning id='1328'>
<RES>obscure</RES>
<trn>
<mtrn>
<orig id='BNT-20'/>
<MTRANS>obscuur</MTRANS>
</mtrn>
</trn>
</meaning>
</lem>
<lem>
<HEADW>awkward</HEADW>
<CAT>adj</CAT>
<GRAMH>-er</GRAMH>
<meaning id='1287'>
<orig id='BNT-19'/>
<BETNR>1</BETNR>
<RES>dark</RES>
<trn>
<mtrn>
<MTRANS>obscuur</MTRANS>
<LABEL>formal</LABEL>
</mtrn>
</trn>
<exmpl>
<VOORB>an awkward case</VOORB>
<vve><VVERT>een obscuur zaakje</VVERT></vve>
</exmpl>
</meaning>
<meaning id='1288'>
<BETNR>2</BETNR>
<orig id='BNT-21'/>
<RES>strange</RES>
<trn>
<mtrn>
<MTRANS>vreemd</MTRANS>
</mtrn>
</trn>
<exmpl>
<VOORB>an awkward fellow</VOORB>
<vve>
<VVERT>een vreemde kerel</VVERT>
</vve>
</exmpl>
</meaning>
</lem>
<lem>
<HEADW>spooky</HEADW>
<CAT>adj</CAT>
<GRAMV>-ier</GRAMV>
<meaning id='BNT-23455'>
<BETNR>1</BETNR>
<trn>
<orig id='BNT-19'/>
<mtrn>
<MTRANS>eng</MTRANS>
</mtrn>
<sytrn>
<SYNTR>obscuur</SYNTR>
</sytrn>
</trn>
</meaning>
</lem>
</dictionary>
----- Original Message ----
From: Martin Honnen <Martin(_dot_)Honnen(_at_)gmx(_dot_)de>
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Sent: Mon, November 16, 2009 6:05:20 PM
Subject: Re: [xsl] reversing dictionary in xml
Robert Ee wrote:
More could be said, but I hope the example speaks for itself.
Neither the input you posted nor the output you posted are well-formed.
The input has a closing </wb> without a corresponding start tag. That is easily
fixed.
But the output has more problems, I am not sure how it is supposed to look.
Consider to post well-formed samples, otherwise it is hard to use them to infer
an XSLT solution.
Also do you want to use XSLT 2.0 or 1.0 to solve that?
--
Martin Honnen
http://msmvps.com/blogs/martin_honnen/
--~------------------------------------------------------------------
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>
--~--
--~------------------------------------------------------------------
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>
--~--