xsl-list
[Top] [All Lists]

Re: Strange Problem with document($variablename)

2003-07-11 04:43:44
Hi Torsten,

Using <p><xsl:value-of select="$filename"/></p> the correct filename
is being printed.

(For example ../content/news/foo" if @name == foo.)

Using document($filename) I get a java.io.FileNotFound exception for
"../content/news/" (where is the foo gone; it the identical
variable!!!).

That's very peculiar. If you want an equivalent variable, try using
the concat() function:

<xsl:variable name="filename"
              select="concat('../content/news/', @name)" />

I doubt that it will give you a different result.

By the way, the reason that the file isn't found might be because the
URL is being resolved relative to the directory that the stylesheet
lives in rather than the directory that the XML document lives in. Try
using:

  document($filename, .)

to get the $filename URL to be resolved relative to the current
<directory> element.

Cheers,

Jeni

---
Jeni Tennison
http://www.jenitennison.com/


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list