[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] RE: Next node name
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
|
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
|