- From: Jeni Tennison <jeni@jenitennison.com>
- Date: Wed, 10 Oct 2001 18:31:43 +0100
- To: "Ian Rogers" <ian.rogers@net800.co.uk>
- CC: "Xml Schema" <xmlschema-dev@w3.org>
Hi Ian, > i am trying to run my xml document which i am validating against a > schema at run time. the trouble is when i validate it against my xml > at runtime it only display the xml code to the browser not the > results of the xslt/xml translation. I presume this must be that it > can't find the schema to validate against and so it just displays > the xml text > > When i run my xml this is what gets displayed; > > <?xml version="1.0" ?> > - <transactions xmlns:xsi="http://www.w3.org/2001/10/XMLSchema-instance" > xsi:schemaLocation="http://www.w3.org/2001/XMLSchema"> > - <details> > <date>12/03/2001</date> > <merchant>sun</merchant> > <website>www.sun.com</website> > <amount>900</amount> > > if anyone can can give me any advice or any example xml documents > that validate against a schema then i would be extremely grateful I think that the main problem is that you haven't got the correct URL for the XMLSchema-instance namespace. It should be: http://www.w3.org/2001/XMLSchema-instance ^^^ no /10/ Then you need to sort out what the location of the schema that you're pointing to is from the instance document. I think it's trans.xsd in the same directory as the instance document. Now, you aren't using a namespace for the elements in your document (e.g. the transactions element) and from your previous post, your schema doesn't have a target namespace, so you need to use the xsi:noNamespaceSchemaLocation attribute, and its value needs to be the (relative) URI pointing to the schema. So the start tag of the transactions element in your instance document should look like: <transactions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="trans.xsd"> ... </transactions> *However* I don't think that this has anything to do with the XML document not being transformed with the XSLT stylesheet. As far as I can see, you haven't given IE any pointer to the XSLT stylesheet that you want to use with the document. You need an xml-stylesheet processing instruction at the top of your instance document, something like: <?xml-stylesheet type="text/xsl" href="trans.xsl"?> <transactions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="trans.xsd"> ... </transactions> That tells IE to use trans.xsl to transform the instance document. Also, IE6 doesn't use MSXML4 unless you do the validation/transformation using a script. If you're just loading in the XML document, IE6 won't validate automatically against an XML Schema schema (only against an XDR schema). I hope that's some help, Jeni --- Jeni Tennison http://www.jenitennison.com/
Received on Wednesday, 10 October 2001 13:31:47 UTC