View stylesheet

XML schema http://dd.eionet.europa.eu/v2/dataset/3458/schema-dst-3458.xsd
Output type XML
Description Removes optionals
XSL file UWWTD--clear.xsl (Last modified: 18 Jun 2020 12:24 )
<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

    <xsl:output method="xml" indent="yes" omit-xml-declaration="no"/>
    <xsl:strip-space elements="*"/>

    <xsl:variable name="reporter" select="('rptMStateValue', 'rptCulture', 'mslWWReuseExplain')" />
    <xsl:variable name="contacts" select="('conStreet', 'conZIP', 'conCity', 'conFax', 'conRemarks')" />
    <xsl:variable name="areassamain" select="('rcaArt58DateDesign', 'rcaDateArt58', 'rcaDateArt54', 'rcaHyperlink', 'rcaBeginLife', 'rcaEndLife', 'rcaRemarks')" />
    <xsl:variable name="areassaparam" select="('rcaStartDate', 'rcaCRelevantDirective', 'rcaCIDOtherDirective', 'rcaCDateOtherDirective')" />
    <xsl:variable name="areaslsa" select="('rcaMorphology', 'rcaHydrology', 'rcaHydraulic', 'rcaAbsenceRisk', 'rcaHyperlink', 'rcaBeginLife', 'rcaEndLife', 'rcalsaRemarks')" />
    <xsl:variable name="areassasa" select="('rcaRelatedSARemark')" />
    <xsl:variable name="areassalsapredecessor" select="('rcasalsaRemark')" />
    <xsl:variable name="agglomerations" select="('aggName','aggNUTS','aggLatitude','aggLongitude','bigCityID','aggCalculation',
    'aggChanges','aggChangesComment','aggDateArt4','aggDateArt5','aggC1','aggMethodC1','aggC2','aggMethodC2','aggPercWithoutTreatment',
    'aggMethodWithoutTreatment','aggPercPrimTreatment','aggPercSecTreatment','aggPercStringentTreatment','aggHaveRegistrationSystem',
    'aggExistMaintenancePlan','aggPressureTest','aggVideoInspections','aggOtherMeasures','aggExplanationOther','aggSewageNetwork',
    'aggBestTechnicalKnowledge','aggDilutionRates','aggCapacity','aggAccOverflows','aggAccOverflowNumber','aggSewerOverflows_m3',
    'aggSewerOverflows_pe','aggForecast','aggBeginLife','aggEndLife','aggHyperlink','aggRemarks')" />
    <xsl:variable name="uwwtps" select="('aggCode','uwwDateClosing','uwwHistorie','uwwLatitude','uwwLongitude',
    'uwwNUTS','uwwLoadEnteringUWWTP','uwwCapacity','uwwPrimaryTreatment','uwwSecondaryTreatment','uwwOtherTreatment',
    'uwwNRemoval','uwwPRemoval','uwwUV','uwwChlorination','uwwOzonation','uwwSandFiltration','uwwMicroFiltration','uwwOther',
    'uwwSpecification','uwwBOD5Perf','uwwCODPerf','uwwTSSPerf','uwwNTotPerf','uwwPTotPerf','uwwOtherPerf','uwwBadPerformance',
    'uwwAccidents','uwwBadDesign','uwwInformation','uwwBODIncomingMeasured','uwwBODIncomingCalculated','uwwBODIncomingEstimated',
    'uwwCODIncomingMeasured','uwwCODIncomingCalculated','uwwCODIncomingEstimated','uwwNIncomingMeasured','uwwNIncomingCalculated',
    'uwwNIncomingEstimated','uwwPIncomingMeasured','uwwPIncomingCalculated','uwwPIncomingEstimated','uwwBODDischargeMeasured',
    'uwwBODDischargeCalculated','uwwBODDischargeEstimated','uwwCODDischargeMeasured','uwwCODDischargeCalculated','uwwCODDischargeEstimated',
    'uwwNDischargeMeasured','uwwNDischargeCalculated','uwwNDischargeEstimated','uwwPDischargeMeasured','uwwPDischargeCalculated','uwwPDischargeEstimated',
    'uwwWasteWaterTreated','uwwMethodWasteWaterTreated','uwwBeginLife','uwwEndLife','uwwHyperlink','uwwRemarks')" />
    <xsl:variable name="uwwtpagglos" select="('aucUwwName', 'aucAggName', 'aucPercEnteringUWWTP', 'aucMethodPercEnteringUWWTP', 'aucPercC2T')" />
    <xsl:variable name="dischargepoints" select="('dcpNUTS','dcpLatitude','dcpLongitude','dcpIrrigation','rcaCode','dcpWaterbodyID',
    'dcpNotAffect','dcpMSProvide','dcpCOMAccept','dcpGroundWater','dcpReceivingWater','dcpWaterBodyReferenceDate','dcpGroundWaterReferenceDate',
    'dcpReceivingWaterReferenceDate','dcpWFDSubUnitReferenceDate','dcpWFDRBDReferenceDate','dcpBeginLife','dcpEndLife','dcpRemarks')" />
    <xsl:variable name="mslevel" select="('mslDischargePipelines','mslDischargeShips','mslDischargeOthers',
    'mslReuseSoilAgriculture','mslReuseOthers','mslDisposalLandfill','mslDisposalIncineration','mslDisposalOthers',
    'mslWWReusePerc','mslWWReuseAgri','mslWWReuseInd','mslWWReuseOther','mslWWReuseExplain','mslRemarks')" />
    <xsl:variable name="industries" select="('indNamePlant', 'indBranch', 'indOrganicLoad', 'indConditions', 'indDateCompliance')" />

    <xsl:template match="node()|@*">
        <xsl:choose>
            <xsl:when test="./local-name() = ($reporter, $contacts, $areassamain, $areassaparam, $areaslsa, $areassasa,
            $areassalsapredecessor, $agglomerations, $uwwtps, $uwwtpagglos, $dischargepoints, $mslevel, $industries)">
                <!-- Remove empty optional elements -->
                <xsl:if test=". != ''">
                    <xsl:copy>
                        <xsl:apply-templates select="node()|@*"/>
                    </xsl:copy>
                </xsl:if>
            </xsl:when>
            <xsl:otherwise>
                <xsl:copy>
                    <xsl:apply-templates select="node()|@*"/>
                </xsl:copy>
            </xsl:otherwise>
        </xsl:choose>
    </xsl:template>
</xsl:stylesheet>