OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.


Help: OASIS Mailing Lists Help | MarkMail Help



   recursive recursion

[ Lists Home | Date Index | Thread Index ]

Dear All,

I suspect that this is a really easy problem, but I am having a problem
getting my head around the problem.

I have two attributes each with multiple values like x;y;z and a;b.

I want to output every possible permutation of each of these attributes, for
example xa,ya,za,xb,yb,zb

So I need to recurse within the recursive algorithmn, but almost every thing
I try doesn't work.

Does anyone clever with recursion have some advice.



Here is some code I tried.

		<xsl:call-template name="returnStringBeforeX">

			<xsl:with-param name="myStringA" select="x;y;z"/>

			<xsl:with-param name="myStringB" select="a;b"/>	

	<xsl:template name="returnStringBeforeX">		
		<xsl:param name="myStringA"/>		
		<xsl:param name="myStringB"/>		

			<!-- This rule fires when threre is something after
;, what is on the left is ready so we output this result -->

			<xsl:when test="substring-after($myStringA, ';')
!='' ">				

			<xsl:value-of select="substring-before($myStringA,
			<xsl:value-of select="substring-before($myStringB,
				<!-- We have not finished recursing so we
call the funktion again -->				
					<xsl:with-param name="myStringA"
select="substring-after($myStringA, ';')"/>				
					<xsl:with-param name="myStringB"
select="substring-after($myStringB, ';')"/>	
			<!-- We have finished recursing so we output what is
ready -->				

			<xsl:value-of select="$myStringA"/>
			<xsl:value-of select="$myStringB"/>



News | XML in Industry | Calendar | XML Registry
Marketplace | Resources | MyXML.org | Sponsors | Privacy Statement

Copyright 2001 XML.org. This site is hosted by OASIS