I want to compare two XML files using Schematron. I have a template that looks as follows:
<action name="thirdAction" id="3">
<return-values>
<return-value name="communication-profile-id" />
<return-value name="messaging-profile-id" />
</return-values>
And when one creates an instance of the action it looks something like this:
<instanceOfAction name="thirdAction" id="3">
<results>
<result name="communication-profile-id" />
<result name="messaging-profile-id" />
</results>
</instanceOfAction>
I want to map the instanceOfAction to the given action based on the id and then check if the child elements' names correspond. In my hierarchy I have a lot of actions which makes this more difficult. Does somebody have a suggestion for implementing this? I succeeded checking to see if the results in the instanceOfAction are in SOME defined action, but not specifically in the action with the same id, by doing the following:
<sch:rule context="//ts:instanceOfAction/ts:results/ts:result">
<sch:assert test="$testspecification//(ts:actions/ts:action/ts:return-values/ts:return-value)[@name= current()/@key]">
The keys from the results do not match with the names from the return-values.
</sch:assert>
</sch:rule>
where the variable $testspecification is the path to the root hierarchy, which contains all the XML files.
Any help or ideas would be appreciated. :)