[xsl] xsl:for-each immediately followed by xsl:if

Subject: [xsl] xsl:for-each immediately followed by xsl:if
From: "Mike Bandy" <michael.bandy@xxxxxxxxxxxxx>
Date: Fri, 1 Feb 2002 09:50:40 -0500
The faq says not to immediately follow an xsl:for-each with an xsl:if.  How
do I merge these into one statement?

Another newbie question - can I depend on the order of the tags and
attributes being delivered to my stylesheet in the same order as they were
listed in the XML file?  So a for-each runs through the entries in a
deterministic order or do I always have to sort first?

Thanks.

	Mike Bandy

-----------------

        <xsl:for-each select="record">
          <!-- Get the record number and test if we're in the requested
range -->
          <!-- Process this record if:
		    1) record_num tag doesn't exist
		 or 2) $paramLoRec is -1
		 or 3) record_num between $paramLoRec and $paramHiRec -->
          <xsl:if
              test="( ( not (record_num) )
			or ( number($paramLoRec) = -1 )
			or ( (number(record_num) &gt;= number($paramLoRec))
			  and (number(record_num) &lt;= number($paramHiRec)) )
		    )">
            <!-- Process the record element -->
            <tr>
              <xsl:call-template name="do_data_row">
                <xsl:with-param name="fields" select="$fields"/>
              </xsl:call-template>
            </tr>
          </xsl:if>
        </xsl:for-each>




 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread