Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Need help with creating XSL stylesheet for SensorML document 1

Status
Not open for further replies.

varocho

Programmer
Dec 4, 2000
238
US
Hello all,

I need some help with creating an XSL stylesheet for a SensorML document in which the elements include namespace prefixes.

After I modify the SensorML document to reference my XSL stylesheet and try to view the document in Firefox, I get the following error message:

XML Parsing Error: not well-formed
Location: file:///C:/SensorML/DescribeTaskingResponse.xml
Line Number 2, Column 6:

in which line 2 is the line that references the XSL stylesheet.

Here's what I have in the XSL stylesheet so far:

<?xml version="1.0" ?>
<xsl:stylesheet xmlns:xsl=" version="1.0"
xsi:schemaLocation=" spsDescribeTaskingRequestResponse.xsd"
xmlns=" spsDescribeTaskingRequestResponse.xsd"
xmlns:sps=" xmlns:xsi=" xmlns:eek:ws=" xmlns:gml=" xmlns:xlink=" xmlns:swe=" >
<xsl:template match="/">
<xsl:for-each select="sps:DescribeTaskingRequestResponse/sps:taskingDescriptor">
<class>
<record>
<xsl:value-of select="sps:sensorID"/>
</record>
</class>
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>

And here's part of the SensorML document I'm working with:

<?xml version="1.0" encoding="UTF-8"?>
<?xml:stylesheet type="text/xsl" href="DescribeTaskingResponse.xsl" ?>
<sps:DescribeTaskingRequestResponse
xsi:schemaLocation=" spsDescribeTaskingRequestResponse.xsd"
xmlns=" spsDescribeTaskingRequestResponse.xsd"
xmlns:sps=" xmlns:xsi=" xmlns:eek:ws=" xmlns:gml=" xmlns:xlink=" xmlns:swe=" >
<sps:taskingDescriptor>
<sps:sensorID>urn:x-ogc:eek:bject:sensor:OGC::ROVER_DRT_1202_SN2015</sps:sensorID>
...
 
><?xml:stylesheet type="text/xsl" href="DescribeTaskingResponse.xsl" ?>
[tt]<?xml[red]-[/red]stylesheet type="text/xsl" href="DescribeTaskingResponse.xsl" ?>[/tt]

Also this is not correct.
>xmlns="[ignore][/ignore] spsDescribeTaskingRequestResponse.xsd"
You probably mean this.
[tt]xmlns="[ignore][/ignore]"[/tt]
 
Thanks, tsuji!

I corrected my SensorML document so it references the XSL file this way, as you suggested:

<?xml-stylesheet type="text/xsl" href="RoverDRT_DescribeTaskingResponse.xsl"?>

and I also corrected my XSL file so the beginning looks like this:

<?xml version="1.0" ?>
<xsl:stylesheet xmlns:xsl=" version="1.0"
xmlns:sps=" xmlns:xsi=" xmlns:eek:ws=" xmlns:gml=" xmlns:xlink=" xmlns:swe=" >
 
Just a supplementary note on the revised element: since you take out eventually the default namespace of "[tt][ignore][/ignore][/tt]", the elements such as <class>, <record> would not be in the proper namespace as intended in the original post. Make sure you understand that consequence.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top