RE: [xsl] newbie question

Subject: RE: [xsl] newbie question
From: "Martinez, Brian" <brian.martinez@xxxxxxxx>
Date: Sat, 8 Mar 2003 12:00:52 -0700
> From: Michael Kay [mailto:mhk@xxxxxxxxx]
> Sent: Saturday, March 08, 2003 6:08 AM
> Subject: RE: [xsl] newbie question
> 
> > After hours of fumbling with xsl syntax this was of great 
> > help. Couldn't find a solution in w3c tutorial. Did I miss a 
> > concept that has a name? 
> 
> The name of the concept is "attribute value templates". Many 
> self-taught
> XSLT newcomers seem to miss it; I would love to know why.

I can't guess as to how often I've seen this, particularly in code from a
couple years ago when we were still learning XSLT:

<select name="flights">
  <xsl:for-each select="flight">
    <xsl:variable name="some-flight"><xsl:value-of
select="@flight-number"/></xsl:variable>
    <option value="{$some-flight}"><xsl:value-of
select="@airline"/>&#160;<xsl:value-of select="$some-flight"/></option>
  </xsl:for-each>
</select>

This illustrates the two biggest examples of sloppy code that I'm currently
fixing: creating virtually every variable as an RTF, and creating needless
variables in the first place.  I think if newbies follow the same path I
did, they learn a lot about the XSLT elements but don't get too excited
about XPath beyond the basic patterns.  Yet IMO that's where the true power
of XSLT lies.  Perhaps if so many newbies struggle with advanced XPath, that
points to a weakness in some of the educational materials, at least what's
online?  Those who actually teach the subject likely can provide more
insight.

cheers,
b.

| brian martinez                              brian.martinez@xxxxxxxx |
| lead gui programmer                                    303.708.7248 |
| trip network, inc.                                 fax 303.790.9350 |
| 6436 s. racine cir.                             englewood, co 80111 |
| http://www.cheaptickets.com/                   http://www.trip.com/ |

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


Current Thread