View stylesheet

XML schemas http://water.eionet.europa.eu/schemas/dir200060ec/Monitoring.xsd
Output type RDF
Description RDF for Content Registry
XSL file Monitoring-rdf.xsl (Last modified: 01 Apr 2011 13:24 )
<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
    xmlns:dct="http://purl.org/dc/terms/"
    xmlns:m="http://wise.jrc.cec.eu.int"
    xmlns="http://rdfdata.eionet.europa.eu/wise/ontology/"
    version="1.0">

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

<!--
     $Id: Monitoring-rdf.xsl 9507 2011-04-01 11:22:54Z roug $
-->

<xsl:template match="m:MONITORING">
<rdf:RDF>

 <rdf:Description rdf:about="">
  <dct:created><xsl:value-of select="@CreationDate"/></dct:created>
  <dct:creator><xsl:value-of select="@Creator"/></dct:creator>
  <GENERATEDBY><xsl:value-of select="@GeneratedBy"/></GENERATEDBY>
  <!--
 <EMAIL><xsl:value-of select="@Email"/></EMAIL>
 -->
  <CLASSIFICATION><xsl:call-template name="ClassificationCode"><xsl:with-param name="Param" select="@MD_ClassificationCode"/></xsl:call-template></CLASSIFICATION>
     <xsl:apply-templates select="m:C_CD"/>
     <xsl:apply-templates select="m:DIST_CD"/>
     <xsl:apply-templates select="m:NAME"/>
     <xsl:apply-templates select="m:REPORTING_LEVEL"/>
     <xsl:apply-templates select="m:REPORTING_LEVEL_DESCRIPTION"/>
     <!--
     <xsl:apply-templates select="m:ASSOC_DOC_REF"/>
     <xsl:apply-templates select="m:URL"/>
     -->
 </rdf:Description>
     <xsl:apply-templates select="m:SWPROGRAMMES"/>
     <xsl:apply-templates select="m:GWPROGRAMMES"/>
</rdf:RDF>
</xsl:template>

<xsl:template match="m:SWPROGRAMMES|m:GWPROGRAMMES|m:QUALITY_ELEMENTS">
   <xsl:apply-templates/>
</xsl:template>

<xsl:template match="m:SWPROGRAMME|m:GWPROGRAMME">
 <xsl:element name="{local-name()}">
  <xsl:attribute name="rdf:ID"><xsl:value-of select="m:PROGRAMME_CD"/></xsl:attribute>
   <inDeclaration rdf:resource=""/>
   <xsl:apply-templates/>
 </xsl:element>
</xsl:template>

<xsl:template match="m:QUALITY_ELEMENT">
 <xsl:element name="{local-name()}">
  <xsl:if test="local-name(../..) != 'SUB_PROGRAMME'">
      <xsl:attribute name="rdf:ID"><xsl:value-of select="m:QE_CD"/>-<xsl:value-of select="m:CATEGORY"/></xsl:attribute>
  </xsl:if>
  <xsl:if test="local-name(../..) = 'SUB_PROGRAMME'">
      <xsl:attribute name="rdf:parseType">Resource</xsl:attribute>
  </xsl:if>
   <inDeclaration rdf:resource=""/>
   <forQualityElement>
    <xsl:attribute name="rdf:resource">http://rdfdata.eionet.europa.eu/wise/qualityelements/<xsl:value-of select="m:QE_CD"/></xsl:attribute>
   </forQualityElement>
   <xsl:apply-templates/>
 </xsl:element>
</xsl:template>

<xsl:template match="m:DIST_CD">
 <forRBD>
  <xsl:attribute name="rdf:resource">http://rdfdata.eionet.europa.eu/wise/rbd/<xsl:value-of select="."/></xsl:attribute>
 </forRBD>
 <xsl:element name="{local-name()}">
  <xsl:value-of select="."/>
 </xsl:element>
</xsl:template>

