[xslt] Spaces and <xsl:document href="..."> element.



Hello xslt,

  I use xsltproc (and XSLT) to generate some reports for each directory in tree. Process works like this:

  (1) Perl script recurses tree and generate ONE XML file, which contains tree with gathered information. Output is like this:

<dir name="/">
  <dir name="dir1">
     <desc>Some description</desc>
     <dir name="dir2">
       ....
     </dir>
  </dir>
  <file name="file1">
    ......
  </file>
</dir>


  (2) I use XSLT to generate HTML report in each directory in tree, using XSML froms step (1) as input document. I use recursive template, which take parameter "cwd" and construct current path in tree by this parameter and "name" attribute of current (processed) <dir> element. I generate reports into directories with using XSLT 1.1 <xsl:document> instruction:

<xsl:template match="dir">
  <xsl:param name="cwd" select="'.'" />
  <xsl:document mode="html" encoding="windows-1251"
   href="{$cwd}/{ name}/index.html"
   ..........
  </xsl:document>
  <xsl:apply-templates>
    <xsl:with-param name="cwd" select="concat($cwd,'/',@name)" />
  </xsl:apply-templates>
</xsl:template>

  Everything works, except one thing: if directory's name contains spaces (<dir name="with spaces">...</dir>), xsltproc trys to open file:

  "./with%20spaces/index.html"

 And it FAILS (of course!). Is it xsltproc's (libxslt's) bug or I do something wrong?

  How could I workaround this problem?

-- 
Best regards,
 Lev                          mailto:lev serebryakov spb ru



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]