Re: [xslt] DTD validation and default attributes
- From: Daniel Veillard <veillard redhat com>
- To: The Gnome XSLT library mailing-list <xslt gnome org>
- Subject: Re: [xslt] DTD validation and default attributes
- Date: Thu, 2 Apr 2009 17:34:18 +0200
On Thu, Mar 26, 2009 at 11:28:08AM +0100, Michael Ludwig wrote:
> The following document specifies default attributes in the
> internal subset and is also invalid. I'm using it to explore
> and illustrate some of the DTD features of LibXML2 and their
> availability from LibXSLT.
>
> <?xml version="1.0" encoding="iso-8859-1"?>
> <!DOCTYPE Urmel[
> <!ELEMENT Urmel ANY>
> <!ELEMENT Elm EMPTY>
> <!ATTLIST Elm ab CDATA "hihi"
> cd CDATA #FIXED "huhu">
> ]>
> <Urmel>
> <Elm ab="haha"/>
> <Elm/>
> <Elm>not empty, hence not valid</Elm>
> </Urmel>
>
> (1) The document is invalid due to a non-empty <Elm>, which
> can be seen running "xmllint --valid" on it.
>
> (2) Default attributes can be seen in the serialization
> running "xmllint --dtdattr" on the document. No validation
> seems to occur here, as there is no error message.
>
> (3) Default attributes can also be seen running an identity
> transform (or another suitable transform) on the document
> using xsltproc.
>
> So far, so good. Now two questions:
>
> (4) While default attributes are supplemented running a
> transform, validation does not seem to occur, as no error
> is flagged. Is this the intended behaviour? Note there is
yes
> a --novalid option, which seems to imply validation is
> intended to occur by default
xsltproc run without arguments will print
--novalid skip the Dtd loading phase
i.e. this argument means the external subset is not loaded.
> (5) Using the --novalid option, default attributes as per the
> internal subset are not translated into the XPath Data Model
> which the transformer gets to work on. Is this intended? Note
> there is also a --nodtdattr option to xsltproc. It does what
> it says, but this doesn't seem to be different from --novalid.
You would see the difference if your document had an external
subset. You could still fetch the external subset, say to load
entities but not expand to add the associated defaulted attributes.
Daniel
--
Daniel Veillard | libxml Gnome XML XSLT toolkit http://xmlsoft.org/
daniel veillard com | Rpmfind RPM search engine http://rpmfind.net/
http://veillard.com/ | virtualization library http://libvirt.org/
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]