This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach 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 Murach's Java Servlets and JSP this week in the Servlets 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?
It is sorta covered in the JavaRanch Style Guide.
subject: XSLT constraint using XPath
Similar Threads
XSL transformation of child nodes
node() test condition
Element count in XSL
XSL Table output.
please solve my xslt questions as i am preparing for interview..very me