← Prev in month
← Prev in thread
Next in thread →
Next in month →
Using Schematron to express a rule for a QName value?
Hi Folks, Consider the following XML document. There is an <Item> element which has a "name" attribute: <Test xmlns:wid="http://www.widget.org"> <Item name="wid:widget" /> </Test> The value of @name is a QName. I want a Schematron rule that expresses this: The <Item> element must have a name attribute whose value is "widget" in the http://www.widget.org namespace. (The value of @name is a QName) So I created this Schematron document: <sch:schema xmlns:sch="http://purl.oclc.org/dsdl/schematron" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:w="http://www.widget.org" queryBinding="xslt2"> <sch:pattern id="QName-Test"> <sch:rule context="Item"> <sch:assert test="resolve-QName(@name, .) eq xsd:QName('w:widget')"> The value of the name attribute must be 'widget' in the http://www.widget.org namespace. </sch:assert> </sch:rule> </sch:pattern> </sch:schema> When I validated the XML document against the Schematron schema I got this error: Namespace prefix {w} has not been declared Any ideas on what the problem is? /Roger
← Prev in month
← Prev in thread
Next in thread →
Next in month →