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

Re: Fwd: XSL question

Subject: Re: Fwd: XSL question
From: Peter Flynn <peter@xxxxxxxxxxx>
Date: Mon, 19 Mar 2001 22:47:47 +0000
xsl test tag pr sence
On Sun, 03 Jan 1904, Tony Felik wrote:
> How can I handle two empty tags?
> for example:
> 
> <xsl:if test="Invoicing/Customer/state[.!=''] and 
> Invoicing/Customer/country[.!='']">
> 
> (if both the country and the state are empty tags).
> By "empty" I meant: </state> a tag without text.

I hope you mean <state/> because the end-tag </state> cannot
exist without a start-tag, which would imply it was not declared
EMPTY. You can't change the meaning of "empty": it has a very
specific predefined meaning in XML.

If I understand you right, you want to test for the presence or
absence of an element which is declared EMPTY (ie you know from
a DTD that the element is permitted at that point, you just want
to find out if it's there in this file). To do this, use just
<xsl:if test="Invoicing/Customer/state">...</xsl:if>

You only have to test for presence, because empty elements can't
have content anyway (it's different with elements which may have
text content, because sometimes you want to distinguish between
the presence/absence of such an element, and whether or not it
contains some text. But in your case this doesn't apply.)

///Peter

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


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.