Re: [xsl] XSLT, XHTML, and default attribute values [somewhat OT]

Subject: Re: [xsl] XSLT, XHTML, and default attribute values [somewhat OT]
From: Joseph Dane <jdane@xxxxxxxxxx>
Date: Tue, 14 Sep 2004 09:05:54 -1000
Andrew Welch <ajwelch@xxxxxxxxxxxxxxx> writes:

>> Colin Paul Adams <colin@xxxxxxxxxxxxxxxxxx> writes:
>> > Only if your XML parser reads the DTD. If you can configure 
>> it not to 
>> > do so (and most have such a configuration option), then this won't 
>> > happen.
>> that's true.  but then why not just remove the DTD 
>> altogether?  then you don't have to support obscure and/or 
>> parser dependant configuration options.
> I'm not sure it is true.  If a DTD is specified in the xml the parser
> *must* attempt to read it to ensure any defaulted values are present in
> the XML, regardless of configuration.  Turning off validation (I think)
> simply suppresses validation errors.  The only way I know of to parse an

I happened to be using SAX, so I had already turned off validation
using the standard SAX feature for this.  with validation disabled,
the DTD *was* still read, and default attribute values applied to the
model.  So you're correct there.

but there may be additional parser-dependent switches that further
restrict the behavior of the parser.  at least, I think there can.
the documentation for Xerces says that the feature:


can be used to control this, but even with that feature disabled I
was still getting the defaulted attribute values.  so perhaps
you're right.

> I don't understand the benefits of using defaulted values, as anyone
> studying the xml also needs to study the dtd to ensure they get the full
> picture.  Seems crazy, really.

I can certainly see the value in some situations.  They make sense in
the "final" stage of document processing, when the doc is being read
by some application to control some behavior, e.g. what to render to
the screen. 

There seems to be a continuum of "levels of interest", from the basic
lexical structure, to the "infoset" explicit in the document, to the
type-annotated infoset, to the infoset augmented with default
values.  The problem is that there's no way to tell my tools what
level I'm interested in.



Current Thread