xsl-list
[Top] [All Lists]

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

2004-09-14 05:03:15

Colin Paul Adams <colin(_at_)colina(_dot_)demon(_dot_)co(_dot_)uk> writes:

"Joseph" == Joseph Dane <jdane(_at_)hawaii(_dot_)edu> writes:

    Joseph> A consequence of this is that default attribute 
values get
    Joseph> added to the tree before my processor has a 
chance operate
    Joseph> on it.

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
xml file with a DTD specified (without access to the DTD itself) is to
implement a custom entity resolver.  Of course, you can edit the XML
file prior to transforming to remove the doctype, but regex'ing over xml
markup just feels wrong.  

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.

cheers
andrew.