468,780 Members | 2,357 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,780 developers. It's quick & easy.

<xsl:if> problem

I tried to do this :
<xsl:if test="ToutCompris">
some output
</xsl:if>

ToutCompris is a boolean element in my XML file

My problem is the output is parse even when ToutCompris is false
I tried <xsl:if test="ToutCompris = true"> and it does'nt work
either

What's the right way to do this ?

----== Posted via Newsfeed.Com - Unlimited-Uncensored-Secure Usenet News==----
http://www.newsfeed.com The #1 Newsgroup Service in the World! >100,000 Newsgroups
---= 19 East/West-Coast Specialized Servers - Total Privacy via Encryption =---
Nov 12 '05 #1
2 1585
websls wrote:
I tried to do this :
<xsl:if test="ToutCompris">
some output
</xsl:if>

ToutCompris is a boolean element in my XML file


XSLT 1.0 doesn't support XSD schema types.

Try

<xsl:if test="ToutCompris='true' or ToutCompris='1'">
--
Oleg Tkachenko [XML MVP, XmlInsider]
http://blog.tkachenko.com
Nov 12 '05 #2
>I tried to do this :
<xsl:if test="ToutCompris">
some output
</xsl:if>

ToutCompris is a boolean element in my XML file


What do you mean by "boolean element"? As far as I know, everything in
a XML file is pretty much text strings only.

What does your <ToutCompris> element look like exactly?

If it's something like

<ToutCompris>true</ToutCompris>

then your check would have to be:

<xsl:if test="ToutCompris = 'true'">

Put the 'true' in single quotes, to tell XSL it's a string you're
comparing to - otherwise, it'll look for a XPath expression called
"true" (and won't find anything).

Marc

Nov 12 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

3 posts views Thread by Blaise Garant | last post: by
5 posts views Thread by Luke Vogel | last post: by
5 posts views Thread by ina | last post: by
reply views Thread by zhoujie | last post: by
2 posts views Thread by Marin | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.