xpath - Get text from node excluding children -
i want text node <hello>
, excluding children. know /element/hello/text()
supposed work, doesn't.
<element> <hello><b>exclude me</b> not me <b>i'm excluded :(</b> i'm included</hello> </element>
my output only:but not me
. if remove first node, works supposed , second text node (i'm included) parsed. here, native processor behaves similarly. saxon works expected. might bug? i'm using xml filters in libreoffice 4.4.2.2.
i want text node
<hello>
, excluding children. know/element/hello/text()
supposed work, doesn't.
/element/hello/text()
work select nodes want.
however, if you're using xsl:value-of
text, return value first node of selected set. of them, must do:
<xsl:for-each select="/element/hello/text()"> <xsl:value-of select="." /> </xsl:for-each>
the above applies xslt 1.0. in xslt 2.0,
<xsl:value-of select="/element/hello/text()"/>
will return text of all selected nodes, separated space (unless specify different separator).
Comments
Post a Comment