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

Re: Problem running a 2.0 transformation with JAXP

Subject: Re: Problem running a 2.0 transformation with JAXP
From: hugh <hdixon@xxxxxxxxxxxxxx>
Date: Thu, 20 Mar 2008 17:59:37 +1030
Re:  Problem running a 2.0 transformation with JAXP
On Thu, 20 Mar 2008 02:52:24 pm Mukul Gandhi wrote:
> Hi all,
>    I am using Saxon 9 XSLT processor to run my program. Below is a
> description of my problem.
>
> In a 2.0 stylesheet, I am using 'unparsed-text' function as following:
>
> <xsl:param name="file" />  <!-- this is a global stylesheet parameter -->
>
> <xsl:variable name="fileStr" select="unparsed-text($file,'UTF-8')" />
>
> I am passing the value of parameter 'file' as a URI string value of
> format, file:/C:/dirname/filename.csv

I'm  not sure if this is your problem, but I found using MS products, that 
when I moved from IE6 to IE7 it was more sensitive to the formatting of the 
URI.
In particular 
	file:/C:/dirname/filename.csv
would fail.  The URI should be
	file://C:/dirname/filename.csv

(Double backslash after file: not single)

No idea if this is your problem, but it was a problem I have had.

Hugh

>
> I am calling the transformation from a Java program using the JAXP
> API. Below is the code fragment of my Java program:
>
> File f = new File("filename.csv");
> String file = f.toURI().toString();  //this generates string of
> format, file:/C:/dirname/filename.xyz
>
> transformer.setParameter("file", file);
> transformer.transform(xmlSource, new StreamResult(new File("result.csv")));
>
> (I am actually using the syntax, <xsl:output method="text" /> in the
> stylesheet, to generate a CSV output).
>
> When the Java program is run, I get the following error:
>
> Error
>   XTDE1170: Cannot resolve relative URI: no protocol:
> net.sf.saxon.trans.DynamicError: Cannot resolve relative URI
>         at
> net.sf.saxon.functions.UnparsedText.readFile(UnparsedText.java:112) at
> net.sf.saxon.functions.UnparsedText.evaluateItem(UnparsedText.java:72 )
>         at
> net.sf.saxon.expr.ExpressionTool.eagerEvaluate(ExpressionTool.java:29 7)
>         at
> net.sf.saxon.expr.ExpressionTool.lazyEvaluate(ExpressionTool.java:245 )
>         at
> net.sf.saxon.instruct.GlobalVariable.getSelectValue(GlobalVariable.ja
> va:168)
>         at
> net.sf.saxon.instruct.GlobalVariable.evaluateVariable(GlobalVariable.
>
> If I run the stylesheet from command line, passing the relevant URI
> parameter as string, in the same format, I do not get the error.
>
> It seems, 'unparsed-text' function is having some problem working with
> the passed value.
>
> Could somebody please help me with this.

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.