|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] XSLT Generators / xsl:for-each vs. xsl:template
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
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|

Cart








