Subject: Re: [xsl] Selecting text bisected by child nodes. -- SOLVED From: Gan Uesli Starling <alias@xxxxxxxxxxx> Date: Tue, 22 Apr 2003 16:17:06 -0400 |
Gan Uesli Starling asked:
I have a node <foo> which has one or more child nodes. Those child nodes often bisect the text of <foo>, thus...
<foo>ABC<x>1</x><y>2</y><z>3</z>DEF</foo>
My question is, how can I select just the 'DEF' from <foo>?
Or, baring that, how can I select 'ABCDEF' sans the child nodes. Always when I use 'select="node()" inside of <foo> the 'DEF' gets lost.
Jeff Kenton answered:
Try selecting foo/text(). This will ignore your x-y-z children, but get ABC and DEF.
Hm, doesn't work in either Mozilla 1.3 or Xalan-J. It
still always loses the DEF. Let me abandon the sample
example for an actual example.
An actual XML node is like this...
<op>pow(<in>2.0, -3</in>)</op>
...in which the ABC corresponds to 'pow(' and the DEF corresponds to ')'.
To experiment, I simplified my actual template all the way down to just this...
<xsl:template match="op"> <xsl:value-of select="op/text()"/> </xsl:template>
The select="op/text()" lost ALL of the text, but "../op/text()" and "node()" got as much as the 'pow(' but still lost the ')'
...the index in square brackets does the trick.
<(+)__ Gan Uesli Starling ((__/)=- Kalamazoo, MI, USA `||` ++ http://starling.us
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] Selecting text bisected b, Mike Haarman | Thread | Re: [xsl] Selecting text bisected b, Mike Haarman |
Re: [xsl] Character entities in att, mark_fletcher | Date | [xsl] Dynamic recognition of elemen, Hrishikesh Korde |
Month |