View stylesheet

XML schema
Output type HTML
Description FGases quotas selector
XSL file fgases-quotas.xsl (Last modified: 02 Feb 2016 15:01 )
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

    <xsl:output method="xml" indent="yes" encoding="UTF-8"/>

    <xsl:param name="companyId"/>

    <xsl:template match="/">
        <dataroot>
            <xsl:choose>
                <xsl:when test="count(/child::*/child::*[CompanyID=$companyId]) = 0">
                    <quotas>
                        <xsl:element name="companyId" />
                        <xsl:element name="availableQuota" />
                        <xsl:element name="allocatedQuota" />
                    </quotas>
                </xsl:when>
                <xsl:otherwise>
                    <xsl:for-each select="/child::*/child::*[CompanyID=$companyId][1]">
                        <quotas>
                            <xsl:element name="companyId"><xsl:value-of select="CompanyID"/></xsl:element>
                            <xsl:element name="availableQuota"><xsl:value-of select="AvailableQuota"/></xsl:element>
                            <xsl:element name="allocatedQuota"><xsl:value-of select="AllocatedQuota"/></xsl:element>
                        </quotas>
                    </xsl:for-each>
                </xsl:otherwise>
            </xsl:choose>
        </dataroot>
    </xsl:template>

</xsl:stylesheet>