Sorry if this has been covered. I've programed with Perl for years, a simple XSLT is kicking my butt. I need to spend more time studying but need to get this trick working quickly. So, please pardon my ignorance.
I have an XML document available here:
And, I'd like to pull the various pieces/parts of the XML out into a CSV that will get sucked into Excel. I need to compare the content of two different instances of the getCapabilities XML.
My newb knowledge of writing XSLTs is proving inadequate. I've written a few non-trivial XSLTs before with some effort. The top of the XML looks like:
I'm starting very modestly and trying to get the 'Title' like:
But, instead of just getting the contents of the 'ows:Title' element, I get the entire match for the template.
I would like to get just the 'ows:Title'. If I can learn what I'm doing wrong there, I think it will break the log jam.
TIA
'hope this helps
If you are new to Tek-Tips, please use descriptive titles, check the FAQs, and beware the evil typo.
I have an XML document available here:
And, I'd like to pull the various pieces/parts of the XML out into a CSV that will get sucked into Excel. I need to compare the content of two different instances of the getCapabilities XML.
My newb knowledge of writing XSLTs is proving inadequate. I've written a few non-trivial XSLTs before with some effort. The top of the XML looks like:
Code:
<?xml version="1.0"?>
<Capabilities xmlns:gml="[URL unfurl="true"]http://www.opengis.net/gml"[/URL] xmlns:xlink="[URL unfurl="true"]http://www.w3.org/1999/xlink"[/URL] xmlns:swe="[URL unfurl="true"]http://www.opengis.net/swe/1.0.1"[/URL] xmlns:om="[URL unfurl="true"]http://www.opengis.net/om/1.0"[/URL] xmlns="[URL unfurl="true"]http://www.opengis.net/sos/1.0"[/URL] xmlns:sos="[URL unfurl="true"]http://www.opengis.net/sos/1.0"[/URL] xmlns:ows="[URL unfurl="true"]http://www.opengis.net/ows/1.1"[/URL] xmlns:ogc="[URL unfurl="true"]http://www.opengis.net/ogc"[/URL] xmlns:tml="[URL unfurl="true"]http://www.opengis.net/tml"[/URL] xmlns:sml="[URL unfurl="true"]http://www.opengis.net/sensorML/1.0.1"[/URL] xmlns:myorg="[URL unfurl="true"]http://www.myorg.org/features"[/URL] xmlns:xsi="[URL unfurl="true"]http://www.w3.org/2001/XMLSchema-instance"[/URL] xsi:schemaLocation="[URL unfurl="true"]http://www.opengis.net/sos/1.0[/URL] [URL unfurl="true"]http://schemas.opengis.net/sos/1.0.0/sosAll.xsd"[/URL] version="1.0.0">
<!-- This is a PROTOTYPE service. The information in this response is NOT complete. -->
<ows:ServiceIdentification>
<ows:Title>National Data Buoy Center SOS</ows:Title>
<ows:Abstract>National Data Buoy Center SOS</ows:Abstract>
<ows:Keywords>
<ows:Keyword>Weather</ows:Keyword>
<ows:Keyword>Ocean Currents</ows:Keyword>
<ows:Keyword>Water Temperature</ows:Keyword>
<ows:Keyword>Salinity</ows:Keyword>
<ows:Keyword>Water Level</ows:Keyword>
<ows:Keyword>Waves</ows:Keyword>
<ows:Keyword>Winds</ows:Keyword>
</ows:Keywords>
<ows:ServiceType codeSpace="[URL unfurl="true"]http://opengeospatial.net">OGC:SOS</ows:ServiceType>[/URL]
<ows:ServiceTypeVersion>1.0.0</ows:ServiceTypeVersion>
<ows:Fees>NONE</ows:Fees>
<ows:AccessConstraints>NONE</ows:AccessConstraints>
</ows:ServiceIdentification>
<ows:ServiceProvider>
<ows:ProviderName>National Data Buoy Center</ows:ProviderName>
<ows:ProviderSite xlink:href="[URL unfurl="true"]http://sdf.ndbc.noaa.gov/"/>[/URL]
I'm starting very modestly and trying to get the 'Title' like:
Code:
<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0" xmlns:xlink="[URL unfurl="true"]http://www.w3.org/1999/xlink"[/URL] xmlns:om="[URL unfurl="true"]http://www.opengis.net/om/1.0"[/URL] xmlns:gml="[URL unfurl="true"]http://www.opengis.net/gml/3.2"[/URL] xmlns:ioos="[URL unfurl="true"]http://www.noaa.gov/ioos/0.6.1"[/URL] xmlns:swe="[URL unfurl="true"]http://www.opengis.net/swe/1.0.2"[/URL] xmlns:xsl="[URL unfurl="true"]http://www.w3.org/1999/XSL/Transform">[/URL]
<xsl:output method="text" version="1.0" encoding="UTF-8" indent="yes"/>
<xsl:template match="/Capabilities">
<xsl:value-of select="ows:ServiceIdentification/ows:Title"/>
</xsl:template>
</xsl:stylesheet>
But, instead of just getting the contents of the 'ows:Title' element, I get the entire match for the template.
I would like to get just the 'ows:Title'. If I can learn what I'm doing wrong there, I think it will break the log jam.
TIA
'hope this helps
If you are new to Tek-Tips, please use descriptive titles, check the FAQs, and beware the evil typo.