[2.7.7] : Direct Processing

Subject: [2.7.7] : Direct Processing
From: "G. Ken Holman" <gkholman@xxxxxxxxxxxxxx>
Date: Wed, 09 Sep 1998 20:26:36 -0400
Is there a difference between the example shown in 2.7.7:

<xsl:template match="/">
  <HTML>
    <HEAD>
      <TITLE>Customers</TITLE>
    </HEAD>
    <BODY>
      <TABLE>
    <TBODY>
      <xsl:for-each select="customers/customer">
        <TR>
          <TH>
        <xsl:process select="name"/>
          </TH>
          <xsl:for-each select="order">
        <TD>
          <xsl:process-children/>
        </TD>
          </xsl:for-each>
        </TR>
      </xsl:for-each>
    </TBODY>
      </TABLE>
    </BODY>
  </HTML>
</xsl:template>

and (preserving the indentation):

<xsl:template match="/">
  <HTML>
    <HEAD>
      <TITLE>Customers</TITLE>
    </HEAD>
    <BODY>
      <TABLE>
    <TBODY>

    <xsl:process select="customer"/>
    </TBODY>
      </TABLE>
    </BODY>
  </HTML>
</xsl:template>

      <xsl:template match="customers/customer">
        <TR>
          <TH>
        <xsl:process select="name"/>
          </TH>
        </TR>
      </xsl:template>

          <xsl:template match="order">
        <TD>
          <xsl:process-children/>
        </TD>
          </xsl:template>

?  If not, is the "for-each" considered just an alternative representation
of the same or is there somehow some performance difference?  And if not,
are there two techniques because one technique should be deprecated in
deference to the other?

I can see some users might prefer for-each over template because the root
template could mimic the output almost in the entirety (as your very
illustrative example shows) ... could this be the only "benefit"?

........ Ken


--
G. Ken Holman               mailto:gkholman@xxxxxxxxxxxxxx
Crane Softwrights Ltd.  http://www.CraneSoftwrights.com/s/
Box 266,                                V: +1(613)489-0999
Kars, Ontario CANADA K0A-2E0            F: +1(613)489-0995
Training:   http://www.CraneSoftwrights.com/s/schedule.htm
Resources: http://www.CraneSoftwrights.com/s/resources.htm
Shareware: http://www.CraneSoftwrights.com/s/shareware.htm


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


Current Thread