[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

Re: [xsl] best boolean practice


Subject: Re: [xsl] best boolean practice
From: "G. Ken Holman" <gkholman@xxxxxxxxxxxxxxxxxxxx>
Date: Tue, 30 Jul 2013 14:04:18 -0400

At 2013-07-31 03:54 +1000, Terence Kearns wrote:
Just a quickie. I'm writing some code to produce XML which will later
be transformed and selected on, and I am wondering what will be the
best way to represent boolean values as far as XSL designers are
concerned?

value="yes"
value="true"
value="1"

does it even make a difference at all?

If you are using schema validation, then in the lexical space "1" and "true" represent true(), and "0" and "false" represent false() ... nothing else.


If you are not using schema validation, consider your audience and consider the concept.

Then consider how the concept is presented to the audience:

masked="true"

or:

is-masked="yes"

but there is nothing really wrong with:

masked="yes"

I'm thinking attributes will definitely be more intuitive than
elements. Am I right?
So this is not quite as good <value>yes</value> (certainly uses up
more characters).

Depends really on how you've represented other concepts in your document model. Being consistent to your users is, to me, the governing factor since you can put a string value in either an attribute or an element. Do you use attributes for other unstructured string values?


There really isn't a right or wrong way ... consider how your choice will be accepted by your XML users and put the burden on your stylesheet writers to accommodate that.

I hope this helps.

. . . . . . . Ken

--
Public XSLT, XSL-FO, and UBL classes in the Netherlands     Oct 2013 |
Public XSLT, XSL-FO, UBL and code list classes in Australia Oct 2013 |
Contact us for world-wide XML consulting and instructor-led training |
Free 5-hour lecture: http://www.CraneSoftwrights.com/links/udemy.htm |
Crane Softwrights Ltd.            http://www.CraneSoftwrights.com/s/ |
G. Ken Holman                   mailto:gkholman@xxxxxxxxxxxxxxxxxxxx |
Google+ profile: https://plus.google.com/116832879756988317389/about |
Legal business disclaimers:    http://www.CraneSoftwrights.com/legal |


Current Thread
Keywords