|
Subject: [xsl] Help moving away from named templates From: Steve <subsume@xxxxxxxxx> Date: Wed, 2 May 2007 11:18:24 -0400 |
I'm trying to reorganize my xsl application to make more use of the template match attribute. I mostly transform XML documents which are created based on SQL query results. For the time being, my XSL calls a named template to display this profile. I can think of two alternatives (illustrated below). If someone has a better one I am all ears!
<Records>
<Record>
<firstName>Steve</firstName>
<customerID>999</custID>
</Record>
</Records>and in most cases this would work, but of course this would conflict with any other customer info that also contained 'firstName' (display Emergency Contact info, for example, would have a 'firstName' and thus conflict). I could make it so it checked for more than the firstName, but this a nightmare in the making. Am I wrong?
2) At the time of XML generation I could include a node indicating which template needed to be displayed, but while this simplifies XSL it doesn't seem to simplify program code.
<Records>
<template>customerProfile</template>
<Record>
<etc />
<etc />
</Record>
</Records>Then do <xsl:apply-templates match="Records[template='customerProfile']/Record" />
The problem with this solution is that it doesn't seem to reduce complexity, only to shuffle it away from XSL.
| Current Thread |
|---|
|
| <- Previous | Index | Next -> |
|---|---|---|
| RE: [xsl] XSL History, Wendell Piez | Thread | Re: [xsl] Help moving away from nam, David Carlisle |
| Re: [xsl] XSLT 1.0 support in brows, Wendell Piez | Date | Re: [xsl] Help moving away from nam, David Carlisle |
| Month |