You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-users@xalan.apache.org by "Brown, Charles" <ch...@sensis.com> on 2005/08/02 22:13:34 UTC
RE: Redirect:write mangles file names on windows
Adolfo,
I keep getting [java]
javax.xml.transform.TransformerConfigurationException:
javax.xml.transform.TransformerException:
org.apache.xml.utils.WrappedRuntimeException: Could not find variable with
the name of dir. Would I need a namespace URI tacked onto it? Actually, I
tried that, but got same result.
--CB
> -----Original Message-----
> From: Lagomasino, Adolfo (Adolfo) [mailto:adolfo@lucent.com]
> Sent: Wednesday, July 13, 2005 2:27 PM
> To: Brown, Charles; xalan-j-users@xml.apache.org
> Subject: RE: Redirect:write mangles file names on windows
>
>
> You may want to use the
> Transformer.setParameter("dir", outputdir);
> where the outputdir is the String specifying where you want
> your output to be written.
>
> And then in the your stylesheet do something like
> <redirect:write select=concat($dir, "sub/dir/{@name}.txt")>
>
> Adolfo
>
>
> -----Original Message-----
> From: Brown, Charles [mailto:charles.brown@sensis.com]
> Sent: Wednesday, July 13, 2005 10:48 AM
> To: xalan-j-users@xml.apache.org
> Subject: Redirect:write mangles file names on windows
>
>
>
> If I'm off topic, please let me know.
>
> I'm trying to get redirect:write to put a file in a
> relative subdirectory, so I have the following
>
> <redirect:write file="sub/dir/{@name}.txt">
>
> On linux, :write converts the relative file name into an
> absolute file name, but it works fine, and the file ends up
> where I want it.
>
> /home/cbrown/workspace/sub/dir/myFile.txt
>
> On windows, :write tries to convert the relative file name
> into an absolute file name, but gets it mangled into;
>
> :C:\Documents and
> Settings\CBROWN\workspace\sub\dir\sub\dir\myFile.txt
>
> Which has two problems. First, the initial colon (:) makes
> the filename illegal, causing a FileNotFoundException to be
> thrown. Second, the "sub\dir\" gets repeated, resulting in a
> bad path.
>
> Any thoughts on avoiding this?
>
> Thanks.
>
> --CB
>
RE: Redirect:write mangles file names on windows
Posted by da...@us.ibm.com.
> Adolfo,
>
> I keep getting [java]
> javax.xml.transform.TransformerConfigurationException:
> javax.xml.transform.TransformerException:
> org.apache.xml.utils.WrappedRuntimeException: Could not find variable
with
> the name of dir. Would I need a namespace URI tacked onto it? Actually,
I
> tried that, but got same result.
You need a top-level parameter in your stylesheet:
http://www.w3.org/TR/xslt#top-level-variables
Dave