Re: data translation => descendants appear side by sid
I'm afraid I didn't track the start of this thread, but there is a common "gotcha" here, and I think you're right, you may be observing a buglet in Xalan.
(.//description)[$pos] is an expansion of
(./descendant-or-self::node()/child::description)[position()=$pos] translates into English as
From the context node, collect all descendant description elements (i.e. all description elements that are children of the context node or its descendants), and of that set take the one in $pos position in document order.
./descendant-or-self::node()/child::description[position()=$pos] translates as
From the context node, collect all description elements that are children of the context node or its descendants, and take those that are in $pos position *as children of their parents* (i.e. among their siblings).
Note that the presence of the parentheses grouping operator in the first case is critical, since it collects all those children and filters them as a group; whereas in the second case, the predicate operates only on the last step, 'child::description[position()=$pos]'.
Does that help clarify or confirm? It was tough enough for me to internalize this distinction when I was learning XPath that it stuck. I hope.
At 09:25 AM 5/4/2002, you wrote:
I searched for a different and more general approach (not limited to 2 base elements). The stylesheet is quite short:
====================================================================== Wendell Piez mailto:wapiez@xxxxxxxxxxxxxxxx Mulberry Technologies, Inc. http://www.mulberrytech.com 17 West Jefferson Street Direct Phone: 301/315-9635 Suite 207 Phone: 301/315-9631 Rockville, MD 20850 Fax: 301/315-8285 ---------------------------------------------------------------------- Mulberry Technologies: A Consultancy Specializing in SGML and XML ======================================================================
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
PURCHASE STYLUS STUDIO ONLINE TODAY!
Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!
Download The World's Best XML IDE!
Accelerate XML development with our award-winning XML IDE - Download a free trial today!
Subscribe in XML format