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

Re: XSLT: question re testing for possibly empty eleme

Subject: Re: XSLT: question re testing for possibly empty elements
From: David Carlisle <davidc@xxxxxxxxx>
Date: Tue, 17 Aug 2004 10:05:14 +0100
xslt if empty
  test="string-length(anElement) &gt; 0">

that is the same as 

  test="string-length(anElement)">


and tests if the string length is non zero

so <anElement/> and <anElement><x/><y/></anElement> are both false and
<anElement>z</anElement> is true


  But couldn't you rewrite that as

  <xsl:when test="anElement">

No that tests if teh element is there so all the 
so <anElement/>  <anElement><x/><y/></anElement>  and
<anElement>z</anElement> are all true

Probably intended meaning is


  test="anElement/node()">


which tests if the element has children so

so <anElement/> is false and a<anElement><x/><y/></anElement> and <anElement>z</anElement> are true

David

________________________________________________________________________
This e-mail has been scanned for all viruses by Star Internet. The
service is powered by MessageLabs. For more information on a proactive
anti-virus service working around the clock, around the globe, visit:
http://www.star.net.uk
________________________________________________________________________

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.