This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
Re: nested templates?
- To: <xsl-list at lists dot mulberrytech dot com>
- Subject: Re: [xsl] nested templates?
- From: Alex Black <enigma at turingstudio dot com>
- Date: Wed, 16 May 2001 17:13:21 -0700
- Reply-To: xsl-list at lists dot mulberrytech dot com
> The way the template example you gave can be structured something like ...
This is the last whack at a dead horse, but I want you to understand what I
mean :)
The code below is not structured: it is by definition "flat". There are
calls to other templates from within those templates, and yes, that works -
but there is no proper nesting of the code, where in 80% of cases, I need to
have nested code.
>
> <xsl:stylesheet>
>
>
> <!-- template -->
> <xsl:template match="/">
> <!-- top level -->
> <div align="center">
>
> <!-- folder -->
> <xsl:apply-templates select="folder">
> </xsl:apply-templates>
> <!-- /folder -->
>
> </div>
> <!-- /top level -->
> </xsl:template>
>
>
> <xsl:template match="folder">
> <a href="/"><xsl:value-of select="@name"/></a><br />
>
> <!-- item -->
> <xsl:apply-templates select="*">
> </xsl:apply-templates>
> <!-- /item -->
>
> <p/>
> </xsl:template>
>
>
> <xsl:template match="*">
> <a href="{href}">
> <xsl:value-of select="href" />
> </a><br />
> </xsl:template>
>
>
> </xsl:stylesheet>
>
>
> On your related question, try looking into <xsl:include> and <xsl:import>
>
> Best wishes as you learn xsl templates... :-)
>
> Tim Watts
>
I will, re include :)
I'm doing a fairly complex form builder application now, so I'm sure I'll
have a few other questions. I think xslt could benefit from a little
syntax-overhaul, but in general it's a fantastic idea, and a cool
technology.
When I get something I'm happy with, I'll post it up on binarycloud.com
_alex
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list