xsl-list
[Top] [All Lists]

RE: schema aware - validating result using xhtml schema

2005-11-22 08:08:43
The schema-location has to identify a schema (W3C XML Schema), not a DTD.

The reason this isn't well covered in the spec is the somewhat ambiguous
status of the schema for XHTML. The schema for XHTML 1.1 is published in

http://www.w3.org/TR/2004/WD-xhtml-modularization-20040218/Overview.html#toc

which is a working draft, although it is described as "almost complete". If
you download the .ZIP version of that spec at
http://www.w3.org/TR/2004/WD-xhtml-modularization-20040218/xhtml-modularizat
ion.zip, it includes the schema as a set of separate files; but I'm not
aware of a location where you can refer to the files directly.

The only thing you should need to do to your stylesheet is to change the
schema-location attribute.

Michael Kay
http://www.saxonica.com/



-----Original Message-----
From: andrew welch [mailto:andrew(_dot_)j(_dot_)welch(_at_)gmail(_dot_)com] 
Sent: 22 November 2005 14:16
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: [xsl] schema aware - validating result using xhtml schema

Hi,

Can someone provide an example of how to validate the result tree (as
it's being created) using the XHTML strict schema?

<xsl:stylesheet
        version="2.0"
        xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
        xmlns:xhtml="http://www.w3.org/1999/xhtml";>

<xsl:output method="xhtml"/>

<xsl:import-schema namespace="http://www.w3.org/1999/xhtml";
schema-location="xhtml1-strict.dtd"/>

<xsl:template match="/">
      <xsl:result-document
           
doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd";
           doctype-public="-//W3C//DTD XHTML 1.0 Strict//EN"
           validation="strict">
              <html xmlns="http://www.w3.org/1999/xhtml"; 
xml:lang="en" lang="en">
                      <body>
                              <div>test</div>
                              <fake>failing element</fake>
                              <div>test2</div>
                      </body>
              </html>
      </xsl:result-document>
</xsl:template>

</xsl:stylesheet>

As usual, the spec is tough going and I can't find any examples (I
would have thought that generating XHTML using XSLT 2.0 and the strict
schema would be the most popular use for 2.0...)

Anyway, the above example is what I've cobbled together based on
reading section 19 of the spec a few times, although I'm guessing
import-schema is needed even though all the information is contained
in xsl:result-document.

Currently I get the error:

Error on line 26 column 3 of file:/c:/tmp/xhtml1-strict.dtd:
  SXXP0003: Error reported by XML parser: The markup in the 
document preceding t
he root
  element must be well-formed.
Error at xsl:import-schema on line 8 of file:/c:/tmp/test.xsl:
  Failed to parse schema document
Failed to compile stylesheet. 1 error detected.

Whichs seems to say there is a problem parsing the schema... I'm sure
this should be easier than it is - it's all up-hill at the moment.

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: 
<mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--





--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--



<Prev in Thread] Current Thread [Next in Thread>