RE: [xsl] Saxon 8.0b and NOTATIONs

Subject: RE: [xsl] Saxon 8.0b and NOTATIONs
From: "Michael Kay" <mhk@xxxxxxxxx>
Date: Tue, 13 Jul 2004 11:18:09 +0100
I think you've strayed into an area where the XSLT 2.0 specification itself
leaves some ambiguities: namely the use of DTD-defined types to set type
annotations on attribute nodes. You've certainly strayed into wild country
as far as Saxon is concerned: the schema-aware product has an explicit
restriction that xs:NOTATION is not a supported data type, but it looks as
if you can get it in by the back door using a DTD. This is particularly
troublesome because schema-defined notations are namespace-aware, while
DTD-defined notations are not. 

I think the correct behavior is that a non-schema-aware product should
ignore attribute types defined in the DTD except for the purpose of
recognizing IDs for use by the id() function (and possible IDREFs for use by
idref()). However, this isn't very clearly defined in the spec at the
moment.

I'd be grateful if you could send me a package of files that allow me to
reproduce this error and add a test case.

Incidentally, Saxon bugs should normally be reported on the saxon-help list
or forum at sourceforge.net. But where it's a question about what the XSLT
2.0 spec does or doesn't allow, it's legitimate to use this list - which I
think covers this case.

Actually, I think this is about the first time I have seen anyone using
NOTATION attributes in anger, with or without a schema.

Michael Kay

> -----Original Message-----
> From: Peter Flynn [mailto:pflynn@xxxxxx] 
> Sent: 13 July 2004 10:35
> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Subject: [xsl] Saxon 8.0b and NOTATIONs
> 
> I'm getting an error message from Saxon 8.0b:
> 
> > Error at choose on line 19 of file:/tmp/test.xsl:
> >   Value doesn't match its type annotation. No namespace binding for
> > prefix in QName value {blort}
> > Transformation failed: Run-time errors were reported
> 
> Under Saxon 6.5.3 it processes without this error.
> 
> Element <code> has a NOTATION attribute @bar, and the
> NOTATIONs are declared with SYSTEM values (URLs).  The
> value of @bar in the instance is "XML". Lines 18-27 of 
> the XSLT say
> 
>   <xsl:template match="code">
>     <xsl:choose>
>       <xsl:when test="@bar='XML'">
>         Do this
>       </xsl:when>
>       <xsl:otherwise>
>         Do something else
>       </xsl:otherwise>
>     </xsl:choose>
>   </xsl:template>
> 
> I thought it would be easy enough to fix by adding a 
> namespace declaration xmlns:foo for the SYSTEM value of the 
> NOTATION for "XML" and using the test @foo:bar='XML' but 
> that fails (xsl:otherwise is executed).  If I add the prefix
> to the value instead (@bar='foo:XML') it fails with the
> error message above in the same way as it did with no 
> namespaces declared.  What have I misunderstood here?
> 
> If each NOTATION implies a separate namespace (which makes 
> sense), the error message implies the need to declare each 
> namespace in the XSLT, which in turn implies having to code 
> a nest of separate xsl:when elements, each one referencing 
> the hardcoded namespace prefix, simply to test if the 
> attribute is equal to a particular value, which would mean 
> recoding the XSLT every time a new NOTATION was added to 
> the DTD, which sounds wrong to me.
> 
> I knew namespaces would be trouble :-)
> 
> ///Peter
> 
> 
> ///Peter

Current Thread