Extraction de données avec XSL sur des XML avec namespace
Bonjour,
Voilà, j'ai ce fichier XML :
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 36
| <?xml version="1.0" encoding="ISO-8859-1"?>
<ChouettePTNetwork xmlns="http://www.trident.org/schema/trident"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" schemaLocation="http://www.trident.org/schema/trident neptune.xsd"><ChouetteArea>
<StopArea>
<objectId>CG33:StopArea:21499</objectId>
<objectVersion>1</objectVersion>
<creationTime>2011-11-15T10:15:01.000+01:00</creationTime>
<name>AMBARES Bellevue</name>
<contains>CG33:StopPoint:15</contains>
<contains>CG33:StopPoint:70</contains>
<centroidOfArea>CG33:Place:3433040</centroidOfArea>
<StopAreaExtension>
<areaType>BoardingPosition</areaType>
<fareCode>1</fareCode>
</StopAreaExtension>
</StopArea>
<StopArea>
<objectId>CG33:StopArea:11146</objectId>
<objectVersion>1</objectVersion>
<creationTime>2011-11-15T10:15:01.000+01:00</creationTime>
<name>AMBARES La Grave d Ambares</name>
<contains>CG33:StopPoint:13</contains>
<contains>CG33:StopPoint:68</contains>
<contains>CG33:StopPoint:123</contains>
<contains>CG33:StopPoint:177</contains>
<contains>CG33:StopPoint:260</contains>
<contains>CG33:StopPoint:313</contains>
<contains>CG33:StopPoint:367</contains>
<contains>CG33:StopPoint:420</contains>
<centroidOfArea>CG33:Place:3432984</centroidOfArea>
<StopAreaExtension>
<areaType>BoardingPosition</areaType>
<fareCode>1</fareCode>
</StopAreaExtension>
</StopArea>
</ChouettePTNetwork> |
Ce fichier XSL :
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 36
| <?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:trident="http://www.trident.org/schema/trident">
<xsl:template match="/">
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:neptune="http://data.lirmm.fr/ontologies/neptune/">
<neptune:ChouettePTNetwork>
<neptune:hasChouetteArea>
<neptune:ChouetteArea>
<xsl:for-each select="trident:ChouettePTNetwork/trident:chouetteArea/trident:StopArea">
<neptune:hasStopArea>
<neptune:StopArea>
<neptune:objectId>trident:ChouettePTNetwork/trident:StopArea/trident:objectId</neptune:objectId>
<neptune:objectVersion>trident:ChouettePTNetwork/trident:StopArea/trident:objectVersion</neptune:objectVersion>
<neptune:creationTime>trident:ChouettePTNetwork/trident:StopArea/trident:creationTime</neptune:creationTime>
<neptune:name>trident:ChouettePTNetwork/trident:StopArea/trident:name</neptune:name>
<neptune:contains>trident:ChouettePTNetwork/trident:StopArea/trident:contains</neptune:contains>
<neptune:centroidOfArea></neptune:centroidOfArea>
<neptune:comment></neptune:comment>
<neptune:hasStopAreaExtension>
<neptune:StopAreaExtension>
<neptune:areaType>trident:ChouettePTNetwork/trident:StopArea/trident:StopAreaExtension/trident:areaType</neptune:areaType>
<neptune:nearestTopicName>trident:ChouettePTNetwork/trident:StopArea/trident:StopAreaExtension/trident:nearestTopicName</neptune:nearestTopicName>
<neptune:fareCode>trident:ChouettePTNetwork/trident:StopArea/trident:StopAreaExtension/trident:fareCode</neptune:fareCode>
</neptune:StopAreaExtension>
</neptune:hasStopAreaExtension>
</neptune:StopArea>
</neptune:hasStopArea>
</xsl:for-each>
</neptune:ChouetteArea>
</neptune:hasChouetteArea>
</neptune:ChouettePTNetwork>
</rdf:RDF>
</xsl:template>
</xsl:stylesheet> |
Et lorsque j'utilise xsltproc pour produire le XML voulu, les balises sont vides :( Et lorsque j'enlève le "for-each" ça marche. J'en déduis donc que c'est mon "select" qui est foireux, mais je n'arrive pas à voir où:calim2:
Si un âme charitable pouvais me dire pourquoi ça ne marche pas je lui en serait reconnaissant:mrgreen:
:merci: