[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: Testing for Missing or Empty Tags
Maybe Rechell wants
<xsl:if test="not(Tag[normalize-space() or *]">...</xsl:if> or the same leaving out the "or *" if she already knows there will never be an element inside the Tag element, or doesn't care if there is. string(Tag), alas, checks to see whether the first Tag element child has a string value (not the empty string). This may or may not be useful depending on the data (do Tag elements appear clustered or are they always alone?). It also doesn't address the empty string issue, and will test true on <Tag> </Tag> (which is not always wanted). Whenever this question comes up, it turns out the answer depends on what the OP means by "empty" elements. If Rechell wants to assure that there is present a Tag child that includes some kind of text not whitespace, not(Tag[normalize-space()] will do that: it checks whether there does (not) exist a Tag element child with a non-empty string value. But David has already pointed out that this will fail on <Tag><some/></Tag>. Only Rechell can say whether that case should be in or out.... :-> Cheers, Wendell At 10:30 AM 1/8/2004, David wrote: XSLT has no access to the tags in the document. ====================================================================== Wendell Piez mailto:wapiez@xxxxxxxxxxxxxxxx Mulberry Technologies, Inc. http://www.mulberrytech.com 17 West Jefferson Street Direct Phone: 301/315-9635 Suite 207 Phone: 301/315-9631 Rockville, MD 20850 Fax: 301/315-8285 ---------------------------------------------------------------------- Mulberry Technologies: A Consultancy Specializing in SGML and XML ====================================================================== XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|
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
|