50 likes | 236 Views
XSLT FGDC-to-DIF Translator. IDN Metadata Translation via XSLT. Extensible Stylesheet Language Transformations (XSLT) W3C Recommendation Version 1.0 XSLT transforms information marked up in XML from one vocabulary to another (O’Reilly XML.com)
E N D
IDN Metadata Translation via XSLT • Extensible Stylesheet Language Transformations (XSLT) • W3C Recommendation Version 1.0 • XSLT transforms information marked up in XML from one vocabulary to another (O’Reilly XML.com) • The IDN utilizes XSLT to translate heterogeneous metadata formats. • Currently used to translate NOAA NCDC and GeoConnections Canada FGDC metadata to IDN DIF. • Also used by GeoConnections Canada to translate IDN DIF to FGDC.
XSLT (FGDC-DIF) Translation Example FGDC XML 1. FGDC Spatial Coverage group before translation. <spdom> <bounding> <westbc> -180.0 </westbc> <eastbc>180.0 </eastbc> <northbc> 90.0 </northbc> <southbc> -90.0</southbc> </bounding> </spdom>
XSLT Stylesheet 2. The XML is parsed through an XSLT parser. • The XSLT stylesheet provides the parser with guidelines for mapping the XML. <!-- Spatial Coverage --> <xsl:template match="spdom"> <Spatial_Coverage><xsl:apply-templates select="bounding" /></Spatial_Coverage> </xsl:template> <xsl:template match="bounding"> <Southernmost_Latitude><xsl:apply-templates select="southbc" /></Southernmost_Latitude> <Northernmost_Latitude><xsl:apply-templates select="northbc" /></Northernmost_Latitude> <Westernmost_Longitude><xsl:apply-templates select="westbc" /></Westernmost_Longitude> <Easternmost_Longitude><xsl:apply-templates select="eastbc" /></Easternmost_Longitude> </xsl:template>
DIF XML 3. The XSLT parser outputs properly formed IDN DIF XML. <Spatial_Coverage> <Southernmost_Latitude> -90.0 </Southernmost_Latitude> <Northernmost_Latitude> 90.0 </Northernmost_Latitude> <Westernmost_Longitude> -180.0 </Westernmost_Longitude> <Easternmost_Longitude> 180.0 </Easternmost_Longitude> </Spatial_Coverage>