XProc: DOCTYPE selection?

Dear XProc editors,
I read with interest thru the new draft "XProc: An XML Pipeline Language"
[http://www.w3.org/TR/2006/WD-xproc-20061117/] and I come with a remark.

I think there are many XML documents that are currently identified by their DOCTYPE (e.g. the various versions of XHTML), but as
far as I know, the DOCTYPE information cannot be accessed with XSL/XPath.

I believe it would be nice to have a "choose construct" allowing for selections based on the DOCTYPE in addition to XPath.

By the way, an advantage of DOCTYPE selection (or selection limited to the root of an XML document) over XPath is that it is I
think easier to process the XML input files as streams. When using full XPath, the input files may have to be read twice or to
be partially cached.


Test case:

A few months ago, I wrote a small general XML validator [http://alexandre.alapetite.net/distribution/weblide/] handling many
languages and schemas. Here is a piece of the XML database I use to store the various schemas and processing that depends on the
type of XML document in entry. We can see that XHTML is only selected by its DOCTYPE, while SVG is selected both by DOCTYPE and
attributes at the root level. XSLT is used to query this XML database.


 <language description="XHTML 1.x" namespace="http://www.w3.org/1999/xhtml">
  <root name="html" namespace="http://www.w3.org/1999/xhtml"/>
  <dtd default="default">
   <public name="-//W3C//DTD XHTML 1.1//EN"/>
   <schema type="dtd" href="http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"/>
   <schema type="xsd" href="http://www.w3.org/TR/xhtml-modularization/SCHEMA/xhtml11.xsd"/>
   <schema type="schematron" href="http://www.example.net/html.xml"/>
   <schema type="schematron" href="http://www.example.net/wai.xml"/>
  </dtd>
  <dtd>
   <public name="-//W3C//DTD XHTML 1.0 Strict//EN"/>
   <schema type="dtd" href="http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"/>
   <schema type="xsd" href="http://www.w3.org/2002/08/xhtml/xhtml1-strict.xsd"/>
   <schema type="schematron" href="http://www.example.net/html.xml"/>
   <schema type="schematron" href="http://www.example.net/wai.xml"/>
  </dtd>
  <dtd>
 </language>
 <language description="SVG" namespace="http://www.w3.org/2000/svg">
  <root name="svg" namespace="http://www.w3.org/2000/svg"/>
  <dtd default="default">
   <public name="-//W3C//DTD SVG 1.1//EN"/>
   <profile>
    <constraint namespace="" name="version" value="1.1" default="default"/>
    <constraint namespace="" name="baseProfile" value="full" default="default"/>
   </profile>
   <schema type="dtd" href="http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"/>
   <schema type="relaxng" href="http://www.w3.org/Graphics/SVG/1.1/rng/svg11.rng"/>
  </dtd>
  <dtd>
   <public name="-//W3C//DTD SVG 1.1 Tiny//EN"/>
   <profile>
    <constraint namespace="" name="version" value="1.1" default="default"/>
    <constraint namespace="" name="baseProfile" value="tiny" default="default"/>
   </profile>
   <schema type="dtd" href="http://www.w3.org/Graphics/SVG/1.1/DTD/svg11-tiny.dtd"/>
   <schema type="relaxng" href="http://www.w3.org/Graphics/SVG/1.1/rng/svg11-tiny.rng"/>
  </dtd>
  <dtd>
 </language>


Cordially,
Alexandre
http://alexandre.alapetite.net

Received on Monday, 20 November 2006 11:19:05 UTC