XML Editor
Sign up for a WebBoard account Sign Up Keyword Search Search More Options... Options
Chat Rooms Chat Help Help News News Log in to WebBoard Log in Not Logged in
Show tree view Topic
Topic Page 1 2 3 4 5 6 7 8 9 Go to previous topicPrev TopicGo to next topicNext Topic
Postnext
Ashish PooreSubject: Empty tags in XML
Author: Ashish Poore
Date: 16 Aug 2006 02:43 AM
Originally Posted: 16 Aug 2006 02:37 AM
Hi friends,
I am new to XSLT. Facing some problems with removing empty tags from the xml. Here is the xml sample that I want to transform.

<?xml version="1.0" ?>
<row>
<country tc="1">India</country>
<region/>
<address tc1="f"></address>
<city>Indore</city>
</row>

The condition here is that I don't want to remove the tags that have any attribute in it. In the above case I don't want to remove the <address> tag but <region> tag should be removed.

Thanks in advance,
Ashish

Posttop
Ivan PedruzziSubject: Empty tags in XML
Author: Ivan Pedruzzi
Date: 16 Aug 2006 09:36 PM

Define an identity transformation with the following

<xsl:apply-template select="*[count(@*) &gt; 0]"/>

Hope this helps
Ivan Pedruzzi
Stylus Studio Team

 
Topic Page 1 2 3 4 5 6 7 8 9 Go to previous topicPrev TopicGo to next topicNext Topic
Download A Free Trial of Stylus Studio 6 XML Professional Edition Today! Powered by Stylus Studio, the world's leading XML IDE for XML, XSLT, XQuery, XML Schema, DTD, XPath, WSDL, XHTML, SQL/XML, and XML Mapping!  
go

Log In Options

Site Map | Privacy Policy | Terms of Use | Trademarks
Stylus Scoop XML Newsletter:
W3C Member
Stylus Studio® and DataDirect XQuery ™are from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2016 All Rights Reserved.