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

Re: nested templates?

Subject: Re: nested templates?
From: Alex Black <enigma@xxxxxxxxxxxxxxxx>
Date: Wed, 16 May 2001 11:55:13 -0700
nested template examples
> 
>> The above seems to be illegal, though I can't think of a good reason why.
> 
> It is clearly illegal, what would you want it to mean?
> I suspect that xsl:template does not operate the way you imagine.

apparently not.

>> is it possible to construct an xslt stylesheet that is more similar to a
>> "complete" page, i.e. with nested templates:
> 
> It is possible to design a "complete page" this is what is sometimes
> called the pull method, in fact if you are doing that, you don't need
> any xsl;template instructions at all, see the XSLT spec for an example
> (or the FAQ for this list).

I've seen that faq and _all_ of the examples are:

xsl:stylesheet

xsl:template
xsl:apply-templates

xsl:template

xsl:template

.. ad infinum.

-- this is the "lots of little bits" method, which is not useful for
production.

> 
>> (btw, this is not syntactically complete, but you get the idea :)
> 
> No, I can't imagine what the idea is! I think you are trying to
> do something like xsl:for-each but with an illegal use of xsl:template.
> It would be clearer if you said what you wanted to happen rather than
> posting some code you know to be wrong and then asking us to guess
> what you want it to do!

I actually did say, quite explicitly:

Is it possible to nest templates, i.e. to create templates for elements, and
nest them within on another, so I can effectively build a complete page,
with some xsl sprinkled in to take care of value-of selection.

I have been unable to find a good example of this syntax structure in XSL.

I _have_ been able to find many, many examples of

template
    apply-templates
/template

template
    apply-templates
/template

template
    apply-templates
/template

where the first is
<html> etc

the second is a master layout:
<div align="center>
<ul>
apply-templates
</ul>
</div>

and the third is an "item":
<li>value-of select</li>

Which is not useful to me.

I would prefer the following:

template
    template
        <stuff>
    /template
    apply-templates
/template

which is much more true to the hierarchical structure of XML and indeed all
markup.

If you can provide some good links to complex, real-world examples of XSL
stylesheets, I'd be grateful, because everything I've found is either an
Xpath tutorial or "hello world" kind of stuff. :)


-alex



 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.