This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
RE: Copying and Transforming/Recursion? - Revisited
- To: xsl-list at mulberrytech dot com
- Subject: RE: Copying and Transforming/Recursion? - Revisited
- From: Jeff Saylor <JSaylor at wizardfinance dot com>
- Date: Thu, 12 Oct 2000 09:40:24 -0400
- Reply-To: xsl-list at mulberrytech dot com
David,
It's obvious I am not grasping a fundamental point on XSL here - all my work
up to this point has been XSL expressly specifying the output while using
the XML for logic control (you can see from that sentence that I'm still
grappling with the idea of template based programming).
I fully understand your "input" template - but I don't understand your
sentence prior:
>All you need do is copy that code and add one additional template that
matches "input"
If my XSL actually copies the source, then how can it also apply the "input"
template to the source it just copied? It seems I can do one or the other
but not both - again, this makes me think of recursion (copy, apply, copy,
apply... until all source is exhausted).
You and others make this sound trivial to the point that I must just not be
grasping a fundamental... I hate to beg a complete solution - but could you
turn the above quoted sentence into a code example?
Again - much appreciation in advance - cheers,
Jeff
-----Original Message-----
From: David Carlisle [mailto:davidc@nag.co.uk]
Sent: Wednesday, October 11, 2000 7:49 PM
To: xsl-list@mulberrytech.com
Subject: Re: Copying and Transforming/Recursion? - Revisited
> It seems to me that the author's document needs to be copied - element for
> element (via recursion?) -
copying element for element doesn't need explicit recursion (of a named
template) just the implicit recursion inherent in apply-templates.
The example code is in the XSLT spec.
All you need do is copy that code and add one additional template
that matches "input"
<xsl:template match="input" >
<xsl:copy>
<xsl:copy-of select="@*"/>
<xsl:attribute name="value">
<xsl:value-of
select="//submittedValue[@fieldname=current()/@fieldname"/>
</xsl:attribute>
</xsl:copy>
(untested)
</xsl:template>
David
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list