<!--                                                                  -->
<!--  Copyright (C) 2011 RoyaltyShare, Inc.   All Rights Reserved     -->
<!--                                                                  -->
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0" xmlns:dyn="http://exslt.org/dynamic"
                extension-element-prefixes="dyn">
    <xsl:output method="html" indent="no" doctype-system="" encoding="utf-8" />

    <xsl:template name="showCriteria">
        <xsl:for-each select="/Root/Form/Parameters/*/*">
            <xsl:sort select="number(@order)" data-type="number"/>
            <xsl:if test="name(../.) = 'Criteria' or name(../.) = 'Groups'">
                <xsl:choose>
                    <xsl:when test="name(.) = 'Consolidate' ">
                        <div><br/></div>
                        <fieldset class="Form-fieldset Form-fieldset-line-top" style="margin-bottom: 10px">
                            <div class="Form-item Form-item-standart {name(.)}">
                                <xsl:call-template name="reportInput">
                                    <xsl:with-param name="type">
                                        <xsl:value-of select="@type"/>
                                    </xsl:with-param>
                                    <xsl:with-param name="display">
                                        <xsl:value-of select="@display"/>
                                    </xsl:with-param>
                                    <xsl:with-param name="name">
                                        <xsl:value-of select="name(.)"/>
                                    </xsl:with-param>
                                    <xsl:with-param name="value">
                                        <xsl:value-of select="."/>
                                    </xsl:with-param>
                                    <xsl:with-param name="fieldType">Criteria</xsl:with-param>
                                </xsl:call-template>
                            </div>
                        </fieldset>
                    </xsl:when>
                    <xsl:otherwise>
                        <div class="Form-item Form-item-standart {name(.)}">
                            <xsl:call-template name="reportInput">
                                <xsl:with-param name="type">
                                    <xsl:value-of select="@type"/>
                                </xsl:with-param>
                                <xsl:with-param name="display">
                                    <xsl:value-of select="@display"/>
                                </xsl:with-param>
                                <xsl:with-param name="name">
                                    <xsl:value-of select="name(.)"/>
                                </xsl:with-param>
                                <xsl:with-param name="value">
                                    <xsl:value-of select="."/>
                                </xsl:with-param>
                                <xsl:with-param name="fieldType">Criteria</xsl:with-param>
                            </xsl:call-template>
                        </div>
                    </xsl:otherwise>
                </xsl:choose>
            </xsl:if>
        </xsl:for-each>
        <xsl:if test="Params/Group='Sales'">
            <div class="Form-item Form-item-standart reportName">
                <label class="Form-label" for="Parameters_ReportName">
                    <span class="Form-label-caption">Name Your Report</span>
                    <div class="Form-input-wrapper">
                        <input id="Parameters_ReportName" name="Parameters_ReportName" class="Input Form-input"/>
                    </div>
                </label>
            </div>
        </xsl:if>
    </xsl:template>
</xsl:stylesheet>
