I'm using XML Editor 18.1 to write and run XSL style-sheet below:
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:fo="http://www.w3.org/1999/XSL/Format" exclude-result-prefixes="xs" version="2.0">
<xsl:import-schema schema-location="orig.xsd"/>
<xsl:template match="schema-element(orig)">
...
</xsl:template>
</xsl:stylesheet>
<orig>
is defined as a top level element in the no namespace schema below:
<?xml version="1.1" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:vc="http://www.w3.org/2007/XMLSchema-versioning" elementFormDefault="qualified"
xmlns:xml="http://www.w3.org/XML/1998/namespace" xmlns:xi="http://www.w3.org/2001/XInclude"
vc:minVersion="1.1">
<xs:import namespace="http://www.w3.org/XML/1998/namespace" schemaLocation="xml_namespace.xsd"/>
<xs:element name="orig">
<xs:complexType>
<xs:sequence>
...
</xs:sequence>
<xs:attributeGroup ref="pointer_attributes"/>
</xs:complexType>
</xs:element>
During the stylesheet compilation, Saxon-EE 9.6.0.7 returns the error message below:
System ID: Main validation file: ... Engine name: Saxon-EE 9.6.0.7 Severity: fatal Description: XPST0008 XSLT Pattern syntax error at char 26 on line 12 in {schema-element(orig)}: There is no declaration for element in an imported schema Start location: 12:26 URL: http://www.w3.org/TR/xpath20/#ERRXPST0008
Compilation is fine with the schema below:
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">
<xs:element name="orig">
<xs:complexType>
<xs:sequence>
<xs:element name="nested_element" type="xs:string"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
However, as soon as I add vc:minVersion="1.1"
the error is occurring again.
xsl:element name="orig"
. – Martin Honnen<orig>
is a top-level element (it can be used as a root element for an instance of this schema). I'm trying to debug the XSLT with a simple stylesheet with only thexsl:import-schema
and the schema-element(orig) template, but Saxon still tell me thatorig
is not declared in the schema. – colibrisson