- From: Robert Koberg <rob@koberg.com>
- Date: Thu, 27 Nov 2008 07:15:21 -0500
- To: Michael Ludwig <mlu@as-guides.com>
- Cc: xmlschema-dev@w3.org
On Nov 27, 2008, at 5:32 AM, Michael Ludwig wrote: > > Robert Koberg schrieb: >> I would hate to see a schema that validates a CSS based XHTML page. >> Even worse, I would hate to maintain it. > > Why would you hate to see, or have to maintain such a schema? Is it > the > additional tedium you find uninspiring? Or do you think it is a bad > application, or even an abuse of XML Schema? If it is the latter, > could > you explain why you think this is bad? Well, I guess I should have said that I don't even know how to write an XML Schema that will validate a CSS based XHTML page. For example, a div element with a particular ID (a unique NCName) must have a child div with another particular ID, but also allow other divs/tables/ol/ ul. The another div with another ID must have a child that contains a certain class, but also allow other divs/tables/ol/ul, etc... > > >> However, it would be pretty easy to use an XSL to validate your page. >> You could base the XSL off of your CSS rules. For example, you might >> have a CSS containing: >> >> #narrow-col #nav { blah... } > >> <xsl:template match="*" mode="validate-nav"> >> <p> >> Has Nav: >> <xsl:value-of select="exists(key('ident', >> 'narrow-col')/*[@id='nav'])"/> >> </p> >> </xsl:template> > > That's a good idea. Strangely, it hasn't occurred to me I could use > XSLT > for the job. It doesn't seem to have a reputation for being a > validator > tool, yet. Well, there is schematron (http://en.wikipedia.org/wiki/Schematron). Like you mentioned, you can just as easily use HttpUnit. You might also want to look at WebTest (which uses HttpUnit) http://webtest.canoo.com/webtest/manual/WebTestHome.html -- with either you can use XPath to find what you need. However, I find using XSL to be easiest and most flexible. best, -Rob > > > Thank you very much! > > Michael Ludwig >
Received on Thursday, 27 November 2008 12:15:59 UTC