Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

XSLT loop through templates

Status
Not open for further replies.

nomistic

Technical User
Apr 30, 2010
2
US
HI, I'm having a hard time with this...

I just completed an XSLT file for reading TEI data from a series of encoded letters.

I created a number of templates for grabbing the info, but I just discovered that at least one of the records has two letters encoded within it. I just need to loop through each of the templates to generate both letters.

Here's the basic code for what I've been trying to accomplish:

Code:
<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>
Unfortunately, this does not seem to work. Is there something I'm missing here? The code validates, but generates not of the content (without the for-each statements, it generates one letter; I need it to check for multiple instances within the XML document, if there are more than one. Does anyone have any ideas? The entire letter content lives within the <tei:div> tags.
 
Not enough info. Can you not pose some samples data and the outline/full templates "letterOpener",... etc?
 
I apologize. Actually, I was thinking about this all wrong... the issue was that I needed to do the looping inside one template for the entire letter.

I solved this myself; I grouped all of the mentioned templates into one, and then looped through the whole thing, and THEN called the template. Classic case of overthinking.

Thanks!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top