[xsl] determining node position by the content of a text node

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

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 :

  <wort xml:lang="en"><seg>login</seg></wort>
  <wort xml:lang="de"><seg>Anmeldung</seg></wort>

  <wort xml:lang="en"><seg>customer</seg></wort>
  <wort xml:lang="de"><seg>Kunde</seg></wort>

  <wort xml:lang="en"><seg>order</seg></wort>
  <wort xml:lang="de"><seg>Bestellung</seg></wort>

  <wort xml:lang="en"><seg>browse</seg></wort>
  <wort xml:lang="de"><seg>suchen</seg></wort>

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"

<xsl:variable name="replace"

Can anyone help me ? Thanks in advance !


Gesendet von Yahoo! Mail - Jetzt mit 1GB Speicher kostenlos - Hier anmelden: http://mail.yahoo.de

Current Thread