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

Empty nodes AND attributes stripping - I'm so lost

Subject: Empty nodes AND attributes stripping - I'm so lost
From: "Kevinjohn Gallagher" <web_design_guru@xxxxxxxxxxx>
Date: Thu, 02 Sep 2004 16:25:52 +0100
xml empty attribute
ORIGINAL :

<?xml version="1.0" encoding="UTF-16"?>
<parent>
	<myContent>
		<url></url>
		<headline>This is a test.</headline>
		<abstract>An Abstract.</abstract>
		<media src="a.gif" caption="" />
	</myContent>
	<myContent>
		<url></url>
		<headline></headline>
		<abstract></abstract>
	</myContent>

<myContent>
<something attr="" attribute="data" anotherattribute="data"> SomeData</something>
<somethingElse>
<emptychild />
</somethingElse>
<somethingElse>
<child> With Data </child>
</somethingElse>
</myContent>
</parent>




SHOULD BECOME :

<?xml version="1.0" encoding="UTF-16"?>
<parent>

	<myContent>
		<headline>This is a test.</headline>
		<abstract>An Abstract.</abstract>
		<media src="a.gif" />
	</myContent>


<myContent />



<myContent> <something attribute="data" anotherattribute="data"> SomeData</something> <somethingElse> <child> With Data </child> </somethingElse> </myContent>

</parent>








Ok, so I have an XML file, where I can have any number of myContent's, which can have any number of Children (and they can have children).


Basically, I want to strip all EMPTY nodes and EMPTY attributes.

I've got the empty node stipping fine, but the attributes is an issue (i don't know the names or how many there will be).

Especially as a node can hold no data or children, but can have an attribute with data, so I need to keep it.

Also, the myContent tags need to stay.

I'm really really lost. This seems to be like it should be simple. :(

Can anyone help?


Thanks ALot


Bryan.

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.