[Home] [By Thread] [By Date] [Recent Entries]
At 06:25 AM 9/25/2007, Mike Kay wrote:
This is because "a/b/c" is a relative path expression, which starts at the context node, which here is the current node (the node matching the template, which would be each 'b' element as it is matched). "a/b/c" could also be written "child::a/child::b/child::c" (the long syntax), which has the virtue of making very clear what is happening, while of course being more verbose. In contrast to a relative path, an absolute path such as "/a/b/c" would not navigate from the current node, but from the root of the document. But of course this would retrieve all 'c' elements inside 'b' elements inside 'a' element children of the root (document node), not just 'c' elements inside the particular 'b' element you happen to be matching. The notion of processing context, and (along with it) node selection using relative paths, is closely entangled with the processing model's notion of template matching, and a great part of what enables it to work so nicely. Indeed, <xsl:apply-templates/> (in the built-in templates and elsewhere) is short for <xsl:apply-templates select="child::node()"/> ... i.e., selecting all the child nodes of the node (element) matched, using a relative path. Cheers, Wendell
|

Cart



