posted 20 years ago
(Sorry for being vague due to business reasons)
I have a cascading template calls and based on some some
business logic I select a specific element in my input XML
file. I then need to call some templates by selecting
this element.
I am currently using the "for-each" construct and the "select"
attribute to select the ONE element. See pseudo-code below...
Wondering if there is a better way to do this...
<xsl:variable name="TheElement" select="key('businessKey', $criteria)"/>
<!-- So I selected the element
Some other processing follows...
-->
<xsl:for-each select="$TheElement">
<xsl:call-template name="Level1Template>
<xsl:with-param .../> <!-- being brief -->
</xsl:call-template>
</xsl:for-each>
<!--
Some other processing follows...
-->
The template called above inturn calls other templates.
As I mentioned I am doing this ONLY to select the
XPath of TheElement so that processing of the
subsequent templates is easy.
Additionally, I can positively say that the key
guarentees to return ONE and ONLY ONE element.
Is the for-each construct the best way to do this task ?
Any help is appreciated.
Thanks.
- madhav............it works fine, but is there a better way!
Take a Minute, Donate an Hour, Change a Life
http://www.ashanet.org/workanhour/2006/?r=Javaranch_ML&a=81