Re: Friday challenge: XSLT thats creates XPaths for m
<checkXML> <xml src="file:/C:/test.xml"> <check>/root/foo/text = 'foo'</check> <check>/root/foo/@fooatt = 'att'</check> <check>/root/bar/text = 'bar'</check> <check>/root/bar/text = 'baz'</check> </xml> </checkXML> If you were looking for an existing format for that you could write the above as a schematron fairly easily. In either case though there is the usual nuisance about serialising xpaths and reading them back later of getting the namespace context right. The beta Schematron has some code to generate namespace-safe xpaths from any node, which could be used, see: http://eccnet.eccnet.com/pipermail/schematron-love-in/2007-February/000558.html In either case though it seems like you could be generating a lot of xpaths and then having to iterate over them, while schematron, or what I guess checkXML could do is more general, for the specific job of checking two documents can't you have a stylesheet that just tree walks over the two trees in tandem, that way you never (much) need to generate namespace-safe xpaths, as you can get the relevant node names as Qnames and do namespace aware QName comparisons. It's just serialising the names to an Xpath string that loses the context. David
PURCHASE STYLUS STUDIO ONLINE TODAY!
Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!
Download The World's Best XML IDE!
Accelerate XML development with our award-winning XML IDE - Download a free trial today!
Subscribe in XML format