Re: [xslt] filenames containing spaces in xslt param



Dear Friends,
 
Thank you for your immediate response.
 
I should have explained issue in more detail.
 
The (spaces in filename) issue arise when I pass parameters to xslt using libxslt's xsltApplyStylesheet function. And, the issue is, the document function then fails to load this file.
 
If I directly hardcode the file path in XSLT then it works fine.
for e.g.
<xsl:variable name="path" select="'C:/file with space in name.xml'" />
<xsl:copy-of select="document($path)"/> , note, no %20 in file name. I am using MS-Visual studio XSLT debugger to degub this XSLT.
Now, if I pass same path 'C:/file with space in name.xml' from libxslt's xsltApplyStylesheet function then it doesn't work.
 
But, now I have changed my code to replace all spaces in file name by %20, before passing it to xsltApplyStylesheet function. And it works fine now. The issue is fixed. Thanks to Chuck Jungmann :) . You gave me the direction.
 
Thanks all.
 
 
 

 
On Wed, Jun 24, 2009 at 2:40 AM, Nick Wellnhofer <wellnhofer aevum de> wrote:
Viktor Štujber wrote:
> <xsl:variable name="path" select="'file%20with%20space%20in%20name.xml'" />
> <xsl:copy-of select="document($path)"/>
>
> Works... however, I thought string literals could contain spaces...
> why do spaces have to be escaped this way? I'm curious to know.

Because the argument of the document function is a URI, not a filename.

Nick


--
aevum gmbh
rumfordstr. 4
80469 münchen
germany

tel: +49 89 3838 0653
http://aevum.de/
_______________________________________________
xslt mailing list, project page http://xmlsoft.org/XSLT/
xslt gnome org
http://mail.gnome.org/mailman/listinfo/xslt



--
Vinnubhai_MCS


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