Subject: Re: [xsl] recursive looping and variable scope From: Martin Honnen <Martin.Honnen@xxxxxx> Date: Tue, 05 Jan 2010 12:00:19 +0100 |
This works fine when I'm not looping. But when I recursively call the same named template and start over, the $filename variable isn't resetting. Instead, I get an error "Cannot write more than one result document to the same URI". My guess is that I'm having trouble with the scope of $filename, inheriting it's value from an earlier iteration of the template and, since variables can't be reset, the new value sent to it is ignored. Is that true? and how do I get it to change?
<xsl:template name="Chain"> <xsl:variable name="link1"> <xsl:call-template name="getSchedule"/> </xsl:variable> <xsl:variable name="link2"> <xsl:apply-templates mode="link2" select="$link1/jobs/job"/> </xsl:variable> <xsl:variable name="link3"> <xsl:apply-templates mode="link3" select="$link2/policies"/> </xsl:variable> <xsl:variable name="filename">policy_<xsl:value-of select="$link1/jobs/job/@jobid"/><xsl:text>.xml</xsl:text></xsl:variable> <xsl:result-document href="status.xml">
<xsl:copy-of select="$link3/node()"/> </xsl:result-document>
<xsl:call-template name="Chain"/> </xsl:template>
Martin Honnen http://msmvps.com/blogs/martin_honnen/
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
[xsl] recursive looping and variabl, Brian Newman | Thread | [xsl] Using XPath to refer to a tag, PATIL Arvind |
RE: [xsl] Word -> XSL, Michael Kay | Date | [xsl] Associating javascript with X, Rob Belics |
Month |