I am working on some functionality for a photographic competition.
I need to be able to identify entries to any competition with the following conditions:
1. Judging is complete for the competition - a true/false property on the competition node.
2. An email notification has not been sent to the entrant - a date picker property on the entry node. This node is 3 levels below the competition node.
So I tried the following but it didn't work:
var nodes = uQuery.GetNodesByXPath("//externalCompetition [@isDoc and competitionJudgingComplete = '1']//externalCompetitionEntry[@isDoc and resultNotification = '']");
Safest bet will be to use the normalize-space() function, like this:
var nodes = uQuery.GetNodesByXPath("//externalCompetition[@isDoc and competitionJudgingComplete = 1]//externalCompetitionEntry[@isDoc and not(normalize-space(resultNotification))]");
- you *can* take advantage of your knowledge of the aliases here to shorten this a bit (by getting rid of the @isDoc tests):
var nodes = uQuery.GetNodesByXPath("//externalCompetition[competitionJudgingComplete = 1]//externalCompetitionEntry[not(normalize-space(resultNotification))]");
- those are mostly needed in conjunction with the asterisk (e.g. *[@isDoc] ) - *unless*, of course, you're naming properties the same as doctypes (which you really shouldn't do anyway).
xPath and Multiple Criteria For Node Selection
Hi there
I am working on some functionality for a photographic competition.
I need to be able to identify entries to any competition with the following conditions:
1. Judging is complete for the competition - a true/false property on the competition node.
2. An email notification has not been sent to the entrant - a date picker property on the entry node. This node is 3 levels below the competition node.
So I tried the following but it didn't work:
Can anyone suggest how this might be achieved ?
Cheers
Nigel
Hi Nigel,
Try wrapping "resultNotification" with a "string" function...
Cheers, Lee.
Hi Nigel,
Safest bet will be to use the normalize-space() function, like this:
- you *can* take advantage of your knowledge of the aliases here to shorten this a bit (by getting rid of the @isDoc tests):
- those are mostly needed in conjunction with the asterisk (e.g. *[@isDoc] ) - *unless*, of course, you're naming properties the same as doctypes (which you really shouldn't do anyway).
/Chriztian
Hey chaps
Wicked wicked wicked - high fives to you both.
Lee - the string() function did in fact fix the problem.
Chriztian - I hadn't heard of the normalize-space() function so have also used this - a bit more learning under the belt is always a good thing.
You guys rock
Nigel
is working on a reply...