XSD mittels XSLT parsen ohne Annotation

jazzhunter

Grünschnabel
Hallo,

ich habe folgendes XML-Schema, dass ich per XSLT parsen möchte

Code:
<?xml version="1.0" encoding="UTF-8"?>
<schema xmlns="http://www.w3.org/2001/XMLSchema"
	xmlns:xlink="http://www.w3.org/1999/xlink"
	xmlns:gml="http://www.opengis.net/gml/3.2"
	version="3.2.1" elementFormDefault="qualified" targetNamespace="http://www.opengis.net/gml/3.2">
	<annotation>
		<documentation>GML 3.2.1 profile for NAS version 6.0_B</documentation>
	</annotation>
	<import schemaLocation="../xlink/1.0.0/xlinks.xsd" namespace="http://www.w3.org/1999/xlink"/>
	<!-- ================================================= -->
	<complexType name="AbstractMetadataPropertyType" abstract="true">
		<sequence/>
		<attributeGroup ref="gml:OwnershipAttributeGroup"/>
	</complexType>
	<!-- ================================================= -->
	<attributeGroup name="OwnershipAttributeGroup">
		<attribute name="owns" type="boolean" default="false"/>
	</attributeGroup>
	<!-- ================================================= -->
	<complexType name="AbstractMemberType" abstract="true">
		<sequence/>
		<attributeGroup ref="gml:OwnershipAttributeGroup"/>
	</complexType>
	<!-- ================================================= -->
	<complexType name="CodeType">
		<simpleContent>
			<extension base="string">
				<attribute name="codeSpace" type="anyURI"/>
			</extension>
		</simpleContent>
	</complexType>
	<!-- ================================================= -->
	<element name="AbstractFeature" type="gml:AbstractFeatureType" abstract="true"
		substitutionGroup="gml:AbstractGML"> </element>
</schema>

Nun das XSLT-File um den Namen der Elemente abzufragen

Code:
<?xml version="1.0" encoding="UTF-8" ?>
<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:gml="http://www.opengis.net/gml/3.2" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xsl:output method="text" encoding="UTF-8" indent="no" />
<xsl:strip-space elements="*"/>

<xsl:variable name="tab"><xsl:text>	</xsl:text></xsl:variable>
 <xsl:variable name="newline"><xsl:text>
</xsl:text></xsl:variable>

<xsl:template match="//xs:element[parent::xs:schema]">
	<xsl:value-of select="$newline"/>
	Elementname: <xsl:value-of select="@name"/>
	<xsl:value-of select="$newline"/>
</xsl:template>
	   
</xsl:stylesheet>

Seltsamer Weise wird nicht nur der Elementname AbstractFeature zurück gegeben, sondern auch der annotation><documentation> Block, obwohl dieser nicht abgefragt wird (vgl. match="//xs:element[parent::xs:schema]").

Somit wird folgende Ausgabe erzeugt:

GML 3.2.1 profile for NAS version 6.0_B

Elementname: AbstractFeature


erwartet habe ich aber:

Elementname: AbstractFeature

Wie kommt das zu Stande und wie könnte man die Ausgabe "GML 3.2.1 profile for NAS version 6.0_B" unterdrücken?

für eure Hilfe wäre ich sehr dankbar
 
Zuletzt bearbeitet:
Zurück