xsl-list
[Top] [All Lists]

Re: [xsl] Compact XPath syntax

2007-12-26 05:47:59
Writing a bit late to this thread ...

On Dec 20, 2007 5:14 AM, Ramkumar Menon 
<ramkumar(_dot_)menon(_at_)gmail(_dot_)com> wrote:
Consider another XML.

<a>
 <b>
    <c>
 </b>
 <f>
    <c>
 </f>
</a>
I could refer to the node "c" as "!c", which matches all "c" nodes at
all levels. I specify something on the lines of  !c[parent::b] or
!c[parent::f] to address the respective "c" nodes.

Personally speaking, I find XPath capabilities to address parts of XML
document fine. To my opinion, it's a great language in fact.

In XPath, we write XPath expressions to reach nodes from a context
node. We can use various axes and node types provided, in our
expressions.

Incidentally, for the above example, I would write the expression as:
//c[parent::b]
//c[parent::f]
(in these examples, we filter nodes using a predicate).

or //c (if you want to select all 'c' elements everywhere in the tree).


-- 
Regards,
Mukul Gandhi

--~------------------------------------------------------------------
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>
--~--

<Prev in Thread] Current Thread [Next in Thread>