[xsl] Saxon 8.0b and NOTATIONs

Subject: [xsl] Saxon 8.0b and NOTATIONs
From: Peter Flynn <pflynn@xxxxxx>
Date: Tue, 13 Jul 2004 10:34:55 +0100
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