Subject: [xsl] RE: Next node name From: "Casadome, Francisco Javier" <Francisco.Casadome@xxxxxxxxxxxxxx> Date: Wed, 3 Apr 2002 13:41:02 +0200 |
Hi all, I have an xml like this (actually is a TMX): <tu> <tuv> <seg>Use <ut>{\cs6\f1\cf6\lang1024 </ut><b><ut>}</ut>Set<ut>{\cs6\f1\cf6\lang1024 </ut></b><ut>}</ut> when you want to assign an object reference</seg> </tuv> </tu> with a lot of "tu". I want to replace all the formatted text (the word "Set" in the example above) and the format nodes by a string, lets say "(%TERM%)". The result would be: <tu> <tuv> <seg>Use (%TERM%) when you want to assign an object reference</seg> </tuv> </tu> I use this template to walk through the nodes inside "seg" nodes (note that it's not working right now): <xsl:template match="seg"> <xsl:for-each select="node()"> <xsl:choose> <xsl:when test="not(name()) and not(following-sibling::*[1][name()])"> <xsl:value-of select="."/> </xsl:when> <xsl:otherwise> <!-- <xsl:text>(%TERM%)</xsl:text>--> </xsl:otherwise> </xsl:choose> </xsl:for-each> </xsl:template> What I do is: when the node has no name, it means we are in a text node, so there's nothing to do with it unless it's between two nodes with name (the "ut" nodes), then is when I have to replace. For the nodes with name (the "ut" nodes) I just do nothing so they are removed. What I need to know is how to reference the next and previous node names to check if they are "ut" nodes. Thanks in advance, Frank. XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
[xsl] Increment/decrement a variab, Shaik Zulfakhar Ali | Thread | Re: [xsl] RE: Next node name, Jeni Tennison |
RE: [xsl] Increment/decrement a va, Jarno . Elovirta | Date | [xsl] XML-QL, Alia Mikati |
Month |