Subject: RE: XSLT, XHTML, and default attribute values [somewhat OT]
From: "Andrew Welch" <ajwelch@xxxxxxxxxxxxxxx>
Date: Tue, 14 Sep 2004 13:03:15 +0100
|
> Colin Paul Adams <colin@xxxxxxxxxxxxxxxxxx> writes:
>
> >>>>>> "Joseph" == Joseph Dane <jdane@xxxxxxxxxx> 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.
|