Template gets applied where it shouldn't...
I'm trying to parse a schema into an input form.
So I have a template like this:
<xsl:template match="xs:element" mode="schemaTop">
<xsl:value-of select="@type"/>
</xsl:template>
Which is only called from <xsl:template match="/xs:schema">
.
So you would think that it would only match the root xs:element of the schema right? But instead it matches children and some grand-children of xs:schema, like the ones inside the first complexType definition. Shouldn't "xs:element" only match children of "xs:schema"?
The schema is:
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="root" type="rootType"/>
<xs:complexType name="rootType">
<xs:sequence>
<xs:element name="one" type="oneType"/>
<xs:element name="two" type="twoType"/>
<xs:element name="three" type="threeType"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="oneType">
<xs:sequence>
<xs:choice>
<xs:element name="aString" type="xs:string"/>
<xs:element name="aNumber" type="xs:nonNegativeInteger"/>
</xs:choice>
</xs:sequence>
</xs:complexType>
<xs:complexType name="twoType">
<xs:sequence>
<xs:element name="something" type="xs:string" minOccurs="0" maxOccurs="unbounded"/>
<xs:element name="somethingElse" type="xs:string" minOccurs="0" maxOccurs="3"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="threeType">
<xs:sequence>
<xs:element name="aThing" type="xs:string" minOccurs="0" maxOccurs="4"/>
<xs:element name="anotherThing" type="xs:string" minOccurs="0" maxOccurs="4"/>
<xs:element name="yetAnother" type="xs:string" minOccurs="0" maxOccurs="2"/>
</xs:sequence>
</xs:complexType>
</xs:schema>
And the output I get is (right now the template only prints the element type and doesn't print anything else):
rootType
oneType
twoType
threeType

