tags:

views:

918

answers:

2

What I have is following:

<xsl:variable name="myvar" select=".//spss:category[((not @varName) or @varName=$colVarName) and @text=$series]/spss:cell/@text"/>

What it should do is select the text of the spss:cell's text-Attribute as long as it is a child of a spss:category that has

  • either a varName Attribute with a value equal to $colVarName
  • OR no varName Attribute at all

What is happening is following error message (sorry translating here, so just the gist of it):

Expected Token ')'. Found Token '@'.
.//spss:category[((not -->@<-- varName) or @varName=$colVarName...

Problem Solved! (See below)

+4  A: 

OK, I think I found the mistake:

not must be used with parenthesis, so instead of

(not @varName) or @varName=$colVarName

it should have been

not(@varName) or @varName=$colVarName
Daren Thomas
not() is a function, just like true() and false()
Tomalak
A: 

indeed - not() is a function that returns the boolean opposite of whatever is between the parens. If necessary - it will cast its argument to a boolean. In this case, an empty node set casts automatically to false, so if "@varName" gives you an empty node set, not(@varName) will be true.

Dominic Cronin