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

RE: nested templates?

Subject: RE: nested templates?
From: "Chris Bayes" <Chris@xxxxxxxxxxx>
Date: Wed, 16 May 2001 22:50:29 +0100
java nested template map list
Kurt,
>I remember early in the development process that nested templates were a
>part of the test implementations, and in all honesty they didn't really add
>much to the structure and were conceptually a pain to deal with. You can do
>the same thing with a modal call:
>
><xsl:template match="foo">
>    <xsl:apply-templates select="." mode="bar"/>
></xsl:template>
>
><xsl:template match="foo" mode="bar">
>    <!-- do boo.bar -->
></xsl:template>
>

Yeh. I was just thinking that it would avoid some of the mode stuff if you
could do it. In some modal stylesheets it can get quite complicated and
nested templates would avoid that. But like I said I hadn't thought it
through a lot. It just seemed logical to be able to do it. Maye I come from
a too procedural background.

>and you gain the added benefit of still being reference the modal
>"bar" type
>of foo from other templates. <xsl:for-each> can certainly be over-used
>(badly) but again I think that what works best here is to teach people to
>use for-each primarily as a context switcher. It does come into play more
>often with node-sets, however; I have a message board system which orders a
>list of messages in descending order prior to displaying a page of such
>orders:
><xsl:variable name="orderedList">
>    <xsl:for-each select="$messages">
>         <xsl:sort select="date" order="descending"/>
>        <xsl:copy-of select="."/>
>    </xsl:for-each>
></xsl:variable>
>
>Creating an entire template just to copy the contents of a list seemed
>overkill here, so for-each worked fine.

I'm not arguing but wouldn't it be easier to do

    <xsl:apply-templates select="messages">
         <xsl:sort select="date" order="descending"/>
    </xsl:apply-templates>

Ciao Chris

XML/XSL Portal
http://www.bayes.co.uk/xml


 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.