Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


Re: Validating application-specific XHTML

From: Robert Koberg <rob@------.--->
To: Michael Ludwig <mlu@---------.--->
Date: 11/26/2008 10:28:00 PM
Hi,

I would hate to see a schema that validates a CSS based XHTML page.  
Even worse, I would hate to maintain it.

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... }
#wide-col .article { blah... }

An XSL might look like:


<xsl:key name="ident" match="*" use="@id"/>

<xsl:template match="/">
   <ol>
     <li>
       <xsl:apply-templates select="." mode="validate-nav"/>
     </li>
     <li>
       <xsl:apply-templates select="." mode="validate-content"/>
     </li>
etc...
   </ol>
</xsl:template>

<xsl:template match="*" mode="validate-nav">
   <p>
     Has Nav:
     <xsl:value-of select="exists(key('ident', 'narrow-col')/ 
*[@id='nav'])"/>
   </p>
</xsl:template>

<xsl:template match="*" mode="validate-content">
   <p>
     Has at least one content piece:
     <xsl:value-of select="exists(key('ident', 'wide-col')/ 
*[@class='article'])"/>
   </p>
</xsl:template>

best,
-Rob



On Nov 26, 2008, at 12:56 PM, Michael Ludwig wrote:

>
> I'm using XSLT to produce XHTML, or at least XML that approaches  
> XHTML.
>
> I'd like a way to guarantee the correctness of this markup.
>
> It's not correctness in terms of "-//W3C//DTD XHTML 1.0 Strict//EN"  
> that
> I have in mind here. That can be done using the DTD.
>
> It's correctness in terms of the markup specific to my application. To
> give an example, it always has a menu that can be modelled in terms of
> XSD. And an entry in a search result list always is a <div> containing
> certain attributes, certain elements, etc.
>
> In my schema, I'd have, say, a "MenuType", and a "ListType", and an
> "ItemType", and so on. The page will be decomposed in terms of types,
> as can be done using XML Schema.
>
> The main purpose of this validation to counter-check my hacking away  
> at
> the XSLT and to ensure the result doesn't fall out of sync with the  
> CSS.
> A sort of regression test.
>
> This may then be used in conjunction with HttpUnit (a Java library to
> test web applications) to serve as a quality assurance robot.
>
> As I'm far from being a seasoned XML Schema user, I'd like to hear
> any feedback the members of this list might have on the feasability,
> shortcomings, blind spots or other aspects of this attempt.
>
> Do you know of any useful libraries or technologies that might support
> me in my endeavour?
>
> And probably someone has done this before?
>
> Thank you very much.
>
> Michael Ludwig
>
>




transparent
Print
Mail
Like It
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent