On 02/08/2011 01:16 AM, Karl Stubsjoen wrote:
Given that <X> is the context node then I expect the previous node is
<B>.
<A>
<B>
<X> this is context node </X>
</B>
</A>
This suggests to me that you are thinking about *tags*, not *nodes*.
B is the ancestor of X, not its predecessor.
This paragraph from XPath 1.0 may help:
NOTE: The ancestor, descendant, following, preceding and self axes
partition a document (ignoring attribute and namespace nodes): they
do not overlap and together they contain all the nodes in the
document.
Others have already pointed out the usefulness of * over node() in your
examples, and the possible utility of the preceding-sibling axis. I
recommend re-reading <URL: http://www.w3.org/TR/xpath/#axes >, or the
more precise but harder to read <URL: http://www.w3.org/TR/xpath20/#axes >.
~Chris
--
Chris Maden, text nerd <URL: http://crism.maden.org/ >
“For a successful technology, reality must take precedence over
public relations, for Nature cannot be fooled.” — R.P. Feynman
GnuPG Fingerprint: C6E4 E2A9 C9F8 71AC 9724 CAA3 19F8 6677 0077 C319
--~------------------------------------------------------------------
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>
--~--