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

Re: Template inside a Template

Subject: Re: Template inside a Template
From: Mike Brown <mike@xxxxxxxx>
Date: Sat, 13 Oct 2001 15:00:32 -0600 (MDT)
templates inside templates
kalpana rawat wrote:
> Can we have a Templte inside a template.

Yes, but not the way you probably expect.

> e.g., 
> <xsl:template name="Item">
>     <xsl:template name="Notes">
>         ......something goes here
>     </xsl:template>
> </xsl:template>

You probably want

<xsl:template name="Item">
  <xsl:call-template name="Notes"/>
  ......something goes here
</xsl:template>

<xsl:template name="Notes">
  ......something goes here
</xsl:template>

But do you understand the processing model of XSLT?

<xsl:template match="foo"> means "this template is a good match for an
element named foo, if such a node has been selected for processing".

<xsl:apply-templates select="foo"/> means "go process, one at a time, all 
the 'foo' element children of the node currently being processed, by 
finding the template that is the best match for that node"

<xsl:for-each select="foo"> means "process, one at a time, all the 'foo' 
element children of the node currently being processed, and use the 
contents of this for-each element as the best matching template.

<xsl:template name="foo"> means "this template is named foo and can be 
called while processing any node"

<xsl:call-template name="foo"/> means "invoke the template named foo here,
without changing the current node"

Processing starts at the root node, and there are built-in templates that 
cause recursive descent through elements and the copying of text nodes.

   - Mike
____________________________________________________________________________
  mike j. brown, fourthought.com  |  xml/xslt: http://skew.org/xml/
  denver/boulder, colorado, usa   |  personal: http://hyperreal.org/~mike/

 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.