eat hml

<x> <y>Текст не нужун</y> <z>текст1</z> текст2 <z>текст3</z> </x> 

You need to get the text value of the element x, without the division of y.

text1 text2 text3

I try something like this, it does not work: string (x / self :: node () [not (y)])

Edit: sampling takes place in xslt. If someone wants to help here is the workpiece:

 <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:msxsl="urn:schemas-microsoft-com:xslt" exclude-result-prefixes="msxsl" > <xsl:output method="xml" indent="yes"/> <xsl:template match="@* | node()"> <xsl:apply-templates select="x"/> </xsl:template> <xsl:template match="x"> <out_text> <!-- <xsl:value-of select="*[name() != 'y']"/> --> <!-- <xsl:apply-templates select="descendant-or-self::*[name()!= 'y']" mode="my_concat" /> --> <xsl:apply-templates select="descendant-or-self::*[name()!= 'y']" mode="my_concat" /> </out_text> </xsl:template> <xsl:template match="*[name()!= 'y']" mode="my_concat" > <xsl:value-of select="text()"/> </xsl:template> </xsl:stylesheet> 
  • Try this /x/*[name() != 'y']/text() | /x/text()[position() = 2] /x/*[name() != 'y']/text() | /x/text()[position() = 2] - koks_rs

2 answers 2

On one of the other forums prompted and works:

 <xsl:copy-of select="/x/descendant-or-self::*[not(self::y)]/text()"/> 
  • Mark, please, as an answer (tick to the left of the answer) to help someone in the future) - alexoander
 /x/*[name() != 'y'] 

It seems that it should be like this (checked here http://codebeautify.org/Xpath-Tester )

  • No, it did not help, it does not work as it should. "Text 2" gets cleared A little bit, I select the elements in xslt, then I try to "link" them through this template: <xsl: template match = " " mode = "my_concat"> <xsl: > <xsl: value-of select = "./ text ()" /> </ xsl: for-each> </ xsl: template> - Sergej Loos