Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


[xsl] returning nodes which have a specific child

From: jim mcgovern <jim.mcgovern2@----------.--->
To: xsl-list@-----.------------.---
Date: 7/1/2009 8:06:00 AM
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

--~------------------------------------------------------------------
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@l...>
--~--



transparent
Print
Mail
Like It
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent