RE: [xsl] Strange Problem with document($variablename)

Subject: RE: [xsl] Strange Problem with document($variablename)
From: Rod Humphris - FLPTN <rod.humphris@xxxxxxxxxxxxxx>
Date: Fri, 11 Jul 2003 14:21:17 +0100
Forgive me if I have misunderstood but..

Reading the first post:

>In a <xsl:foreach> I iterate some directory elements..etc

it sounded to me like Torsten is trying to change the value of a variable
inside a for-each loop.
I thought, and I may be completely wrong, that you couldn't do that. That
the variable would be assigned in the first iteration and would then not
change? That therefore you passed the relevant bits to another template as
parameters instead.

???

Cheers

Rod

-----Original Message-----
From: Jeni Tennison [mailto:jeni@xxxxxxxxxxxxxxxx]
Sent: 11 July 2003 12:44
To: Torsten Schlabach
Cc: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Subject: Re: [xsl] Strange Problem with document($variablename)


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


________________________________________________________________________
This email has been scanned for all viruses by the MessageLabs Email
Security System. For more information on a proactive email security
service working around the clock, around the globe, visit
http://www.messagelabs.com
________________________________________________________________________


________________________________________________________________
Any opinions expressed in this email are those of the individual and not necessarily the Company. Unless expressly stated to the contrary, this email is not intended to give rise to a new, or affect an existing, contractual or other legal relationship.This email and any files transmitted with it, including replies and forwarded copies which may contain alterations) subsequently transmitted from the Company, are confidential and solely for the use of the intended recipient. The unauthorised use, disclosure or copying of this email, or any other information contained or attached,is prohibited and could, in certain circumstances, be a criminal offence.

If you have received this email in error please notify the sender as soon as possible.

This footnote also confirms that this email message has been swept for the presence of computer viruses.

www.focusdiy.co.uk
_________________________________________________________________

________________________________________________________________________
This email has been scanned for all viruses by the MessageLabs Email
Security System. For more information on a proactive email security
service working around the clock, around the globe, visit
http://www.messagelabs.com
________________________________________________________________________

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


Current Thread