-
Implementing XSLT constraint (1 messages)
- Posted by: rana nag
- Posted on: February 27 2007 06:48 EST
We are trying to enforce a couple of business constrainrs with XPATH . A sample xml node is as follows: ..... ..... IE browser Navigate http://www.....com/ ....... ....... If we need to ensure that the XML has ATLEAST one 'element' node containing text as "IE" we do: ERROR: Atleast one IE element needed 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. IE .... Navigate ...Logout... How do we enforce this occuurrence constraint through template?Threaded Messages (1)
- Schematron would be a good choice for this by Anthony Coates on February 27 2007 11:51 EST
-
Schematron would be a good choice for this[ Go to top ]
- Posted by: Anthony Coates
- Posted on: February 27 2007 11:51 EST
- in response to rana nag
You should consider investigating Schematron to check this, but you can also do it yourself in XSLT or in anything that implements XPath. You basically have two XPath queries that need to come back true: count(//event[element = 'IE']) >= 1 count(//event[(element = 'IE') and contains(value, 'Logout')]) >= 1 Cheers, Tony. -- Anthony B. Coates Author, XML APIs chapter Advanced XML Applications from the Experts at The XML Guild http://www.amazon.com/XML-Power-Comprehensive-Guide-Guides/dp/1598632140/