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

Adding Missing Elements

Subject: Adding Missing Elements
From: "Emerson, Matt" <Matt.Emerson@xxxxxxx>
Date: Tue, 13 Sep 2005 12:01:35 -0400
 Adding Missing Elements
Hello,

I wanted to get some opinions on the best way of doing something in xsl.

I have an element <node> which has a certain set of attributes and child
nodes that will always be there.  However, it has an additional <list>
child element, that may or may not be present with varying child
elements so <node> could have variations like this...

<wrapper>
	<node id1="5" id2="bar">
		<name>myname</name>
		<value>myvalue</value>
	</node>
</wrapper>

<wrapper>
	<node id1="5" id2="bar">
		<list/>
		<name>myname</name>
		<value>myvalue</value>
	</node>
</wrapper>

<wrapper>
	<node id1="5" id2="bar">
		<list>
			<item>A</item>
		</list>
		<name>myname</name>
		<value>myvalue</value>
	</node>
</wrapper>

<wrapper>
	<node id1="5" id2="bar">
		<list>
			<item>A</item>
			<item>B</item>
		</list>
		<name>myname</name>
		<value>myvalue</value>
	</node>
</wrapper>

Given these possible variations and based on some processing elsewhere
in the document, I would like to make sure that <node> always has
<item>B</item> in its list...possibly adding <list> if it is not
present.

Can someone give me some suggestions on the best way to do this?

Thanks,

Matt

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.