extract.xsl and subjects.xsl

I've updated two more transforms:

extract.xsl processes a DOM spec and extracts just the interface definitions.  The resulting file as a resource for the test2java.xsl transform.

subjects.xsl processes a DOM spec and generates a series of rdf:Description elements about testable facets of the DOM spec.  The immediate goal of this file is provide a catalog of URL's that can be used in the test metadata to specify which facets exercised by the test.

The files are in the xmlconf CVS as www-dom-ts/extract.xsl and www-dom-ts/subjects.xsl and are also available at http://xmlconf.sourceforge.net/www-dom-ts/extract.xsl and http://xmlconf.sourceforge.net/www-dom-ts/subjects.xsl

Sample outputs (generated by applying the transforms to wd-dom.xml from the DOM Level 1 spec) are available at http://xmlconf.sourceforge.net/www-dom-ts/interfaces.xml.gz and http://xmlconf.sourceforge.net/www-dom-ts/subjects.xml.gz

subject.xsl generates an XML document containing a series of <rdf:Description> elements giving metadata "about" specific URI's.  URI's for interfaces, methods and attributes are generated from the Spec's URL and the assigned id attribute.  For example, DocumentImpl.hasFeature can be represented by:

http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-5CED94D7

That link can be resolved in available browsers to place you at the definition of DocumentImpl.hasFeature

Parameters, return values, and exceptions are not explicitly assigned ID's.  URI's are generated with an XPointer syntax.  

For example, the return value of the DOMImplementation.hasFeature method is identified by

http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-5CED94D7')/returns) 

And the first ("feature") parameter is identified by:

http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-5CED94D7')/parameters/param[1]) 

The exception clauses are pretty nasty, since exception codes only appear in the character data. 

The conditions that cause Document.createElement to raise a DOMException with code= INVALID_CHARACTER_ERR 

http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-2141741547')/raises/exception[name='DOMException']/descr/p[substring-before(.,':')='INVALID_CHARACTER_ERR']) 

I believes these are legal XPointer URI's, however since I'm unaware of a browser that implements XPointer, I can't check them.  I think the RDF is proper too, but I don't have anything to check it with.

To state that a test evaluates conformance with one of these facets, do somethink like:

<test name="hasFeatureReturnsTrue">
    <metadata>
        <!-- the return value of DocumentImpl.hasFeature is a subject of the test   -->
        <subject resource="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-5CED94D7')/returns)"/>
        <!--  the feature param is also a subject of the test   -->
        <subject resource="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointer(id('ID-5CED94D7')/parameters/param[1])"/>
    </metadata>
    <!--  body of test  -->
</test>
    

I would suggest the following:

If a test checks the return value of a function, then the return value should be a subject of the test.

If a test raises an exception, then the appropriate exception code clause should be a subject.

If a test uses a value of a param with a special meaning, then the param should be a subject.

If a test checks the effects of a method, then the method should be a subject.

If a test checks a get or a set of am attribute, then the attribute should be a subject.

If these <subject> elements are added to the test metadata, then it should be fairly simple to generate a converage report for an arbitrary set of tests against the spec.
    
I'll update test2java.xsl over the weekend.

--------------------------------------


Declaration of Curt Arnold

   Curt Arnold hereby grants to the W3C, a perpetual,
   nonexclusive, royalty-free, world-wide right and license under any
   Curt Arnold copyrights in this contribution to copy, publish and
   distribute the contribution, as well as a right and license of the
   same scope to any derivative works prepared by the W3C and based on,
   or incorporating all or part of the contribution. Curt Arnold
   further agrees that any derivative works of this contribution prepared
   by the W3C shall be solely owned by the W3C.

Received on Friday, 22 June 2001 04:51:53 UTC