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

Re: How to remove (in addition) empty attributes?

Subject: Re: How to remove (in addition) empty attributes?
From: Syd Bauman <Syd_Bauman@xxxxxxxxx>
Date: Thu, 10 Dec 2009 11:28:34 -0500
Re:  How to remove (in addition) empty attributes?
> are you sure that the (your) line should look like
>  <xsl:template match="*[normalize-space( concat(.,@*) )='']"/>
> and not like
>  <xsl:template match="@*[normalize-space( concat(.,@*) )='']"/>
> Mind the @

I am quite sure I meant to match elements, not attributes, with that
template. I am not at all sure that's what you want, though :-)

I, for one, would probably find it easier to figure out the desired
behavior, here, if you posted a test file input and output. E.g., what
should the output be if the input is

 <?xml version="1.0" encoding="UTF-8"?>
 <wrapper>
   <!-- elements w/o content -->
   <outer></outer>
   <outer maybe=""></outer>
   <outer maybe="a"></outer>
   <!-- elements w/ PCDATA content -->  
   <outer>b</outer>
   <outer maybe="">b</outer>
   <outer maybe="b">b</outer>
   <!-- elements w/ an empty child element -->
   <outer><inner/></outer>
   <outer maybe=""><inner/></outer>
   <outer maybe="c"><inner/></outer>
   <!-- elements w/ a child element that has PCDATA content -->
   <outer><inner>d</inner></outer>
   <outer maybe=""><inner>d</inner></outer>
   <outer maybe="d"><inner>d</inner></outer>
   <!-- empty comment -->
   <!---->
   <!-- PIs -->
   <?syd the next PI is empty?>
   <?syd?>
 </wrapper>

(There may be situations I haven't taken into account for you, here:
it's the idea that counts.)

Note that Michael has since pointed out that the "concat(.,@*)"
construction (which I just copied from somewhere else in the
discussion) does not do what I thought it did. See
http://www.biglist.com/lists/lists.mulberrytech.com/xsl-list/archives/200912/msg00138.html.

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.