View stylesheet

XML schema http://www.eionet.europa.eu/schemas/eprtr/PollutantReleaseAndTransferReport_2p0.xsd
Output type RDF
Description RDF for Content Registry
XSL file eprtr-to-rdf.xsl (Last modified: 11 May 2010 11:20 )
<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    xmlns:rsm="urn:eu:com:env:prtr:data:standard:2"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
    version="1.0">

<xsl:output method="xml" indent="yes" />

<xsl:template match="rsm:PollutantReleaseAndTransferReport">
<rdf:RDF xmlns="http://rdfdata.eionet.europa.eu/eprtr/dataflow/">
 <rdf:Description rdf:about="">
     <xsl:apply-templates select="rsm:CoordinateSystemID" mode="predicates"/>
     <xsl:apply-templates select="rsm:CountryID" mode="predicates"/>
     <xsl:apply-templates select="rsm:ReportingYear" mode="predicates"/>
     <xsl:apply-templates select="rsm:CompetentAuthorityParty" mode="predicates"/>
 </rdf:Description>
     <xsl:apply-templates select="rsm:FacilityReport" mode="resource"/>
</rdf:RDF>
</xsl:template>


<xsl:template match="rsm:FacilityReport" mode="resource"  xmlns="http://rdfdata.eionet.europa.eu/eprtr/dataflow/">
  <xsl:element name="{local-name()}" namespace="http://rdfdata.eionet.europa.eu/eprtr/dataflow/">
   <xsl:attribute name="rdf:ID"><xsl:value-of select="/rsm:PollutantReleaseAndTransferReport/rsm:CountryID"/><xsl:value-of select="translate(rsm:NationalID,'/','_')"/> 
   </xsl:attribute>
   <declarationFor>
    <xsl:attribute name="rdf:resource">http://rdfdata.eionet.europa.eu/eprtr/facilities/<xsl:value-of select="rsm:NationalID"/></xsl:attribute>
   </declarationFor>
   <xsl:apply-templates mode="predicates"/>
  </xsl:element>
</xsl:template>

<xsl:template match="rsm:Activity" mode="predicates" xmlns="http://rdfdata.eionet.europa.eu/eprtr/dataflow/">
 <Activity rdf:parseType="Resource">
   <ActivityCodes><xsl:value-of select="@code"/></ActivityCodes>
   <xsl:apply-templates mode="predicates"/>
 </Activity>
</xsl:template>

<xsl:template match="rsm:WasteHandlerParty|
       rsm:Address|rsm:SiteAddress|
       rsm:CompetentAuthorityParty|rsm:WasteTransfer|rsm:PollutantRelease|
       rsm:PollutantTransfer|rsm:MethodUsed|rsm:PreviousNationalID|rsm:ProductionVolume|rsm:WebsiteCommunication"
          mode="predicates" xmlns="http://rdfdata.eionet.europa.eu/eprtr/dataflow/">
 <xsl:element name="{local-name()}" namespace="http://rdfdata.eionet.europa.eu/eprtr/dataflow/">
 <xsl:attribute name="rdf:parseType">Resource</xsl:attribute>
   <xsl:apply-templates mode="predicates"/>
 </xsl:element>
</xsl:template>

<!-- Drop redundant structure -->
<xsl:template match="rsm:GeographicalCoordinate" mode="predicates" xmlns="http://rdfdata.eionet.europa.eu/eprtr/dataflow/">
   <xsl:apply-templates mode="predicates"/>
</xsl:template>

<xsl:template match="rsm:AccidentalQuantity|rsm:Quantity|rsm:TotalQuantity" mode="predicates" xmlns="http://rdfdata.eionet.europa.eu/eprtr/dataflow/">
 <xsl:element name="{local-name()}" namespace="http://rdfdata.eionet.europa.eu/eprtr/dataflow/">
 <xsl:attribute name="rdf:parseType">Resource</xsl:attribute>
  <rdf:value><xsl:value-of select="."/></rdf:value>
  <unitCode><xsl:value-of select="@unitCode"/></unitCode>
 </xsl:element>
</xsl:template>

<xsl:template match="rsm:NutsRegionID" mode="predicates">
 <xsl:element name="{local-name()}" namespace="http://rdfdata.eionet.europa.eu/eprtr/dataflow/">
  <xsl:attribute name="rdf:resource">http://rdfdata.eionet.europa.eu/ramon/nuts/<xsl:value-of select="."/></xsl:attribute>
 </xsl:element>
</xsl:template>

<xsl:template match="rsm:RiverBasinDistrictID" mode="predicates">
 <xsl:element name="{local-name()}" namespace="http://rdfdata.eionet.europa.eu/eprtr/dataflow/">
  <xsl:attribute name="rdf:resource">http://rdfdata.eionet.europa.eu/wise/rbd/<xsl:value-of select="."/></xsl:attribute>
 </xsl:element>
</xsl:template>

<xsl:template match="*" mode="predicates">
 <xsl:element name="{local-name()}" namespace="http://rdfdata.eionet.europa.eu/eprtr/dataflow/">
  <xsl:value-of select="."/>
 </xsl:element>
</xsl:template>

</xsl:stylesheet>