ERLEDIGT
NEIN
NEIN
ANTWORTEN
0
0
ZUGRIFFE
1178
1178
EMPFEHLEN
-
14.07.11 18:29 #1
- Registriert seit
- Jul 2011
- Beiträge
- 7
Hallo,
ich habe folgendes XML-Schema, dass ich per XSLT parsen möchte
Code :1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35
<?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 :1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
<?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 dankbarGeändert von jazzhunter (14.07.11 um 18:31 Uhr)
Ähnliche Themen
-
Knoten aus XML rauslösen und mit XSLT rendern / parsen
Von francosdad im Forum PHPAntworten: 3Letzter Beitrag: 02.03.10, 11:00 -
xml mittels xslt aus bestehenden xml erzeugen
Von chris_head im Forum XML TechnologienAntworten: 0Letzter Beitrag: 12.01.10, 12:17 -
XML mittels XSLT in Java Properties umwandeln
Von Fenrizwolf im Forum XML TechnologienAntworten: 6Letzter Beitrag: 23.10.09, 18:55 -
mittels XSLT in mehrere Zieldateien?
Von UkAtZ im Forum XML TechnologienAntworten: 0Letzter Beitrag: 26.08.08, 15:17 -
Probleme PHP/XML Parsen mittels Cronjob
Von spamcam im Forum PHPAntworten: 0Letzter Beitrag: 29.03.05, 15:13





Zitieren
Login





