Hi Folks, Did you know that Schematron rules and assertions can call user-defined XSLT functions?
That capability enormously enhances the power of Schematron. It brings the power of a programming language to the task of validating XML instances.
Wow! Example: I created a function that, when called with an item in an XML tree, returns the path to that item. For example, call my function with the second <Title>
element in this XML instance: <Book> and it returns this path: /Book/Title[2] Neat! I can use that function in Schematron.
I want to create a Schematron assertion which checks that the name of each child element of <Book> is unique. If that assertion is violated, I call my function
to show the location of the offending child element. Below is the entire Schematron, including my function. The above XML instance violates the assertion and so this is output of Schematron validation: Oops! Duplicate element name: /Book/Title[2] Schematron rocks! |