Click here to get back home

XML::XSLT does not accept an absolute path

 HomeNewsGroups | Search | About
 comp.lang.perl.modules    Post an article   get this group's latest topics as an RSS feed add this group's latest topics to your My MSN content add this group's latest topics to your My Yahoo content
Subject Author Date
XML::XSLT does not accept an absolute path Nick Monyatovsky 11-15-2007
Posted by Nick Monyatovsky on November 15, 2007, 5:02 pm
Please log in for more thread options
I've run into a bug in XML::XSLT. If you give it an .xsl file by an
absolute name, it fails with the message:

Error while parsing: no element found at line 1, column 0, byte -1 at
C:/Perl/site/lib/XML/Parser.pm line 185

If you use relative path, no problems.

The line that's casuing the error is this:

my $xslt = XML::XSLT->new( $xslfile, warnings => 1, debug => 1);

There are no spaces anything else "weird" in the absolute path.
But this is on Windows, so it begins with "D:\users".

This looks like a minor omission somewhere in the module.
How can this be corrected?

Thanks,
-- Nick Monyatovsky

Posted by Nick Monyatovsky on November 15, 2007, 5:50 pm
Please log in for more thread options
On Thu, 15 Nov 2007 17:02:18 -0500, Nick Monyatovsky

>I've run into a bug in XML::XSLT. If you give it an .xsl file by an
>absolute name, it fails with the message:
>
>Error while parsing: no element found at line 1, column 0, byte -1 at
>C:/Perl/site/lib/XML/Parser.pm line 185
>
>If you use relative path, no problems.
>
>The line that's casuing the error is this:
>
>my $xslt = XML::XSLT->new( $xslfile, warnings => 1, debug => 1);
>
>There are no spaces anything else "weird" in the absolute path.
>But this is on Windows, so it begins with "D:\users".
>
>This looks like a minor omission somewhere in the module.
>How can this be corrected?
>
>Thanks,
>-- Nick Monyatovsky

This is what happens under the hood:

creating parser object:
opening xsl...
SOURCE = D:\users\nmw\work\udev_appver\t\portfolio.xsl
opening document
Opening URL
FILENAME 0 = D:\users\nmw\work\udev_appver\t\portfolio.xsl
FILENAME URI:
D:%5Cusers%5Cnmw%5Cwork%5Cudev_appver%5Ct%5Cportfolio.xsl
NEW FILENAME:
*** Error: Could not create an instance of the XSL Processor using
D:\users\nmw\work\udev_appver\t\p
ortfolio.xsl: Error while parsing:
no element found at line 1, column 0, byte -1 at
C:/Perl/site/lib/XML/Parser.pm line 185

So,

either XSL::XSLT is wrong by calling

URI->new_abs( $filename, $base );

or URI is wrong by returning a string that no FileHandle will be able
to open

D:%5Cusers%5Cnmw%5Cwork%5Cudev_appver%5Ct%5Cportfolio.xsl

What do you think?

-- Nick Monyatovsky

Posted by Mumia W. on November 15, 2007, 8:45 pm
Please log in for more thread options
On 11/15/2007 04:02 PM, Nick Monyatovsky wrote:
> I've run into a bug in XML::XSLT. If you give it an .xsl file by an
> absolute name, it fails with the message:
>
> Error while parsing: no element found at line 1, column 0, byte -1 at
> C:/Perl/site/lib/XML/Parser.pm line 185
>
> If you use relative path, no problems.
>
> The line that's casuing the error is this:
>
> my $xslt = XML::XSLT->new( $xslfile, warnings => 1, debug => 1);
>
> There are no spaces anything else "weird" in the absolute path.
> But this is on Windows, so it begins with "D:\users".
>
> This looks like a minor omission somewhere in the module.
> How can this be corrected?
>
> Thanks,
> -- Nick Monyatovsky

Can't you use forward slashes?

D:/users/thefile.xml



Posted by Nick Monyatovsky on November 16, 2007, 10:13 am
Please log in for more thread options
On Thu, 15 Nov 2007 19:45:47 -0600, "Mumia W."

>On 11/15/2007 04:02 PM, Nick Monyatovsky wrote:
>> I've run into a bug in XML::XSLT. If you give it an .xsl file by an
>> absolute name, it fails with the message:
>>
>> Error while parsing: no element found at line 1, column 0, byte -1 at
>> C:/Perl/site/lib/XML/Parser.pm line 185
>>
>> If you use relative path, no problems.
>>
>> The line that's casuing the error is this:
>>
>> my $xslt = XML::XSLT->new( $xslfile, warnings => 1, debug => 1);
>>
>> There are no spaces anything else "weird" in the absolute path.
>> But this is on Windows, so it begins with "D:\users".
>>
>> This looks like a minor omission somewhere in the module.
>> How can this be corrected?
>>
>> Thanks,
>> -- Nick Monyatovsky
>
>Can't you use forward slashes?
>
>D:/users/thefile.xml
>

No, no luck there either. Same error.

Posted by Christian Winter on November 16, 2007, 12:02 pm
Please log in for more thread options
Nick Monyatovsky wrote:
> On Thu, 15 Nov 2007 19:45:47 -0600, "Mumia W."
>
>> On 11/15/2007 04:02 PM, Nick Monyatovsky wrote:
>>> I've run into a bug in XML::XSLT. If you give it an .xsl file by an
>>> absolute name, it fails with the message:
>>>
>>> Error while parsing: no element found at line 1, column 0, byte -1 at
>>> C:/Perl/site/lib/XML/Parser.pm line 185
>>>
>>> If you use relative path, no problems.
>>>
>>> The line that's casuing the error is this:
>>>
>>> my $xslt = XML::XSLT->new( $xslfile, warnings => 1, debug => 1);
>>>
>>> There are no spaces anything else "weird" in the absolute path.
>>> But this is on Windows, so it begins with "D:\users".
>>>
>>> This looks like a minor omission somewhere in the module.
>>> How can this be corrected?
>>>
>>
>> Can't you use forward slashes?
>>
>> D:/users/thefile.xml
>>
>
> No, no luck there either. Same error.

Try passing the absolute path as a file URI:
file:///D:/users/thefile.xml

Neither XML::XSLT nor URI make a distinction between
local paths and URLs as their arguments, so to satisfy
LWP::Simple's get() method, one needs to prefix with
the correct scheme.

-Chris

Similar ThreadsPosted
How good is XML::XSLT? December 8, 2004, 10:27 am
XML::XSLT not recognizing attributes January 14, 2005, 2:08 pm
Adding XSLT information to XML generated by DBIx::XML_RDB July 20, 2008, 10:00 am
Why is nothing found in @INC path ?!?! April 21, 2006, 2:39 pm
CGI Cookie Path Question December 26, 2005, 10:53 am
skip path prune July 17, 2006, 12:34 pm
In SVG, persistent signs in path ? October 25, 2007, 7:20 pm
Graph Path Module April 14, 2008, 5:37 am
Getting Path of an external DLL in Perl: Inline C. October 2, 2005, 8:41 pm
Customizing include path with CPAN install November 22, 2004, 9:46 am

Our other projects:

Art Dolls, Fairies and Mermaids - Sunnyfaces.net

Roy's Linux, Programming and Search Engines messages

1-Script XML SitemapXML Sitemap