<xsl:template match="m:EU_CD">
 <forStation>
  <xsl:attribute name="rdf:resource">http://rdfdata.eionet.europa.eu/wise/gwmstations/<xsl:value-of select="."/></xsl:attribute>
 </forStation>
 <forRBD>
  <xsl:attribute name="rdf:resource">http://rdfdata.eionet.europa.eu/wise/rbd/<xsl:value-of select="/m:GROUNDWATERMONITORINGSTATIONS/m:DIST_CD"/></xsl:attribute>
 </forRBD>
 <xsl:element name="{local-name()}">
  <xsl:value-of select="."/>
 </xsl:element>
</xsl:template>

<xsl:template match="m:PROT_AREAS">
   <xsl:apply-templates mode="ignore"/>
</xsl:template>

<xsl:template match="m:PROGRAMMES|m:PARAMETERS|m:SUB_PROGRAMMES">
   <xsl:apply-templates/>
</xsl:template>

<xsl:template match="m:GWPROGRAMMES/m:PARAMETERS/m:PARAMETER">
 <xsl:element name="{local-name()}">
  <xsl:attribute name="rdf:ID"><xsl:value-of select="m:PARAMETER_CD"/></xsl:attribute>
  <rdf:type><xsl:attribute name="rdf:resource">http://rdfdata.eionet.europa.eu/wise/ontology/<xsl:value-of select="local-name()"/></xsl:attribute></rdf:type>
   <xsl:apply-templates/>
 </xsl:element>
</xsl:template>

<xsl:template match="m:PROGRAMME|m:PARAMETER|m:ASSOC_WB|m:SUB_PROGRAMME">
 <xsl:element name="{local-name()}">
  <xsl:attribute name="rdf:parseType">Resource</xsl:attribute>
   <rdf:type><xsl:attribute name="rdf:resource">http://rdfdata.eionet.europa.eu/wise/ontology/<xsl:value-of select="local-name()"/></xsl:attribute></rdf:type>
   <xsl:apply-templates/>
 </xsl:element>
</xsl:template>

<xsl:template match="m:PROGRAMME_CD">
 <forProgramme>
  <xsl:attribute name="rdf:resource">http://rdfdata.eionet.europa.eu/wise/programmes/<xsl:value-of select="."/></xsl:attribute>
 </forProgramme>
 <xsl:element name="{local-name()}">
  <xsl:value-of select="."/>
 </xsl:element>
</xsl:template>

<xsl:template match="m:WB_CD|m:WB_LOCATION">
 <forWB>
  <xsl:attribute name="rdf:resource">http://rdfdata.eionet.europa.eu/wise/waterbodies/<xsl:value-of select="."/></xsl:attribute>
 </forWB>
 <xsl:element name="{local-name()}">
  <xsl:value-of select="."/>
 </xsl:element>
</xsl:template>

<xsl:template match="m:PARAMETER_CD">
 <forParameter>
  <xsl:attribute name="rdf:resource">http://rdfdata.eionet.europa.eu/wise/parameters/<xsl:value-of select="."/></xsl:attribute>
 </forParameter>
 <xsl:element name="{local-name()}">
  <xsl:value-of select="."/>
 </xsl:element>
</xsl:template>

<xsl:template match="m:QUALITY_ELEMENT" mode="subprogramme">
 <xsl:element name="{local-name()}">
   <rdf:type><xsl:attribute name="rdf:resource">http://rdfdata.eionet.europa.eu/wise/ontology/<xsl:value-of select="local-name()"/></xsl:attribute></rdf:type>
   <forQualityElement>
     <xsl:attribute name="rdf:resource">http://rdfdata.eionet.europa.eu/wise/qualityelements/<xsl:value-of select="m:QE_CD"/></xsl:attribute>
   </forQualityElement>
   <xsl:apply-templates/>
 </xsl:element>
</xsl:template>


<!-- integer elements -->
<!-- We don't know if the users can put non-numeric data into these fields -->
<!--
<xsl:template match="m:NO_BATHING_SITES|m:NO_BATHING|m:NO_FISH|m:NO_FISH_SITES|m:NO_NITRATES|m:NO_NITRATES_SITES|m:NO_UWWT|m:NO_UWWT_SITES|m:NO_ABSTRACTION|m:NO_ABSTRACTION_SITES">
 <xsl:element name="{local-name()}">
   <xsl:attribute name="rdf:datatype">http://www.w3.org/2001/XMLSchema#integer</xsl:attribute>
   <xsl:value-of select="."/>
 </xsl:element>
