This set of templates does what you ask, but it is a bad practice to use "xml"
as an element name. Since <result> may be a child of <node> or <diff>, I made a
template that matches either. When I apply-templates from that template I match
every <result>. The output is "123456".:
<xsl:template match="/">
<xsl:apply-templates />
</xsl:template>
<xsl:template match="xml">
<xsl:apply-templates />
</xsl:template>
<xsl:template match="node|diff">
<xsl:apply-templates />
</xsl:template>
<xsl:template match="result">
<xsl:value-of select="." />
</xsl:template>
--
Charles Knell
cknell(_at_)onebox(_dot_)com - email
-----Original Message-----
From: news(_at_)swisslab(_dot_)de
Sent: Mon, 20 Mar 2006 14:15:26 +0100
To: "'xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com'"
<xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com>
Subject: [xsl] descendant-or-self XSLT 1.0
Hello list!
I've got a xml:
<xml>
<node>
<result>1</result>
<result>2</result>
<result>3</result>
<diff>
<result>4</result>
<result>5</result>
<result>6</result>
</diff>
</node>
<node>
...
</node>
...
</xml>
I want to process all result children inside the <node> node. No matter if
they are stored inside <node/> or the descendant <diff/>. I want to handel
the <result/> nodes as one result set. So I m trying not to use two
apply-templates after another.
Example:
<xsl: template match"/">
<xsl:apply templates select="//node"/> </xsl:template>
<xsl:template match="node">
<xsl:apply-templates select="descendant-or-self::result"/>
</xsl:template>
<xsl:template match="result">
<xsl:value-of select="."/>
</xsl:template>
The output WANTED is "123456".
The output I GET is "123"
When trying:
<xsl:apply-templates select="*/result"/> I only get 456.
:(
What Xpath do I have to use in XSLT 1.0 to get ALL <result/>
--~------------------------------------------------------------------
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>
--~--