View stylesheet

XML schema
Output type HTML
Description FGases stocks converters
XSL file fgases-stocks.xsl (Last modified: 02 Feb 2016 15:00 )
<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:param name="transactionYear"/>

    <xsl:template match="/">
        <stocks>
            <xsl:choose>
                <xsl:when test="count(/child::*/child::*[portal_code = $companyId and transaction_year = $transactionYear]) = 0">
                    <stock />
                </xsl:when>
                <xsl:otherwise>
                    <xsl:for-each select="/child::*/child::*[portal_code = $companyId and transaction_year = $transactionYear]">
                        <stock>
                            <xsl:element name="transactionCode"><xsl:value-of select="transaction_code"/></xsl:element>
                            <xsl:element name="gasId"><xsl:value-of select="gas_id"/></xsl:element>
                            <xsl:element name="amount"><xsl:value-of select="amount_mix"/></xsl:element>
                        </stock>
                    </xsl:for-each>
                </xsl:otherwise>
            </xsl:choose>
        </stocks>
    </xsl:template>

</xsl:stylesheet>