My first instinct is to write a template for just about everything, but it
occurred to me that you may need a different approach. So, here are two
other ways:
<xsl:template match="parent">
<xsl:value-of select="text()"/>
</xsl:template>
<xsl:template match="/">
<xsl:value-of select="//parent/text()"/>
</xsl:template>
The second is closest to your original, I think. (By the way, try to avoid
that // path if you can - it can be very inefficient.)
Jay Bryant
Bryant Communication Services
(presently consulting at Synergistic Solution Technologies)
"Hiral Parikh" <hparikh(_at_)amesondemand(_dot_)com>
02/09/2005 04:21 PM
Please respond to
xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
To
<xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com>
cc
Subject
[xsl] Choosing specific XML node with XSL
Hi,
I am dealing with some dynamically generated XML and ran into some XSL
parsing issues.
The XML is something like this:
<parent>this is parent text
<child1><child2>this is child text</child2></child1>
</parent>
I want the text of <parent> only, but
<xsl:value-of select = "//parent/"/> returns 'this is parent text this is
child text'.
How can I get only the text of <parent> tag and not the <child1><child2>
tag.
Thanks in advance,
Hiral
--~------------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--
--~------------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--