Win a copy of High Performance Python for Data Analytics this week in the Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Bear Bibeault
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Jj Roberts
  • Carey Brown
Bartenders:
  • salvin francis
  • Frits Walraven
  • Piet Souris

Not equals to operator not working for when condition in xslt

 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

I'm writing below each condition  in my different xslt's based on requirement but not equals to operator is not working as expected. Can someone help me where am I doing wrong ?





 
Ranch Hand
Posts: 732
7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You're testing for the impossible. It is always false.

Whether you've in mind this, I cannot be sure.
 
Ranch Hand
Posts: 97
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You haven't shown us what's in the variables.Rather surprisingly perhaps,
can be true, for example when the value of $storeid is the sequence (1, 2). But it would be a little odd to name the variable storeid if it can hold a sequence of integers. So I suspect that's not what you intended.

The expression
seems even less plausible. If $Type is an empty sequence, then the result will be false (because ()!='B1' is false, and ()!='B1' is also false). In all other cases the expression will be true:
 
Marshal
Posts: 26310
80
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Good point... if $Type is a node set then, well, the way that the = and != operators work on XSLT node set is maybe not how you think it works.

One node set is = another node set if there's any node in the first set which is equal to some node in the second set. And one node set is != another node set if there's any node in the first set which is not equal to some node in the second set. So, in particular != is not the negation of = when applied to node sets.

So you might want to check whether those variables are single values or whether they are node sets.

 
g tsuji
Ranch Hand
Posts: 732
7
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yes, I would only supplement that by mentioning that sequence is a type introduced in xslt 2. One would need an xslt2 compliant processor to process the transformation.
 
reply
    Bookmark Topic Watch Topic
  • New Topic