RE: [xsl] XHTML result validation using xsl:type

Subject: RE: [xsl] XHTML result validation using xsl:type
From: "Michael Kay" <mike@xxxxxxxxxxxx>
Date: Thu, 31 Jan 2008 17:16:42 -0000
The XHTML schema defines the html element like this:

<xs:element name="html">
<xs:complexType>
<xs:sequence>
<xs:element ref="head"/>
<xs:element ref="body"/>
</xs:sequence>
<xs:attributeGroup ref="i18n"/>
<xs:attribute name="id" type="xs:ID"/>
</xs:complexType>
</xs:element>

So there is a global element declaration named "html", but its type is
anonymous.

You can only use xsl:type="htmlType" when there is a type definition in the
schema of the form

<xs:complexType name="htmlType">

Michael Kay


 

> -----Original Message-----
> From: Andrew Welch [mailto:andrew.j.welch@xxxxxxxxx] 
> Sent: 31 January 2008 16:50
> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Subject: [xsl] XHTML result validation using xsl:type
> 
> Given this setup:
> 
> xpath-default-namespace="http://www.w3.org/1999/xhtml";
> 
> <xsl:import-schema
>   namespace="http://www.w3.org/1999/xhtml";
>   
> schema-location="http://www.w3.org/2002/08/xhtml/xhtml1-strict.xsd"/>
> 
> <xsl:template match="/">
>   <html xsl:type="html">
> 
> This currently causes the error:
> 
> There is no type named html in an imported schema
> URL: http://www.w3.org/TR/xslt20/#err-XTSE1520
> 
> But using xsl:validation="strict" works without error.
> 
> <xsl:template match="/">
>   <html xsl:validation="strict">
> 
> I'm guessing it's some problem with the default namespace, 
> but I thought this should work.
> 
> The spec says:
> "The [xsl:]type attribute takes as its value a QName. This 
> must be the name of a type definition included in the 
> in-scope schema components for the stylesheet. If the QName 
> has no prefix, it is expanded using the default namespace 
> established using the effective [xsl:]xpath-default-namespace 
> attribute if there is one; otherwise, it is taken as being a 
> name in no namespace."
> 
> http://www.w3.org/TR/xslt20/#validation-xsl-type
> 
> Should xsl:type work as expected here, or am I missing something?
> 
> Using Saxon 9.0.
> 
> 
> thanks
> --
> Andrew Welch
> http://andrewjwelch.com
> Kernow: http://kernowforsaxon.sf.net/

Current Thread