</xsl:template>
-->

<!-- boolean elements -->
<xsl:template match="m:QUANTITATIVE|m:CHEM_SURVEIL|m:CHEM_OPERAT|m:DRINK_WATER|m:IND_SUPPLY|m:ADDITIONAL_REQS|m:IRRIGATION|m:OTHER_SUPPLY">
 <xsl:element name="{local-name()}">
  <xsl:attribute name="rdf:datatype">http://www.w3.org/2001/XMLSchema#boolean</xsl:attribute>
  <xsl:if test=". = 'Y'">true</xsl:if>
  <xsl:if test=". = 'Yes'">true</xsl:if>
  <xsl:if test=". = 'N'">false</xsl:if>
  <xsl:if test=". = 'No'">false</xsl:if>
 </xsl:element>
</xsl:template>

<xsl:template match="*">
 <xsl:element name="{local-name()}">
  <xsl:value-of select="."/>
 </xsl:element>
</xsl:template>

<xsl:template match="*" mode="ignore"/>


<!-- YesNoUnknown implementation -->
<xsl:template name="YesNoUnknown">
        <xsl:param name="Param"/>
        <xsl:choose>
                <xsl:when test="$Param = 'Y'">Yes</xsl:when>
                <xsl:when test="$Param = 'N'">No</xsl:when>
                <xsl:when test="$Param = 'U'">Unknown</xsl:when>
                <xsl:when test="$Param = 'NA'">Not Applicable</xsl:when>
        </xsl:choose>
</xsl:template>

<!-- Classification code implementation -->
<xsl:template name="ClassificationCode">
        <xsl:param name="Param"/>
        <xsl:choose>
                <xsl:when test="$Param = '001'">Unclassified - available for general circulation</xsl:when>
                <xsl:when test="$Param = '003'">Confidential - available for EC reporting only</xsl:when>
        </xsl:choose>
</xsl:template>



<!-- WaterBodyCategory implementation -->
<xsl:template name="WaterBodyCategory">
        <xsl:param name="Param"/>
        <xsl:choose>
                <xsl:when test="$Param = 'RW'">River</xsl:when>
                <xsl:when test="$Param = 'LW'">Lake</xsl:when>
                <xsl:when test="$Param = 'TW'">Transitional</xsl:when>
                <xsl:when test="$Param = 'CW'">Coastal</xsl:when>
        </xsl:choose>
</xsl:template>

<!-- Reporting Level implementation -->
<xsl:template name="ReportingLevel">
        <xsl:param name="Param"/>
        <xsl:choose>
                <xsl:when test="$Param = 'I'">International RBD</xsl:when>
                <xsl:when test="$Param = 'N'">National part of an international RBD</xsl:when>
                <xsl:when test="$Param = 'R'">National RBD</xsl:when>
                <xsl:when test="$Param = 'S'">Regional part or sub-unit of RBD</xsl:when>
        </xsl:choose>
</xsl:template>

<!-- Programme Level implementation -->
<xsl:template name="ProgrammeLevel">
        <xsl:param name="Param"/>
        <xsl:choose>
                <xsl:when test="$Param = 'I'">International</xsl:when>
                <xsl:when test="$Param = 'N'">National</xsl:when>
                <xsl:when test="$Param = 'R'">RBD</xsl:when>
        </xsl:choose>
</xsl:template>

<!-- Incident type implementation -->
<xsl:template name="IncidentType">
        <xsl:param name="Param"/>
        <xsl:choose>
                <xsl:when test="$Param = 'E'">Unknown exceedence</xsl:when>
                <xsl:when test="$Param = 'F'">Failure of objectives</xsl:when>
                <xsl:when test="$Param = 'R'">Incident response</xsl:when>
                <xsl:when test="$Param = 'O'">Other</xsl:when>
        </xsl:choose>
</xsl:template>

</xsl:stylesheet>