473,978 Members | 2,139 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Are there 'Null' and 'not equal to' test?

Are there 'Null' and 'not equal to' operator that I can use in xsl:if
statements? I assume that there must be, but I can't figure out the
syntax.

For example:

<xsl:if test="@title DOES NOT EQUAL 'Little Red Riding
Hood'"><xsl:val ue-of select="@title" ></xsl:if>

and

<xsl:if test="books/humor IS NULL">Category is empty.</xsl:if>
Thanks,

-James

Jul 20 '05 #1
1 29201
Porthos wrote:
Are there 'Null' and 'not equal to' operator that I can use in xsl:if
statements?
<xsl:if test="@title"> means "true if the title attribute is specified"
(either physically present or given as a default in the DTD/Schema)

<xsl:if test="@title != 'foo'"> is the inequality operator
I assume that there must be, but I can't figure out the syntax.


Did you try reading the XSLT spec? Sec 9.1 Conditional Processing with
xsl:if has a link to the relevant section of XPath, productions 14 and
21-24, which include the inequality operator:

[23] EqualityExpr ::= RelationalExpr
| EqualityExpr '=' RelationalExpr
| EqualityExpr '!=' RelationalExpr

Finding the existence syntax is admittedly a little more tricky: it's
implicit in the handling of node-sets and Boolean values: "a node-set
is true if and only if it is non-empty", so a test for a (non-existent)
title attribute will return False.

///Peter
--
"The cat in the box is both a wave and a particle"
-- Terry Pratchett, introducing quantum physics in _The Authentic Cat_
Jul 20 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
13900
by: sam | last post by:
For Example, If I delete two times like the below code, the program will behave differently. is this correct? As C++ FAQ the delete checks where or not f1 has memory. How can the following program can go wrong? class foo{ // }; int main{ foo *f1 = new foo()
102
6168
by: junky_fellow | last post by:
Can 0x0 be a valid virtual address in the address space of an application ? If it is valid, then the location pointed by a NULL pointer is also valid and application should not receive "SIGSEGV" ( i am talking of unix machine ) while trying to read that location. Then how can i distinguish between a NULL pointer and an invalid location ? Is this essential that NULL pointer should not point to any of the location in the virtual address...
17
11030
by: cmay | last post by:
In VB you can test if a value type has the "default" value by doing the following: dim i as integer if (Nothing = i) then '* i is really 0 end if Now, when I try to do this in C# of course it doesn't work because you can't
64
4045
by: yossi.kreinin | last post by:
Hi! There is a system where 0x0 is a valid address, but 0xffffffff isn't. How can null pointers be treated by a compiler (besides the typical "solution" of still using 0x0 for "null")? - AFAIK C allows "null pointers" to be represented differently then "all bits 0". Is this correct? - AFAIK I can't `#define NULL 0x10000' since `void* p=0;' should work just like `void* p=NULL'. Is this correct?
3
1853
by: tshad | last post by:
I have a query that is returning a null and I am testing for null. The value being sent back is a varChar(11) from Sql Server. If I do the query from Query Analyser I get NULL returned. But if I run the following: ************************************************************ dbReader = myDbObject.RunProcedure("GetNewHire", parameters); if (dbReader.Read()) { if (dbReader == null)
17
4557
by: Mark A | last post by:
DB2 8.2 for Linux, FP 10 (also performs the same on DB2 8.2 for Windoes, FP 11). Using the SAMPLE database, tables EMP and EMLOYEE. In the followng stored procedure, 2 NULL columns (COMM) are selected into 2 different SP variables and compared for equal. They are both NULL, but do not compare as equal. When the Not NULL columns (SALARY) are compared, they do compare as equal.
23
7460
by: sandy | last post by:
I need (okay, I want) to make a dynamic array of my class 'Directory', within my class Directory (Can you already smell disaster?) Each Directory can have subdirectories so I thought to put these in an array. The application compiles but aborts without giving me any useful information. What I suspect is happening is infinite recursion. Each Directory object creates an array of Subdirectories each of which has an array of...
13
2584
by: Paul Lautman | last post by:
I have the following switch statement: switch ($record->sub_page) { case -1: $this->page = 6; $error_message = '<center>You appear to have already completed the form.</center>'; break; case 0: $this->page = 5;
6
5600
by: Java script Dude | last post by:
Small glitch (IMHO) in JavaScript is related to isNaN() boolean function. If passed a null, it returns true which is incorrect. This one cause me quite a bit of grief until I detected it and was able to code around it. Anybody know the reasoning for the result being false and not true for isNaN(null). - JsD
0
10357
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10175
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
11827
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
11417
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
10920
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6423
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
6562
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
5162
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
4736
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.