Subject: [xsl] schema aware - validating result using xhtml schema From: andrew welch <andrew.j.welch@xxxxxxxxx> Date: Tue, 22 Nov 2005 14:15:45 +0000 |
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 |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] grouping and merging prob, Sylvain Rouillard | Thread | RE: [xsl] schema aware - validating, Michael Kay |
Re: [xsl] FW: Stopping recursion, Mark Seaborne | Date | Re: [xsl] grouping and merging prob, Jon Gorman |
Month |