File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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 Java Interview Guide this week in the Jobs Discussion 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?
I agree. Here's the link:
subject: XSLT constraint using XPath
It's not a secret anymore!