[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

RE: schema aware - validating result using xhtml schem

Subject: RE: schema aware - validating result using xhtml schema
From: "Michael Kay" <mike@xxxxxxxxxxxx>
Date: Tue, 22 Nov 2005 15:08:43 -0000
xhtml schema
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.j.welch@xxxxxxxxx] 
> Sent: 22 November 2005 14:16
> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Subject:  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.

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.