Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


Re: How to get boolean (true/false) values as boolean variables?

From: "Anthony Jones" <Ant@------------.--->
To: NULL
Date: 9/15/2007 1:44:00 PM

"David Lowndes" <DavidL@e...> wrote in message
news:7gvle3hb6skovc69uflv52k4p85dvav32f@4......
> Currently I have an XML file with what are really boolean attribute
> values being passed numerically as 0 or 1:
>
> <MyElem flag="1"/>
>
> and in the XSLT I get the value like this:
>
>   <xsl:param name='MyFlag'
> select='number($MyDocument/MyDoc/MyElem/@flag)' />
>
> It's more appropriate if I represent the flag as a boolean:
>
> <MyElem flag="true"/>
>


Why?

I use 0 and -1.  These are the values that I find implicit coerce to boolean
the best in majority of languages I use.

> .. but I can't find what the equivalent would be to get the boolean
> value variable in the XSLT.
>
> Is there a way of doing what I want?

An alternative is simply not have the flag element present at all in the XML
if its value is to be treated as false.  I find that to be the most XSL
friendly approach.

-- 
Anthony Jones - MVP ASP/ASP.NET




transparent
Print
Mail
Like It
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent