Excellent. Thank you I will do so.
-Steve
On Nov 8, 2007 2:14 PM, Scott Trenda <Scott(_dot_)Trenda(_at_)oati(_dot_)net>
wrote:
Hey Steve,
Looks like you've solved the problem, but here's a quick pointer. Start
learning to avoid !=, and start using not() instead. Since comparison
operators on node-sets are combinatoric, your first comparison says "if
there are any preceding-sibling::activity nodes that ARE NOT equal to my
child::activity node", instead of "if there are NOT any
preceding-sibling::activity nodes equal to my child::activity node",
which is what I believe you're intending. Use the following XPath
instead:
Rec[not(activity = preceding-sibling::Rec/activity)]
not() is usually the safest bet, especially when node-sets come into the
mix.
~ Scott
-----Original Message-----
From: Steve [mailto:subsume(_at_)gmail(_dot_)com]
Sent: Thursday, November 08, 2007 12:17 PM
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: Re: [xsl] Template matching preceding-sibling.
I'm sorry, but isn't the first <Rec> in my XML the preceding-sibling
of the second <Rec> ?
-Steve
On Nov 8, 2007 1:13 PM, <cknell(_at_)onebox(_dot_)com> wrote:
Your template matches both <Rec> elements, so you get two instances of
"Ello xslers." in your output.
Your template matches and <Rec> element with an <activity> child
element that doesn't have preceding-sibling <Rec>. Since both <Rec>
elements have <activity> child elements, and since none of the
<activity> elements has a preceding-sibling of ANY kind, you are
matching both <Rec>s.
--
Charles Knell
cknell(_at_)onebox(_dot_)com - email
-----Original Message-----
From: Steve <subsume(_at_)gmail(_dot_)com>
Sent: Thu, 8 Nov 2007 12:59:01 -0500
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: [xsl] Template matching preceding-sibling.
I'm missing something fundamental, what is it?
<xsl:template match="Rec[activity != preceding-sibling::Rec/activity
or not(preceding-sibling::Rec)]">
Ello xslers.
</xsl:template>
<xml>
<Rec>
<activity>hi</activity>
</Rec>
<Rec>
<activity>hi</activity>
</Rec>
</xml>
----
Above should only print anything once, but I'm getting it each time.
What am I not getting?
-Steve
--~------------------------------------------------------------------
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>
--~--
--~------------------------------------------------------------------
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>
--~--
--~------------------------------------------------------------------
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>
--~--