[Home] [By Thread] [By Date] [Recent Entries]
Brian Newman wrote:
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"> Here you write to status.xml and then <xsl:copy-of select="$link3/node()"/> </xsl:result-document> here you call the template again, resulting in a further attempt to write to status.xml again. <xsl:call-template name="Chain"/> </xsl:template> -- Martin Honnen http://msmvps.com/blogs/martin_honnen/
|

Cart



