[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: Steve <subsume@xxxxxxxxx>
Date: Wed, 2 May 2007 11:59:31 -0400
Re:  Help moving away from named templates
Said 'XSL' in a few places I meant XML. Sorry!

On 5/2/07, Steve <subsume@xxxxxxxxx> wrote:
On 5/2/07, David Carlisle <davidc@xxxxxxxxx> wrote:
> you presumably mean select not match (which is a syntax error) and it's
> generally a bad idea (slower and not namespace-aware0 to text eleemnt
> names using name() why not simply
>
> <xsl:apply-templates select="Records/Record/firstName"/>
>
> > and in most cases this would work, but of course this would conflict
> > with any other customer info that also contained 'firstName'
>
> I can't guess what kind of conflict you see here, could you post a
> slightly larger XML that also has elements that you wouldn't want to
> select.

Let's say I want to select XSL which displays the emergency contacts
of a customer, rather than the customer's info. That XSL would look
quite similar to XSL

<Records>
   <Record>
   <custID>
   <firstName>Customer's Mommy</firstName>
   </Record>
</Records>

I happen to know this is the customer's emergency contact because this
XSL was generated from the "Customer_Emergency_Contacts" table. But to
XSL they're quite similar!

> 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"
/>

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.