[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

XSLT Generators / xsl:for-each vs. xsl:template

Subject: XSLT Generators / xsl:for-each vs. xsl:template
From: "Kyle D. Morton" <kyle_morton@xxxxxxxxxxx>
Date: Wed, 9 May 2001 18:48:35 -0400
xslt generators
I have developed an XSLT Generating Java API that works by creating
"mapping" statements with XPath. It works in a similar way to existing
commercial IDE products but lets a developer embed the functioanlity into
their own software. Perhaps the main differentiator of this API is that it
does not require a source or target DTD/Schema to begin; it is entirely
XPath driven.

The XSLT code it generates is different from other available products like
XSLWiz, Stylus, etc.. The XSLT generated by those products relies on
xsl:for-each loops to select the appropriate elements. In my API I don't use
loops, but recursion with xsl:template elements.

My question is if there are any strong feelings out there in regard to the
loop vs. recursion model of writing XSLT.

For Example:

this
<xsl:template match="/">
 <News>
  <xsl:apply-templates select="rss/channel/item"/>
 </News>
</xsl:template>
<xsl:template match="rss/channel/item">
 <Article>
  <xsl:apply-templates select="title"/>
 </Article>
</xsl:template>
<xsl:template match="title">
 <Headline>
  <xsl:value-of select="text()"/>
 </Headline>
</xsl:template>

vs.

<xsl:template match="/">
 <News>
  <xsl:for-each select="rss/channel/item">
  <Article>
   <Headline><xsl:value-of select="title"/></Headline>
  </Article>
  </xsl:for-each>
 </News>
</xsl:template>

My feeling is that using xsl:template will allow for more complex
transformation by using the "mode" attribute to group rules. But I would
like any opinions.

Thanks in advance.
-Kyle Morton

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


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.