XSLT constraint through XPATH

webmasterbeta

New Member
We are trying to enforce a couple of business constrainrs with XPATH .
A sample xml node is as follows:
.....
.....
<event>
<element>IE</element>
<elementtype>browser</elementtype>
<eventtype>Navigate</eventtype>
<value>http://www.....com/</value>
</event>
.......
.......

If we need to ensure that the XML has ATLEAST one 'element' node containing text as "IE" we do:
<xsl:template match="element[count(IE) < 1]" >
<xsl:text>ERROR: Atleast one IE element needed</xsl:text>
</xsl:template>

But we need to ensure that ATLEAST one of the IE 'event' nodes has a combination of 'element' as IE and 'value' node containing the text "Logout" i.e.

<event>
<element>IE</element>
<elementtype>....</elementtype>
<eventtype>Navigate</eventtype>
<value>...Logout...</value>
</event>

How do we enforce this occurrence constraint through template?
 
Back
Top