[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

Subject: Re: determining node position by the content of a text node
From: "Joris Gillis" <roac@xxxxxxxxxx>
Date: Mon, 12 Sep 2005 13:54:31 +0200
tex position
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

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.