Re: adding a namespace declaration to result stylesheet?

Oliver Becker <[email protected]> Fri, 12 Sep 2003 10:36:44 +0200 (MEST)
Newsgroups gmane.text.xml.schematron
Message-ID <[email protected]>
Hi Bob,

> I've been fooling with the creation of Schematron rules to check datatypes
> by using Saxon 7, which supports much of recent XSLT Working Drafts of XSLT
> 2.0, as the XSLT processor. For example:
> 
>     <rule context="quantity">
>       <assert test="string(.) castable as xs:integer">
>         All quantity values should be integers.
>       </assert>
>     </rule>
> 
> My problem is that xs: namespace prefix. Even if I include
> xmlns:xs="http://www.w3.org/2001/XMLSchema" as an attribute of the root,
> there are no elements or attributes in the document from that namespace, so
> the XSLT processor that creates an XSLT stylesheet from this rules file
> doesn't include the namespace declaration for xs, so Saxon 7 chokes on the
> "castable" expression above because it didn't see a proper namespace
> declaration for it in the generated stylesheet. Any suggestions?

Just add the element
<ns uri="http://www.w3.org/2001/XMLSchema" prefix="xs" />
as a child of <schema> to your Schematron schema.

Oliver


/-------------------------------------------------------------------\
|  ob|do        Dipl.Inf. Oliver Becker                             |
|  --+--        E-Mail: [email protected]             |
|  op|qo        WWW:    http://www.informatik.hu-berlin.de/~obecker |
\-------------------------------------------------------------------/



-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf