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

Conditional expressions using optional attributes/elem

Subject: Conditional expressions using optional attributes/elements
From: William Bagby <williamb@xxxxxxxxx>
Date: Mon, 13 Aug 2001 09:23:56 -0400
conditional expressions in xsl
Greetings.  I have two related problems.

Problem 1:

I have an element which has optional attributes, and I want to test the
values of these attributes.  Here's the DTD for the element:

<!ELEMENT my-element (#PCDATA)>
<!ATTLIST my-element
	enabled (true|false) #IMPLIED
	override (true|false) #IMPLIED
>


and I have the following XSL:

<xsl:template match="my-element">

<xsl:if test="@enabled != 'false' and @override != 'false'">
	<!-- do something -->
</xsl:if>

</xsl:template>

But if the attributes are not defined, it doesn't act as expected.

Problem 2:

I have an element which has optional *elements*, and I want to test the
values of attributes of these elements.  Here's the DTD:

<!ELEMENT my-element (enabled*, override*)>
<!ATTLIST enabled
	value (true|false) #IMPLIED
>
<!ATTLIST override
	value (true|false) #IMPLIED
>

and I have the following XSL:

<xsl:template match="my-element">

<xsl:if test="enabled/@value != 'false' and override/@value != 'false'">
	<!-- do something -->
</xsl:if>

</xsl:template>

But if the *elements* are not defined, it doesn't act as expected.

What am I doing wrong?

Thanks in advance...


William Bagby.

 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.