View stylesheet

XML schema http://biodiversity.eionet.europa.eu/schemas/dir9243eec/generalreport.xsd
Output type RDF
Description RDF output
XSL file art17-general-rdf.xsl (Last modified: 18 Nov 2014 17:20 )
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE xsl:stylesheet [
 <!ENTITY biogeo "http://dd.eionet.europa.eu/vocabulary/art17_2012/biogeoreg/">
 <!ENTITY countries "http://dd.eionet.europa.eu/vocabulary/art17_2006/countries/">
]>

<!-- $Id: art17-general-rdf.xsl 17149 2014-11-18 14:52:33Z roug $ -->

<xsl:stylesheet version="1.0"
  xmlns="http://rdfdata.eionet.europa.eu/article17/generalreport/"
  xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
  xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#"
>
<xsl:output method="xml" indent="yes"/>


<xsl:template match="report">
 <rdf:RDF>
   <xsl:attribute name="xml:lang"><xsl:value-of select="@xml:lang"/></xsl:attribute>

   <GeneralReport rdf:about="">
    <rdfs:label>Annex A report for Habitats directive article 17 in <xsl:value-of select="member-state"/></rdfs:label>
    <memberstate><xsl:value-of select="member-state"/></memberstate>
    <forCountry><xsl:attribute name="rdf:resource">&countries;<xsl:value-of select="member-state/@countrycode"/></xsl:attribute></forCountry>
    <xsl:call-template name="break-at-newlines">
      <xsl:with-param name="text" select="legal-framework/legal-texts"/>
      <xsl:with-param name="predicate" select="'legal-texts'"/>
    </xsl:call-template>

   <xsl:apply-templates/>

  </GeneralReport>
  </rdf:RDF>
</xsl:template>

<xsl:template match="regional">
      <xsl:apply-templates/>
</xsl:template>

<xsl:template match="community-importance|areas-of-conservation">
  <xsl:element name="{local-name()}">
    <xsl:attribute name="rdf:parseType">Resource</xsl:attribute>
     <region><xsl:attribute name="rdf:resource">&biogeo;<xsl:value-of select="../region"/></xsl:attribute></region>
     <total_number><xsl:value-of select="total/number"/></total_number>
     <total_area><xsl:value-of select="total/area"/></total_area>
     <marine_number><xsl:value-of select="marine/number"/></marine_number>
     <marine_area><xsl:value-of select="marine/area"/></marine_area>
 </xsl:element>
</xsl:template>

<xsl:template match="management-tools/management-plans/plans-list">
  <management-plan rdf:parseType="Resource">
    <xsl:apply-templates mode="simplepredicate"/>
  </management-plan>
</xsl:template>

<xsl:template match="management-tools/other-planning/other-list">
  <other-plan rdf:parseType="Resource">
    <xsl:apply-templates mode="simplepredicate"/>
  </other-plan>
</xsl:template>

<xsl:template match="management-tools/non-planning/not-plan-list">
  <non-territorial-plan rdf:parseType="Resource">
    <xsl:apply-templates mode="simplepredicate"/>
  </non-territorial-plan>
</xsl:template>

<xsl:template match="conservation-measures|deterioration-measures|coherence-measures|surveillance-system|education">
  <xsl:element name="{local-name()}">
  <xsl:attribute name="rdf:parseType">Resource</xsl:attribute>
    <xsl:apply-templates mode="simplepredicate"/>
  </xsl:element>
</xsl:template>

<xsl:template match="sitecode" mode="simplepredicate">
    <xsl:call-template name="one-resource-predicate">
        <xsl:with-param name="text" select="text()"/>
        <xsl:with-param name="predicate" select="local-name()"/>
        <xsl:with-param name="table" select="'http://eunis.eea.europa.eu/sites'"/>
    </xsl:call-template>
    <!--
  <xsl:if test="text() != ''">
      <xsl:element name="{local-name()}">
        <xsl:attribute name="rdf:resource">http://eunis.eea.europa.eu/sites/<xsl:value-of select="text()"/></xsl:attribute>
      </xsl:element>
  </xsl:if>
  -->
</xsl:template>

<xsl:template match="*" mode="simplepredicate">
  <xsl:if test="text() != ''">
      <xsl:element name="{local-name()}">
        <xsl:value-of select="text()"/>
      </xsl:element>
  </xsl:if>
</xsl:template>

<xsl:template name="fill-multiple">
  <xsl:param name="text"/>
  <xsl:param name="predicate"/>
  <xsl:param name="table"/>
    <xsl:choose>
            <xsl:when test="contains($text, ' ')">
                    <xsl:call-template name="one-resource-predicate">
                        <xsl:with-param name="text" select="substring-before($text, ' ')"/>
                        <xsl:with-param name="predicate" select="$predicate"/>
                        <xsl:with-param name="table" select="$table"/>
                    </xsl:call-template>

                    <xsl:text disable-output-escaping="yes"> </xsl:text>
                    <xsl:call-template name="fill-multiple">
                        <xsl:with-param name="text" select="substring-after($text, ' ')"/>
                        <xsl:with-param name="predicate" select="$predicate"/>
                        <xsl:with-param name="table" select="$table"/>
                    </xsl:call-template>
            </xsl:when>
            <xsl:when test="$text=''"/>
            <xsl:otherwise>
                <xsl:call-template name="one-resource-predicate">
                    <xsl:with-param name="text" select="$text"/>
                    <xsl:with-param name="predicate" select="$predicate"/>
                    <xsl:with-param name="table" select="$table"/>
                </xsl:call-template>
            </xsl:otherwise>
    </xsl:choose>
</xsl:template>





<xsl:template name="one-resource-predicate">
  <xsl:param name="text"/>
  <xsl:param name="predicate"/>
  <xsl:param name="table"/>
  <xsl:if test="string-length($text)!=0">
    <xsl:element name="{$predicate}">
      <xsl:attribute name="rdf:resource"><xsl:value-of select="$table"/>/<xsl:value-of select="$text"/></xsl:attribute>
    </xsl:element>
  </xsl:if>
</xsl:template>

<xsl:template name="break-at-newlines">
  <xsl:param name="text"/>
  <xsl:param name="predicate"/>
    <xsl:choose>
            <xsl:when test="contains($text, '&#13;')">
                    <xsl:call-template name="one-literal-predicate">
                        <xsl:with-param name="text" select="substring-before($text, '&#13;')"/>
                        <xsl:with-param name="predicate" select="$predicate"/>
                    </xsl:call-template>
                    <xsl:call-template name="break-at-newlines">
                        <xsl:with-param name="text" select="substring-after($text, '&#13;')"/>
                        <xsl:with-param name="predicate" select="$predicate"/>
                    </xsl:call-template>
            </xsl:when>
            <xsl:when test="$text=''"/>
            <xsl:otherwise>
                <xsl:call-template name="one-literal-predicate">
                    <xsl:with-param name="text" select="$text"/>
                    <xsl:with-param name="predicate" select="$predicate"/>
                </xsl:call-template>
            </xsl:otherwise>
    </xsl:choose>
</xsl:template>

<xsl:template name="one-literal-predicate">
  <xsl:param name="text"/>
  <xsl:param name="predicate"/>
  <xsl:element name="{$predicate}">
    <xsl:value-of select="$text"/>
  </xsl:element>
</xsl:template>

<xsl:template match="text()"/>

</xsl:stylesheet>