Re: [xsl] Exception thrown by OutputURIResolver: Invalid syntax for base URI: Illegal character

Subject: Re: [xsl] Exception thrown by OutputURIResolver: Invalid syntax for base URI: Illegal character
From: Lighton Phiri <lighton.phiri@xxxxxxxxx>
Date: Sun, 29 Jul 2012 19:48:21 +0200
Thank you Michael. I was trying to explore the possibility of
preserving the directory names I am working with on disk, but seeing
that the only way out is to write another OutputURIResolver, then I'll
just rename all files with apprropriate URIs.

Just to give you a bit more context, I have a collection of digital
objects on disks with associated metadata in a database. I am moving
the metadata from the database to XML files and was basically trying
to preserve the original direct

Lighton Phiri
http://lightonphiri.org


On 29 July 2012 18:39, Michael Kay <mike@xxxxxxxxxxxx> wrote:
>
> I think that if you want to use filenames that aren't valid as URIs you will
> probably need to write your own OutputURIResolver. You might be able to get
> around the problem by %HH-escaping the special characters, but I suspect it
> will then write a filename containing the %HH escape sequence.
>
> Michael Kay
> Saxonica
>
>
> On 29/07/2012 16:30, Lighton Phiri wrote:
>>
>> I am working with XSLT 2.0 using Saxon 9.1.0.8J, and attempting to
>> write child elements by dynamically creating file paths, however, at
>> some point during processing, I run into the error below.
>>
>>      <source node="/sitesdata/site[272]" line="56663"
>> file="chunkXMLExportNormalised.xml">
>>       <xsl:template match="site" line="23" column="31"
>> module="splitPreprocessor.xsl">
>>        <xsl:variable name="tmp-normalised-localName" line="26"
>> module="splitPreprocessor.xsl">
>>         <xsl:variable name="tmp-filename" line="52"
>> module="splitPreprocessor.xsl">
>>          <xsl:variable name="filename" line="54"
>> module="splitPreprocessor.xsl">
>>           <xsl:result-document href="{$filename}" line="59" column="46"
>> module="splitPreprocessor.xsl">
>> Error on line 59 of splitPreprocessor.xsl:
>>    Exception thrown by OutputURIResolver: Invalid syntax for base URI:
>> Illegal character in
>>    path at index 60:
>>
>> ../data/Sites/3218AD%5C%20Eland%5C's%5C%20Bay/Koppie/K740%5C[1%5C]/273.metadata
>> Transformation failed: Run-time errors were reported
>>
>> A quick check online [1] seems to suggest that its something to do
>> with square brackets in file paths, and true to that, some of my file
>> paths have '[' and ']' characters in them. How do I resolve this?
>>
>> [1]
>> http://www.velocityreviews.com/forums/t598542-square-bracket-possible-in-href-of-xsl-result-document.html
>>
>> Lighton Phiri
>> http://lightonphiri.org

Current Thread