Subject: Re: [xsl] unparsed-text-available a file from the current OS directory From: ac <ac@xxxxxxxxxxxxx> Date: Sun, 29 Aug 2010 19:48:53 -0400 |
Thank you, ac
One way to make the current working directory known to the stylesheet is to pass it as a parameter:
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0"> <xsl:output method="text"/> <xsl:param name="currentdir" /> <xsl:variable name="current-base-uri" select="concat('file:///', replace($currentdir, '\\', '/'))" /> <xsl:template name="main"> <xsl:sequence select="unparsed-text(concat($current-base-uri, '/', 'test.txt'))" /> </xsl:template> </xsl:stylesheet>
Suppose the stylesheet is c:\otherdir\test.xsl and there's a text file test.txt with contents 'TEST' in the current working directory.
Then:
C:\Users\gerrit>type test.txt TEST
C:\Users\gerrit>java net.sf.saxon.Transform -xsl:c:/otherdir/test.xsl -it:main currentdir=%CD% TEST
I'm not sure I fully understood the requirement and whether there are more 'canonical' ways to access the CWD in XSLT processors. (And I'm not the Windows shell expert.) But I hope it is helpful anyway.
-Gerrit
On 29.08.2010 04:53, ac wrote:Hi,
Sorry as this must have been answered before, but I have not yet found the info.
With <xsl:output method="text" indent="no"/>
if I use <xsl:result-document href="boum.txt"> ...,
By default, boum.txt seems to get written to the "current" OS directory, but if I do <xsl:if test="unparsed-text-available('boum.txt')"> ... boum.txt seems to get resolved from the base-uri (e.g. the stylesheet directory path).
How can I have boum.text resolved from the current OS directory?
The objective is for processing files in the current OS directory (e.g. from a batch (.bat) file, available from the PATH system variable, in command-line mode), with a single instance of the stylesheet, sitting in some other arbitrary directory.
Thank you, ac
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] unparsed-text-available a, Imsieke, Gerrit, le- | Thread | [xsl] Xslt protect with password, Praveen Chauhan |
Re: [xsl] Why does the addition of , Michael Kay | Date | [xsl] Xslt protect with password, Praveen Chauhan |
Month |