You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-users@xalan.apache.org by Bennett <be...@glengroup.com> on 2003/07/10 22:22:41 UTC

Recursion issue

Hello,

	I'm attempting my 1st recursive template and I'm not quite sure how to 
best do it.
	
	Using the example source document:

	<a attr="1">
		<b attr="2">
			<c attr="3"/>
		</b>
	</a>


	let's say the current node is <c>

	Here's what I'd like to do:

	if <c> has the attribute "attr" then return the attributes value.

	else if <b> has the attribute "attr" then return the attributes value.

	else if <a> has the attribute "attr" then return the attributes value.
	
	else return a default value.

	
	Does anyone have a code sample that would do this? I've tried a few 
different things using a template that calls itself and I've checked 
out the recursion examples on the dpawson faq but nothing that quite 
does what I'm looking for.


Thank you for any help on this,
Bennett