Collectives™ on Stack Overflow
Find centralized, trusted content and collaborate around the technologies you use most.
Learn more about Collectives
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
Learn more about Teams
I have an XSL file by which I would like to convert an XML file.
This XML file has been obtained renaming the original file which had .safe extension. here you can see its first lines
<?xml version="1.0" encoding="UTF-8"?>
<xfdu:XFDU xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:gml="http://www.opengis.net/gml"
xmlns:xfdu="urn:ccsds:schema:xfdu:1" xmlns:safe="http://www.esa.int/safe/sentinel-1.0" xmlns:s1="http://www.esa.int/safe/sentinel-1.0/sentinel-1"
xmlns:s1sar="http://www.esa.int/safe/sentinel-1.0/sentinel-1/sar" xmlns:s1sarl1="http://www.esa.int/safe/sentinel-1.0/sentinel-1/sar/level-1"
xmlns:s1sarl2="http://www.esa.int/safe/sentinel-1.0/sentinel-1/sar/level-2" xmlns:gx="http://www.google.com/kml/ext/2.2"
version="esa/safe/sentinel-1.0/sentinel-1/sar/level-1/slc/standard/iwdp">
let's say I would like to extract the value ASCENDING
<metadataObject ID="measurementOrbitReference" classification="DESCRIPTION" category="DMD">
<metadataWrap mimeType="text/xml" vocabularyName="SAFE" textInfo="Orbit Reference">
<xmlData>
<safe:orbitReference>
<safe:orbitNumber type="start">11987</safe:orbitNumber>
<safe:orbitNumber type="stop">11987</safe:orbitNumber>
<safe:relativeOrbitNumber type="start">15</safe:relativeOrbitNumber>
<safe:relativeOrbitNumber type="stop">15</safe:relativeOrbitNumber>
<safe:cycleNumber>83</safe:cycleNumber>
<safe:phaseIdentifier>1</safe:phaseIdentifier>
<safe:extension>
<s1:orbitProperties>
<s1:pass>ASCENDING</s1:pass>
<s1:ascendingNodeTime>2016-07-03T17:02:32.742483</s1:ascendingNodeTime>
</s1:orbitProperties>
</safe:extension>
</safe:orbitReference>
</xmlData>
</metadataWrap>
</metadataObject>
I'm trying in this way
<xsl:template match="/">
<xsl:value-of select="/metadataSection/metadataObject/metadataWrap/xmlData/safe:acquisitionPeriod/safe:startTime" />
</xsl:template>
or (if I call this file as an external XML file)
<xsl:value-of select="document('file:///C:/workspace/S2_XSLtest/S1_XSLtest/NEW_S1manifest.xml')/metadataSection/metadataObject/metadataWrap/xmlData/safe:acquisitionPeriod/safe:startTime" />
in both cases I'm getting the following error:
ERROR [main] JAXPSAXProcessorInvoker - Namespace prefix 'safe' is undeclared.
any suggestions would be really appreciated because I'm a begginner with the XSL transformation.
I'm using a WINDOWS machine with ECLIPSE Version: Mars.2 Release (4.5.2)
in your xslt, best at top level:
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:safe="http://www.esa.int/safe/sentinel-1.0" ...
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.