For a little issue like this, the <xsl:sequence> approach is perfect.
There are more complex scenarios that your example alludes to, and in
those cases, I pass the parameter to a template mode, where it can then
be the context in different template matches. That approach gives me a
lot of flexibility, and makes my solution scalable. I recommend, if you
do this, to also make use of <xsl:mode name="" on-no-match=""/> to help
avoid any unintended consequences.
Joel
<xsl:function name="f:procedureLeg" as="element()+">
<xsl:param name="record" as="element()"/>
<xsl:for-each select="$record">
<xsl:sequence select="f:convert(Customer_or_Area_Code)"/>
<xsl:sequence select="f:convert(Cycle_Date)"/>
<xsl:sequence select="f:convert(Sequence_Number)"/>
...
</xsl:for-each>
</xsl:function>
That's lousy as well. "record" is just a single element; I shouldn't be
looping over a single element (in my opinion).
Is there a better way? One that doesn't involve qualifying every child
element and doesn't involve looping over a single element?
--
Joel Kalvesmaki
Director, Text Alignment Network
http://textalign.net
| Current Thread |
|
Joel Kalvesmaki director@xxxxxxxxxxxxx - 1 May 2024 18:36:30 -0000 <=
|
|