[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

returning nodes which have a specific child

Subject: returning nodes which have a specific child
From: jim mcgovern <jim.mcgovern2@xxxxxxxxxxxxxx>
Date: Wed, 1 Jul 2009 09:06:00 +0100
 returning nodes which have a specific child
Hi All

Hopefully someone can assist me in something that I thought would be
trivial but I'm obviously missing something.  What I need to do is
return a set of nodes that contain a certain child node.  In the case
below I need to return all the nodes that contain a child node which
have a name of "CONTENT".

So my initial xml is :-

<folder name="dir1" id="x1">
	<folder name="dir2" id="x2">
		<folder name="CONTENT" id="x3"></folder>
		<folder name="dir4" id="x4">
			<folder name="dir5" id="x5">
				<folder name="CONTENT" id="x3"></folder>
				<folder name="dir6" id="x6">
					<folder name="dir7" id="x7">
						<folder name="dir8" id="x8"></folder>
						<folder name="dir9" id="x9"></folder>
						<folder name="CONTENT" id="x10"></folder>
					</folder>
				</folder>
			</folder>
		</folder>
	</folder>
</folder>

And what I need to end up with is:-

<folder name="dir2" id="x2">
	<folder name="dir5" id="x5">
		<folder name="dir7" id="x7">
		</folder>
	</folder>
</folder>

It's important that the xml is nested as above which is the part I'm
having trouble with.  I'm sure there's something obvious I'm
missing...anyone got an example xsl that would do this or some
pointers would be appreciated?

Many thanks

jim

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.