Subject: Re: [xsl] node selection problem From: Wendell Piez <wapiez@xxxxxxxxxxxxxxxx> Date: Wed, 10 Mar 2004 11:46:47 -0500 |
Good luck, Wendell
Hi,
I would like to retrieve all the nodes "X" inside one node, but before another node. The second node is always a descendant of the first node.
book +-- chap +-- chap <== inside this node +-- X <== select this node +-- sect +-- X <== select this node +-- sub <== but before this node +-- X <== i.e. do not select this X node +-- sub ... +-- sect +-- sect ... +-- chap ...
This example is somewhat simplified, of course. Currently, my best bet is this:
<xsl:variable name="inside.this.node" select="/book/chap[2]"/> <xsl:variable name="before.this.node" select="$inside.this.node/sect[1]/sub[1]"/
<xsl:variable name="the.X.nodes" select="$before.this.node/preceding::X[ ancestor::*[@ID=$inside.this.node/@ID] ]" />
This method doesn't seem very efficient given that it must first select all preceding X nodes, and then filters this nodeset using the predicate that matches ID values.
As I have to do this many times over a big document, I would be interested in better ways.
====================================================================== 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 ======================================================================
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
RE: [xsl] node selection problem, Michael Kay | Thread | [xsl] Dsiplayig xml in tables, Phillip Nicolson |
Re: [xsl] Trouble with namespaces a, Wendell Piez | Date | Re: [xsl] Trouble with namespaces a, David Carlisle |
Month |