This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Fwd: XSL question


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]