This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
xsl:for-each and xsl:apply-templates
- To: "'xsl-list at lists dot mulberrytech dot com'" <xsl-list at lists dot mulberrytech dot com>
- Subject: [xsl] xsl:for-each and xsl:apply-templates
- From: Gerry McDonough <gmcdonough at odbs dot com>
- Date: Wed, 1 Aug 2001 11:39:17 -0500
- Reply-To: xsl-list at lists dot mulberrytech dot com
It seems that calls to xsl:apply-templates from within an xsl:for-each loop are ignored. As a result, I end up copying my template handling logic inside of the xsl:for-each loop. Is this the only approach? Are there other techniques?
If the question sounds vague, here is a sample of my problem: Say I have a child node called "child" that appears in 2 different contexts: as a child of "parent1" and a child of "parent2". My xml source may look like:
<parent1>
<child/>
<child/>
</parent1>
<parent2>
<child/>
<child/>
<child/>
</parent2>
"child" should always be processed in the same way, but "parent1" and "parent2" need to wrap it differently. (more concretely, "parent1" may be a table, and "parent2" may be an unordered list). I use "xsl:for-each" to get the wrapping that I need, but I need to have my "child" template handling in 2 places.
Hope this makes sense,
Thanks, Gerry
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list