[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: determining node position by the content of a tex
Hi,
Tempore 13:33:34, die 09/12/2005 AD, hinc in xsl-list@xxxxxxxxxxxxxxxxxxxxxx scripsit Thomas Winkler <thomasm003@xxxxxxxx>: 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. That's a very fragile algorithm. What garanty is there that the English translation is exactly before the German version? If you'd like to persist with this technique, then at least store the node itself, instead of its position (it's not easy to calculate the position within xpath). <xsl:variable name="Germanword" select="document('dict.xml')//seg[text()=$trans]"/> <xsl:variable name="Englishword" select="$Germanword/preceding::seg[1]"/> In my opinion, it's far better to use keys instead. e.g. <xsl:key name="term" match="wort" use="concat(@xml:lang,'-',seg)"/> <xsl:variable name="Englishword"> <xsl:for-each select="document('dict.xml')"> <xsl:value-of select="key('term',concat('de-',$trans))/../wort[@xml:lang='en']"/> </xsl:for-each> </xsl:variable> regards, -- Joris Gillis (http://users.telenet.be/root-jg/me.html) Laudeo W3C et dona ferens
|
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
|