Why
would you want to perform the world's most expensive identity transform?
C. M. Sperberg-McQueen
Poster presentation at XML 2003, Philadelphia, December 2003
One difference between XML Schema 1.0 and other schema languages is
that XML Schema 1.0 explicitly defines the information which a
validating schema processor can and should (or must) provide to
downstream applications: the post-schema-validation infoset (PSVI).
Some XML Schema processors (e.g. xsv and Xerces J) provide access
to the PSVI in the form of an XML document. (It is, after all,
structured information).
One thing (out of many) that you can do with this XML dump of the
PSVI is to feed it through XSLT to generate -- well, something that looks
like XML.
This may be the world's most expensive identity transformation. What's it
good for?
If we just use a stylesheet to reflect the [validation
attempted] and [validity] properties in the output,
we can make it relatively simple to locate validity problems in the
input.
The example
here
uses a visual display of the document to make the point;
other applications of the principle could use sound or other characteristics
in the output.
The background reflects the
[validation attempted]
property:
- white for validation attempted = full
- light gray for validation attempted = partial
- dark gray for validation attempted = none
- black for elements skipped so totally that the property
isn't present
The foreground reflects the
[validatity]
property:
- green for validity = valid
- red for validity = invalid
- amber for validity = notKnown
(Late-breaking news: this color choice is sub-optimal if your
audience may include red-green color-blind viewers; my apologies.)