[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] determining node position by the content of a text no
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
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|