|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] RE: (correction) differences between x != 0 and
One could also add up the values. If the sum is greater than 0, then one
of the items was greater than 0.
<xsl:if test="sum(row/x) > 0)">
<!-- Do something here -->
</xsl:if>
Just a thought.
Jay Bryant
Bryant Communication Services
(presently consulting at Synergistic Solution Technologies)
"Bondarenko, Taras" <TBondarenko@xxxxxxxx>
06/08/2005 09:27 AM
Please respond to
xsl-list@xxxxxxxxxxxxxxxxxxxxxx
To
<xsl-list@xxxxxxxxxxxxxxxxxxxxxx>
cc
Subject
RE: (correction) differences between x != 0 and not(x = 0)
The biggest difference with not() is that it will first check for
existence the node and might fail on that account - not because the values
are different.
But I think you can do a simpler test for your needs - how about this:
<xsl:if test="count(row/x[. != 0]) > 0)">
<xsl:message>Error<xsl:message>
</xsl:if>
-----Original Message-----
From: Jaime Stuardo [mailto:jstuardo@xxxxxxxxxxx]
Sent: Wednesday, June 08, 2005 10:12 AM
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Subject: (correction) differences between x != 0 and not(x =
0)
Sorry, this is what to accomplish:
1.
<row>
<x>0</x>
</row>
<row>
<x>4</x>
</row>
<row>
<x>0</x>
</row>
The test should return FALSE
2.
<row>
<x>0</x>
</row>
<row>
<x>0</x>
</row>
<row>
<x>0</x>
</row>
The test should return TRUE.
That is, when ALL nodes have value of 0, I have to do something, and when
at least one x has a value different from 0, I want to do other thing. I
want to use <xsl:if>, not <xsl:choose>
Thanks
Jaime
-----Mensaje original-----
De: Jaime Stuardo
Enviado el: Miircoles, 08 de Junio de 2005 10:03
Para: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Asunto: differences between x != 0 and not(x = 0)
Hi all..
I always forgot this thing.
If I want to test that all nodes has value different from 0, I have to
use x!=0 or not(x=0) ?
For example,
<row>
<x>0</x>
</row>
<row>
<x>4</x>
</row>
<row>
<x>0</x>
</row>
The test for the above example should return TRUE.
<row>
<x>0</x>
</row>
<row>
<x>0</x>
</row>
<row>
<x>0</x>
</row>
The test for the above example should return FALSE.
Thanks
Jaime
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|

Cart








