This week's book giveaway is in the OCPJP forum.
We're giving away four copies of OCA/OCP Java SE 7 Programmer I & II Study Guide and have Kathy Sierra & Bert Bates on-line!
See this thread for details.
The moose likes XML and Related Technologies and the fly likes XSLT constraint using XPath Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "XSLT constraint using XPath" Watch "XSLT constraint using XPath" New topic

XSLT constraint using XPath

Ranadhir Nag
Ranch Hand

Joined: Mar 09, 2006
Posts: 138
We are trying to enforce a couple of business constrainrs with XPATH .
A sample xml node is as follows:

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>

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.


How do we enforce this occuurrence constraint through template?
subject: XSLT constraint using XPath