[xsl] Copying refered files

Subject: [xsl] Copying refered files
From: "Joga Singh Rawat" <jrawat@xxxxxxxxxxxxxx>
Date: Fri, 28 Aug 2009 11:29:37 +0530
I want to achieve following results but don't know exactly what to do? I
have a specific directory where all htm files (a.htm, b.htm, c.htm... x.htm)
are lying.
Input: abc.xml
<x><a href="a.htm">aaa</a></x>
<x><a href="b.htm">bbb</a></x>
<x><a href="a.htm">aaa</a></x>
<x><a href="c.htm">ccc</a></x>
<x><a href="b.htm">bbb</a></x>
I want to run a xslt in the above xml file (abc.xml) . This xslt will
convert abc.xml into abc.htm and also pulled the cross refered files (do not
want to be duplicate). The output directory should contains four html files
ie. abc.htm, a.htm, b.htm c.htm. I am trying just as follows:
<xsl:template match="abc">
  <xsl:for-each select="//a">  
   <xsl:variable name="reffile" select="@href"/>
   <xsl:result-document href="{$reffile}">
    <xsl:copy-of select="document(concat('masterdir/', $reffile))"/>
Anyone any idea? 

Current Thread