[xsl] Checking for empty elements

Subject: [xsl] Checking for empty elements
From: <mlcook@xxxxxxxxxx>
Date: Wed, 7 Oct 2009 15:04:33 -0400
Is there a way using XSLT 2.0 to determine whether an element has no
attributes present
in an XML document?

Say, given the type, with default values:

<xs:complexType name="TimeType">
    <xs:attribute name="day" type="xs:unsignedByte" default="0"/>
    <xs:attribute name="hour" type="xs:unsignedByte" default="0"/>
    <xs:attribute name="minute" type="xs:unsignedByte" default="0"/>
    <xs:attribute name="second" type="xs:unsignedByte" default="0"/>
</xs:complexType>

And an element definition of that type:

<xs:element name="time" type="myown:TimeType"/>

Is there an <xsl:if test=... /> to determine the difference between the
empty element (which will have default attribute values if processed)
<time />
and an element with explicit attributes, for example,
<time hour="5" minute="27" />

I'm trying to not process the empty <time /> element.

Thanks, Mike


This email and any attachments are only for use by the intended recipient(s)
and may contain legally privileged, confidential, proprietary or otherwise
private information.  Any unauthorized use, reproduction, dissemination,
distribution or other disclosure of the contents of this e-mail or its
attachments is strictly prohibited.  If you have received this email in error,
please notify the sender immediately and delete the original.

Current Thread