[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

Subject: 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)
text node position
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

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.