RE: [xsl] omitting empty elements when copying

Subject: RE: [xsl] omitting empty elements when copying
From: "Michael Kay" <michael.h.kay@xxxxxxxxxxxx>
Date: Wed, 5 Feb 2003 12:51:43 -0000
You can do <xsl:copy-of select="*[child::node()]"/>

Michael Kay
Software AG
home: Michael.H.Kay@xxxxxxxxxxxx
work: Michael.Kay@xxxxxxxxxxxxxx 

> -----Original Message-----
> From: owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx 
> [mailto:owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx] On Behalf Of 
> Hesselberth, Jan
> Sent: 05 February 2003 11:56
> To: 'XSL-List@xxxxxxxxxxxxxxxxxxxxxx'
> Subject: [xsl] omitting empty elements when copying
> 
> 
> I know this must be in the archives somewhere but I can't 
> find it. I have the following xml
> 
> 	<CUSTOMERDATA>
> 		<Applicnt>
> 			<AT_Client_No>1</AT_Client_No>
> 			<AT_Mf_Client_No/>
> 			<AT_New_Mf_Cust_No/>
> 			<AT_Surname>Smith</AT_Surname>
> 			<AT_Initials>BG</AT_Initials>
> 			<AT_Forename_1>Bob</AT_Forename_1>
> 			<AT_Forename_2></AT_Forename_2>
> 			<AT_Display/>
> 			<AT_Title_Seq>1</AT_Title_Seq>
> 			<AT_Date_Of_Birth>12/03/1963
> 00:00:01</AT_Date_Of_Birth>
> 			<AT_Age_Now/>
> 		</Applicnt>
> 	<CUSTOMERDATA>
> 
> I want to copy only the elements with content to get
> 
> 	<CUSTOMERDATA>
> 		<Applicnt>
> 			<AT_Client_No>1</AT_Client_No>
> 			<AT_Surname>Smith</AT_Surname>
> 			<AT_Initials>BG</AT_Initials>
> 			<AT_Forename_1>Bob</AT_Forename_1>
> 			<AT_Forename_2></AT_Forename_2>
> 			<AT_Title_Seq>1</AT_Title_Seq>
> 			<AT_Date_Of_Birth>12/03/1963
> 00:00:01</AT_Date_Of_Birth>
> 		</Applicnt>
> 	<CUSTOMERDATA>
> 
> Is there an efficient way of doing this or do I have to test 
> for there being content in each element and then use 
> xsl:copy? I had hoped there may be a way to do it with xsl:copy.
> 
> Regards
> 	Jan
> 
> 
> 
> 
> --------------------------------------------------------------
> ------------ 
> CONFIDENTIALITY 
> The information contained in this e-mail and any files 
> transmitted with it 
> is private and confidential. It is intended for the named 
> addressee only. 
> If you are not the intended addressee you are prohibited from 
> storing, copying or using the information in any way. 
> If you received this e-mail due to a transmission error 
> please notify the 
> sender immediately. No liability is accepted by Northern Rock 
> for any losses caused by viruses contracted during transit 
> over the Internet or present in any receiving system. 
> This e-mail is not intended to create legally binding commitments on 
> behalf of Northern Rock plc, nor do its contents reflect the 
> corporate 
> views or policies of Northern Rock plc. 
> --------------------------------------------------------------
> ------------ 
> 
> 
> This message has been checked for all email viruses by the 
> Energis NetscanCentral solution.
> 
>  XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
> 
> 


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread