XSL based on .xsd file

V

Vitor Rodrigues

Hi!!

I have a little problem i'm trying to resolve.
I've a .xml and it's schema (.xsd). i need to create a XSL file to transform
the XML one, but i only now what data types the .xml file has by reading the
..xsd one.

There are some examples related with that?

An example is:

The .xsd:
<xsd:schema xmlns:gml="http://www.opengis.net/gml"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<xsd:import schemaLocation="geometry.xsd"/>
<xsd:import schemaLocation="feature.xsd"/>
<xsd:element name="Freguesias" substitutionGroup="gml:_Feature">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="ID" type="xsd:integer" minOccurs="0"/>
<xsd:element name="Nome" minOccurs="0">
<xsd:simpleType>
<xsd:restriction base="xsd:string">
<xsd:maxLength value="255"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element name="Concelho" type="xsd:string" minOccurs="0"/>
<xsd:element name="Distrito" type="xsd:string" minOccurs="0"/>
<xsd:element name="GEOM" type="gml:GeometryPropertyType" minOccurs="0"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:schema>

The .xml:

<ResultCollection xmlns:gml="http://www.opengis.net/gml"
xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.deegree.org
http://siglab.di.uminho.pt:8888/deegreewfs/wfs?request=DescribeFeatureType&a
mp;amp;typename=Freguesias">
<gml:boundedBy>
<gml:Box>
<gml:coord>
<gml:X>-8.28013877865819</gml:X>
<gml:Y>41.29393080327008</gml:Y>
</gml:coord>
<gml:coord>
<gml:X>-8.109634469834509</gml:X>
<gml:Y>41.411895758208985</gml:Y>
</gml:coord>
</gml:Box>
</gml:boundedBy>
<gml:featureMember>
<FreguesiasLx fid="FreguesiasLx1136">
<Freguesias.ID>1136</Freguesias.ID>
<DICOFRE>1303074</DICOFRE>
<Freguesias.Nome>JUGUEIROS</Freguesias.Nome>
<NOME_ANTER/>
<Freguesias.Concelho>FELGUEIRAS</Freguesias.Concelho>
<Freguesias.Distrito>PORTO</Freguesias.Distrito>
<AREA_HA>744.87809</AREA_HA>
<FONTE_AREA>BDG (DT73)</FONTE_AREA>
<Freguesias.Geometry>
<gml:polygon srsName="EPSG:4326">
<gml:eek:uterBoundaryIs>
<gml:LinearRing>
<gml:coordinates cs="," decimal="." ts="
">-8.187861264864392,41.38633771361297 -8.187971756882051,41.38650279216389
-8.188350874745604,41.38692300094759 -8.188370123431026,41.38692299150452 -8
..188694722785229,41.386925082762296 ....


and i need to create a SXL file to the xml example, but i only know the data
types of the .xml one by viewing the .xsd file.

Can anyone help me?

thanks!

Vitor Rodrigues
 
M

Martin Honnen

Vitor Rodrigues wrote:

I have a little problem i'm trying to resolve.
I've a .xml and it's schema (.xsd). i need to create a XSL file to transform
the XML one, but i only now what data types the .xml file has by reading the
.xsd one.

There are some examples related with that?

An example is:

The .xsd:
<xsd:schema xmlns:gml="http://www.opengis.net/gml"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<xsd:import schemaLocation="geometry.xsd"/>
<xsd:import schemaLocation="feature.xsd"/>
<xsd:element name="Freguesias" substitutionGroup="gml:_Feature">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="ID" type="xsd:integer" minOccurs="0"/>
<xsd:element name="Nome" minOccurs="0">
<xsd:simpleType>
<xsd:restriction base="xsd:string">
<xsd:maxLength value="255"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element name="Concelho" type="xsd:string" minOccurs="0"/>
<xsd:element name="Distrito" type="xsd:string" minOccurs="0"/>
<xsd:element name="GEOM" type="gml:GeometryPropertyType" minOccurs="0"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:schema>

The .xml:

<ResultCollection xmlns:gml="http://www.opengis.net/gml"
xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.deegree.org
http://siglab.di.uminho.pt:8888/deegreewfs/wfs?request=DescribeFeatureType&a
mp;amp;typename=Freguesias">
<gml:boundedBy>
<gml:Box>
<gml:coord>
<gml:X>-8.28013877865819</gml:X>
<gml:Y>41.29393080327008</gml:Y>
</gml:coord>
<gml:coord>
<gml:X>-8.109634469834509</gml:X>
<gml:Y>41.411895758208985</gml:Y>
</gml:coord>
</gml:Box>
</gml:boundedBy>
<gml:featureMember>
<FreguesiasLx fid="FreguesiasLx1136">
<Freguesias.ID>1136</Freguesias.ID>
<DICOFRE>1303074</DICOFRE>
<Freguesias.Nome>JUGUEIROS</Freguesias.Nome>
<NOME_ANTER/>
<Freguesias.Concelho>FELGUEIRAS</Freguesias.Concelho>
<Freguesias.Distrito>PORTO</Freguesias.Distrito>
<AREA_HA>744.87809</AREA_HA>
<FONTE_AREA>BDG (DT73)</FONTE_AREA>
<Freguesias.Geometry>
<gml:polygon srsName="EPSG:4326">
<gml:eek:uterBoundaryIs>
<gml:LinearRing>
<gml:coordinates cs="," decimal="." ts="
">-8.187861264864392,41.38633771361297 -8.187971756882051,41.38650279216389
-8.188350874745604,41.38692300094759 -8.188370123431026,41.38692299150452 -8
.188694722785229,41.386925082762296 ....


and i need to create a SXL file to the xml example, but i only know the data
types of the .xml one by viewing the .xsd file.

Can anyone help me?

XPath 2.0/XSLT 2.0 knows schema aware processing which might help in
this case, however there is only one implementation so far which is
Saxon 8 from
http://www.saxonica.com/
and the schema aware version will cost you money after your evaluation
version has expired.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,066
Latest member
VytoKetoReviews

Latest Threads

Top