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

Re: Help moving away from named templates

Subject: Re: Help moving away from named templates
From: Abel Braaksma <abel.online@xxxxxxxxx>
Date: Wed, 02 May 2007 18:11:58 +0200
Re:  Help moving away from named templates
Steve wrote:
On 5/2/07, David Carlisle <davidc@xxxxxxxxx> wrote:

In particular in what way do you avoid this conflict using named
templates, you still need to decide on which nodes to call the named
template which should be an exactly equivalent problem, shouldn't it?

A few ways which seem clunky/limited:


1) Generally, I just have the script call emergencyContacts.xsl, which
contains one template--the emergency contacts template. But doesn't
this circumvent the magical property of XSL to pick its own darn
templates according to the data? Also, there's something seemingly
naive to me about having a bunch of xsl files with one template.

2) If I need to display BOTH the consumer's info and their emergency
contacts on the same page, I include (INCLUDE HELL) the
emergencyContact XSL and then use <xsl:call-template name="eContacts"
/>


I don't seem to be able to envision your current problem. I have never heard of INCLUDE HELL, though I find myself using xsl:import more often as that creates a similar effect as overloading in some languages.


I have the impression that you have several input documents. That the same user, with the same custId looks similar in either document (but similar does not mean 'the same', which means you can distinguish them, which means you'll have to show us more). But if these are separate documents, you can distinguish in several ways, depending on _where_ precisely you want your distiction:

1. Use an initial mode, say you have a mode 'emergency-contact' and a mode 'normal-contact'. You can set that several ways, one being when starting the transformation process.

2. Use properties that currently distinguish your documents. But you'll have to show us more to help you.

3. If the same documents are processed, and are similar, but they are called using, say, the fn:doc or the fn:document functions, you can distinguish by using (again) modes.

Many other options are available but largely depend on your problem, which isn't clear yet. There's no need whatsoever to have only one xsl:template in your stylesheets.

Cheers,
-- Abel Braaksma

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-2007 All Rights Reserved.