[xsl] Recursion

Subject: [xsl] Recursion
From: "Shailesh Shinde" <shailesh@xxxxxxxxxxxx>
Date: Mon, 7 Nov 2005 12:43:34 +0530
Hi All,

I have input xml file as:

<Root>
<file fileloc="A/gen1.xml" />
<file fileloc="A/gen2.xml" />
</Root>

I have to transform this and get:

gen1.xml
gen2.xml

As I have done some changes in these two file.

My XSL for the same is:

<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";>
	<xsl:output method="xml" version="1.0" encoding="UTF-8"
indent="yes"/>
	<xsl:template match="/">
<xsl:for-each select="Root/file">
			<fileloc>
				<xsl:attribute name="path"><xsl:value-of
select="concat(substring-before(substring-after(@fileloc,'/xml/'),'.'),'.htm
')"/> </xsl:attribute>
				<xsl:attribute
name="noNamespaceSchemaLocation">MSD_book.xsd</xsl:attribute>
				<xsl:text>&#13;</xsl:text>
				<xsl:apply-templates select="script"/>
				<xsl:apply-templates
select="document(@fileloc)/Test/topic"/>
			</fileloc>
</xsl:for-each>
	</xsl:template>
	<xsl:template match="script">
		<scriptinc>
			<xsl:copy-of select="@*"/>
		</scriptinc>
	</xsl:template>
	<xsl:template match="topic">
		<xsl:copy-of select="."/>
	</xsl:template>
</xsl:stylesheet>

With this xsl I am getting one xml file where i need two xml files as output
How I use Recursion to get output.

Thanks,
Shailesh

Current Thread