Reputation: 21
I have following XML:
<problem>
<problemID>1117</problemID>
<file>/Admin/moc_/test/src/test.cpp</file>
<code>XXXX</code>
<message>Example</message>
<citingStatus>Analyze</citingStatus>
<severity>Unexpected</severity>
</problem>
<problem>
<problemID>1118</problemID>
<file>/Admin/moc_/test/src/test.cpp</file>
<code>XXXX</code>
<message>Example</message>
<citingStatus>Analyze</citingStatus>
<severity>Unexpected</severity>
</problem>
<problem>
<problemID>1119</problemID>
<file>/Admin/test/src/test.cpp</file>
<code>XXXX</code>
<message>Example</message>
<citingStatus>Analyze</citingStatus>
<severity>Unexpected</severity>
</problem>
<problem>
<problemID>1120</problemID>
<file>/Admin/moc_/test/src/test.cpp</file>
<code>XXXX</code>
<message>Example</message>
<citingStatus>Analyze</citingStatus>
<severity>Critical</severity>
</problem>
<problem>
<problemID>1121</problemID>
<file>/Admin/XXX/test/src/test.cpp</file>
<code>XXXX</code>
<message>Example</message>
<citingStatus>Analyze</citingStatus>
<severity>Unexpected</severity>
</problem>
I want to Count the number of occurrence which are not containing file name as "moc_" and have severity label as "Unexpected"
XSLT tag used is:
<xsl:value-of select="count(problem[file[contains(.,'moc_')]] and [severity[.='Unexpected']])"/>
Using the above tag throws an error. I can individual calculate the count but not with and condition.
Upvotes: 0
Views: 959
Reputation: 117140
Try either:
<xsl:value-of select="count(problem[file[contains(.,'moc_')]][severity='Unexpected'])"/>
or:
<xsl:value-of select="count(problem[file[contains(.,'moc_')] and severity='Unexpected'])"/>
Note that:
[severity[.='Unexpected']]
can be stated simply as:
[severity='Unexpected']
Upvotes: 1