[xslt] DTD validation and default attributes
- From: Michael Ludwig <mlu as-guides com>
- To: The Gnome XSLT library mailing-list <xslt gnome org>
- Subject: [xslt] DTD validation and default attributes
- Date: Thu, 26 Mar 2009 11:28:08 +0100
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
a --novalid option, which seems to imply validation is
intended to occur by default
(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.
milu colinux:~/Werkstatt/xml > xmllint --version
xmllint: using libxml version 20702
compiled with: Threads Tree Output Push Reader Patterns Writer
SAXv1 FTP HTTP DTDValid HTML Legacy C14N Catalog XPath XPointer
XInclude Iconv ISO8859X Unicode Regexps Automata Expr Schemas
Schematron Modules Debug Zlib
milu colinux:~/Werkstatt/xml > xsltproc --version
Using libxml 20702, libxslt 10124 and libexslt 813
xsltproc was compiled against
libxml 20702, libxslt 10124 and libexslt 813
libxslt 10124 was compiled against libxml 20702
libexslt 813 was compiled against libxml 20702
Michael Ludwig
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]