[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Strange Problem with document($variablename)

Subject: Strange Problem with document($variablename)
From: Torsten Schlabach <TSchlabach@xxxxxxx>
Date: Fri, 11 Jul 2003 13:05:11 +0200 (MEST)
java.io.filenotfound
Dear list,

my apologies if this is too obvious, but I cannot figure out this problem
for two days now. This is what I try to do:

In a <xsl:foreach> I iterate some directory elements. I want to open the
corresponding XML file for each of the directly entries. So I need to
concatenate the @name attribute of the current node the <xsl:foreach> iterator is
visiting with a directory name prefix. I try to do this like that:

<xsl:variable name="filename">
<xsl:value-of select="'../content/news/'" />
<xsl:value-of select="@name" />
</xsl:variable>

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!!!).

Even more strange: Just putting an X in front of ../content/news" makes the
whole thing work:

<xsl:variable name="filename">
<xsl:value-of select="'X../content/news/'" />
<xsl:value-of select="@name" />
</xsl:variable>

I will get java.io.FileNotFound exception for "X../content/news/foo" (note
the foo is *not* omitted just because I put the X in front of the other part
of the variable). Of couse with the leasing X the filename is invalid.

Do I get the syntax wrong? Is there a different way of achieving this?

I tried <xsl:variable name="filename" select="'../content/news/'@name"/> but
this causes Xalan to refused to compile that stylesheet at all. I also
tried:

<xsl:variable name="filename1" select="'../content/news/'"/>
<xsl:variable name="filename2" select="@name" />
	
<xsl:variable name="filename" select="$filename1$filename2" />

as well as

<xsl:variable name="filename1" select="'../content/news/'"/>
<xsl:variable name="filename2" select="@name" />
	
<xsl:variable name="filename" select="{$filename1}{$filename2}" />

All this variations result in the stylesheet not beeing compiled.

Any comments are welcome.

Regards,
Torsten



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


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.