[xsl] URIResolver: Invalid relative URI with square brackets

Subject: [xsl] URIResolver: Invalid relative URI with square brackets
From: Calvados Boulard <calvados.boulard@xxxxxxxxx>
Date: Tue, 18 May 2010 12:42:08 -0700
Hello all,

I'm having a problem with an Invalid URI that contains square brackets
"[", and "]".  I believe my problem is that I need to turn off
validation within my java saxon transform, but I'm not certain.  The
reason I believe this, is that I'm able to transform the xml in oXygen
with schema validation turned off without issue.

What I'm attempting to do is to use the xsl document function to test
for the presence of an attribute.  The target xml document contains
the locations of other xml documents to be tested for the presence of
said attrubute.  Problem being is that the names of those xml files
contain square brackets.  I know this sounds a bit muddled, so I've
included some source code below.

I keep getting:

 "FODC0005: Exception thrown by URIResolver: Invalid relative URI
  {file:////D:/Eclipse%20WS/Recon...}: Illegal character in path at index 95:
  file:////D:/Eclipse%20WS/ReconSubcontent/sync_live/--%20A%20--/Access%20to%20Education%20Act%20[SBC%202001]%20c.%201/00_01001REP_01.xml"

I've tried replacing out the square brackets with &#91; and &#93; to no avail.

I've written a small translate function in Java that utilizes
saxon9.jar as follows:

public static String transform(StreamSource xslStream, InputStream
xmlStream, String paramName, String paramValue) throws
TransformerException, IOException
{
System.setProperty("javax.xml.transform.TransformerFactory",
"net.sf.saxon.TransformerFactoryImpl");
TransformerFactory tFactory = TransformerFactory.newInstance();
Transformer transformer = tFactory.newTransformer(xslStream);
if(paramName!=null)
{
transformer.setParameter(paramName, paramValue);
}
StringWriter sw = new StringWriter();
StreamResult out = new StreamResult(sw);
transformer.transform(new StreamSource(xmlStream), out);
String result = "";
result = sw.toString();
sw.close();
xmlStream.close();
return result;
}


My Source xml is as follows:

<site>
    <document name="-- A --" id="524872423" title="-- A --"
first-child-content="no">
        <document name="Access to Education Act SBC 2001 c. 1" id="01001REP"
            title="Access to Education Act [SBC 2001] c. 1"
first-child-content="no">
            <document id="00_01001REP_01" name="00_01001REP_01.xml"
title="Access to Education Act"
                location="D:\Eclipse WS\ReconSubcontent\sync_live\-- A
--\Access to Education Act [SBC 2001] c. 1\00_01001REP_01.xml"
                content-type="text/xml" indexsheet="qp-xml"/>
        </document>
    </document>
</site>

My xsl template is as follows:

<xsl:template match="*[descendant-or-self::document[contains(@location,
'.xml')][document(concat('file:////',translate(@location,'\','/')))//ccollect[@value=$ccollectValue]]]">
<xsl:copy>
<xsl:copy-of select="@*"/>
<xsl:apply-templates/>
</xsl:copy>
</xsl:template>

Any advice on resolving this issue would be greatly appreciated.

Thanks,
Cal.

Current Thread