You could probably do this using XSL (though I haven't actually done it) - the way to do it would be to use XPATH to find the nodes you're interested in - and then instead of copying the node from the input to the output, just output the current node name and its attributes without copying it's children. (Using xsl:element and the nodename variable....
Of course, at this point, you're writing code so you just might want to go ahead and do it with DOM (which is relatively straightforward using Java, etc.). Thanks Riz ------------------------------ Riz Virk, (617) 905-3518 [EMAIL PROTECTED], [EMAIL PROTECTED] http://www.xyztechnologies.com -----Original Message----- From: Erhan Baz [mailto:[EMAIL PROTECTED] Sent: Saturday, July 06, 2002 4:39 AM To: xindice-users@xml.apache.org Subject: Re: Retieving parts of documents using XPath on a collection Hi, You can't get this type of result with only Xpath. We faced with the same problem and wrote an application which takes the all document as DOM and eliminates unwanted branches. You must look for this type of solution. Bye.. --- Erick_Brie`re <[EMAIL PROTECTED]> wrote: > (Perhaps my question concerns more Xpath than > Xindice itself... ?) > > Is there a way to get only nodes without their > descendant(s) ? > > I test with these two documents: > > $ cat doc1.xml > <?xml version="1.0"?> > <AAA> > <BBB/> > <CCC value="doc1"> > <DDD/> > <EEE/> > </CCC> > <FFF/> > </AAA> > $ > $ cat doc2.xml > <?xml version="1.0"?> > <AAA> > <BBB/> > <CCC value="doc2"> > <DDD/> > <EEE/> > </CCC> > <FFF/> > </AAA> > > I'd like to get the list of "CCC values", without > having the "DDD" and > "EEE" nodes: > > $ xindice xpath -c /db/test -q '/AAA/CCC' > <?xml version="1.0"?> > <CCC value="doc1" > xmlns:src="http://xml.apache.org/xindice/Query" > src:col="/db/test" > src:key="338c319e664de474000000eedabd3e89"> > <DDD /> > <EEE /> > </CCC> > <?xml version="1.0"?> > <CCC value="doc2" > xmlns:src="http://xml.apache.org/xindice/Query" > src:col="/db/test" > src:key="338c319e664de474000000eedabd99ef"> > <DDD /> > <EEE /> > </CCC> > > What should be the QUERY for having this: > > $ xindice xpath -c /db/test -q QUERY > <?xml version="1.0"?> > <CCC value="doc1" > xmlns:src="http://xml.apache.org/xindice/Query" > src:col="/db/test" > src:key="338c319e664de474000000eedabd3e89"> > </CCC> > <?xml version="1.0"?> > <CCC value="doc2" > xmlns:src="http://xml.apache.org/xindice/Query" > src:col="/db/test" > src:key="338c319e664de474000000eedabd99ef"> > </CCC> > > > NB: probably i didn't anderstand wel the tutorial > http://www.zvon.org/xxl/XPathTutorial/General/examples.html > ... > > Thanks, > Erick. > > > __________________________________________________ Do You Yahoo!? Sign up for SBC Yahoo! Dial - First Month Free http://sbc.yahoo.com
