[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
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 />
</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.
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|