Subject: [xsl] determining node position by the content of a text node From: Thomas Winkler <thomasm003@xxxxxxxx> Date: Mon, 12 Sep 2005 13:33:34 +0200 (CEST) |
I want to translate (German <-->English) some XML documents. Therefore I have created a dictionary dict.xml). My stylesheet should work like this : Find a text-node named "Kunde". Then call the dictionary and search for that word.After finding it, remember the position of that word, because the english text node for that German word is one element-node before. See the dict.xml : ... <tu> <wort xml:lang="en"><seg>login</seg></wort> <wort xml:lang="de"><seg>Anmeldung</seg></wort> </tu> <tu> <wort xml:lang="en"><seg>customer</seg></wort> <wort xml:lang="de"><seg>Kunde</seg></wort> </tu> <tu> <wort xml:lang="en"><seg>order</seg></wort> <wort xml:lang="de"><seg>Bestellung</seg></wort> </tu> <tu> <wort xml:lang="en"><seg>browse</seg></wort> <wort xml:lang="de"><seg>suchen</seg></wort> </tu> ... My first thought was to create a stylesheet like this but obviously the Xpath expression position() cannot be used like that. ... <xsl:template match="*[text()='Kunde']"> <xsl:variable name="trans" select="text()"/> <xsl:variable name="pos" select="number(document('dict.xml')//seg[text()=$trans]/position())"/> <xsl:variable name="replace" select="string(document('dict.xml')//wort[$pos][1])"/> ... Can anyone help me ? Thanks in advance ! ___________________________________________________________ Gesendet von Yahoo! Mail - Jetzt mit 1GB Speicher kostenlos - Hier anmelden: http://mail.yahoo.de
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] urgent..creating loops in, omprakash . v | Thread | Re: [xsl] determining node position, Joris Gillis |
Re: [xsl] Traversing the tree, Dimitre Novatchev | Date | Re: [xsl] determining node position, Joris Gillis |
Month |