PDA

View Full Version : call-template within a for-each in XSLT


Nomistic
04-30-2010, 11:06 PM
Hi, is it possible to call templates within a for-each statement?

I'm looking for something like this... I have successfully created a style sheet that will call information from a TEI-encoded xml document, but I just discovered a file in the document that has more than one letter in it.

I just need it to loop through the entire call of the content.

Here's what I have (that does not work)


<xsl:for-each select="*/tei:div">
<div class="content">

<xsl:call-template name="letterOpener"/>
<xsl:call-template name="text" />
<xsl:call-template name="letterCloser"/>
<xsl:call-template name="margin"/>

</div>
</xsl:for-each>


Thank you so much in advance for your help. Please let me know if you need to see more code... I've been staring at this for hours.

Nomistic
05-01-2010, 03:34 AM
Okay, this was a case of overthinking, and not wanting to rewrite the sheet.

The issue was that the letter needed to be repeated with a for-each within the template itself, and to blend all of the above templates into one for the letter.