Two Laptop Bag*
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 Android Security Essentials Live Lessons this week in the Android 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
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