This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Illegal ID values (was: DTD help!)


Mike Kay wrote:
> > XML file
> >
> > <!DOCTYPE test [
> > <!ELEMENT test EMPTY>
> > <!ATTLIST test id ID #REQUIRED>
> > ]>
> > <test id="100"/>
> 
> The rule that an ID value must be an XML Name is a validity error, not a
> well-formedness error. Saxon by default runs with a non-validating parser;
> if you run it with a validating parser, the error will be reported.

Yes. Sorry for being misleading, the point was actaully that the following template
works without any comments from the processor. After all, i supply a formally
illegal value to the function.
> >
> >   <xsl:template match="id('100')">
> >     ok
> >   </xsl:template>

A quick glance at the XPath spec does not reveal any real advice how to
handle this. So there is still the question: is this a bug or a feature?
(I didn't try very hard, so this may be specified somewhere).

I also miss some advice how to handle the case if the ID-attributes matched
are not unique, as they should. Saxon appears to pick the first matching
element from the document, Xalan picks the last.

> > I also noted that Saxon 6.1 does not output the linefeed before
> > the "ok" line (Xalan did).
> 
> That surprises me greatly.

Ooops, probably my fault.
The output from Saxon is

<?xml version="1.0" encoding="ASCII"?>
    ok
  <--------------end (including this line up to the "<")

Xalan outputs

<?xml version="1.0" encoding="ASCII"?>

    ok
  <--------------end (including this line up to the "<")


The result is not well formed XML (or is it?), therefore it can be
argued whether the processor is allowed to insert a line feed after the
XML declaration on its own, as Xalan apparently does. Is there any
Language Lawyer out there who tells what's Right or Wrong (or whatever)?

Regards
J.Pietschmann

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]