Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


[xsl] Empty nodes AND attributes stripping - I'm so lost

From: "Kevinjohn Gallagher" <web_design_guru@----------->
To:
Date: 9/2/2004 3:27:00 PM
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.


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