Reputation: 13
I am trying to write a a code that pulls information from a list in SharePoint that ranges in numbers associated with one term. For instance:
1-3 = Low
4-6 = Moderate
7-9 = High
10 = Critical
I have the following code but I can't seem to get it to work right. What I want to do is it to only pull from these ranges above:
<xsl:variable name="RM1A" select="count($Rows[@Impact $gt;='01' -and- $lt;='03][@Likelihood $gt;='01' -and- $lt;='02'])"/>
The problem is that it works but pulls all numbers that are greater than 01 and doesn't stop at 03. I am completely new at XML coding so be gentle.
I am looking for an easier way maybe or the right syntax for doing this.
Thanks!
Upvotes: 1
Views: 759
Reputation: 89295
First of all, escaped <
and >
are, in order, <
and >
. Then, expression like and <='03'
is not valid. It is considered missing left operand of <=
. And the last point will be only a suggestion; you might want convert the attributes to number, to safely compare its value as number. So, the following is one possible valid expression (wrapped for readability) :
count(
$Rows[number(@Impact) >=1 and number(@Impact) <=3]
[number(@Likelihood) >=1 and number(@Likelihood) <=2]
)
Upvotes: 2