Subject: Re: [xsl] Help moving away from named templates From: Steve <subsume@xxxxxxxxx> Date: Wed, 2 May 2007 12:42:19 -0400 |
Thank you David and Abel for your patience and thank you for formulating (for me!) what part of my question actually is.
You're right. There are structural differences between the customer XML and the customer's contacts XML. I apologize for being imprecise. Let's give a simplistic version of the two:
Customer.xml <Records> <Record> <id>6</id> <firstName>Steve</firstName> </Record> </Records>
eContacts.xml <Records> <Record> <custID>6</custID> <firstName>Mommy</firstName> <relationship>Mother</relationship> </Record> </Records>
Obviously, distinguishing between these two in XPath is not really difficult. But let's say there are 10 or 15 other pages about Customers which need to be displayed, each with some nuanced difference. I suppose I feared ending up with a tangled mess of templates which are potentially trying to chomp each other's input due to similarities. Maybe this problem is solved and indeed XPath will suffice.
I'm open for comment on this one. I have other problems I'll bring up in the context of other replies. Thanks.
sorry I have no idea what your peceived problem is, Your second example wasn't well formed, but assuming custID is formed it is structurally identical to the first example.
So at that level your question seems to be, how, given two structurally identical XMl fragments do I arrange them to be processed differently.
It's hard to answer that.
basically you must know (somehow) which processing you need to do in each case, either you know from some external information, in which case you can pass in that information as an external parameter to the stylesheet, or the information is in some other part of the XML which you haven't shown, in which case you can select it with Xpath.
In either case the logic would appear to be the same whether you are using named templates or template matching.
> . But doesn't this circumvent the magical property of XSL to pick its > own darn templates according to the data?
But you seem to be implying that the information is not in the data, so no.
David
________________________________________________________________________ The Numerical Algorithms Group Ltd is a company registered in England and Wales with company number 1249803. The registered office is: Wilkinson House, Jordan Hill Road, Oxford OX2 8DR, United Kingdom.
This e-mail has been scanned for all viruses by Star. The service is powered by MessageLabs. ________________________________________________________________________
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] Help moving away from nam, David Carlisle | Thread | Re: [xsl] Help moving away from nam, Abel Braaksma |
Re: [xsl] How to show context of te, David Carlisle | Date | Re: [xsl] How to show context of te, Abel Braaksma |
Month |