Could not find a part of the path when local path contains special characters (like #) in .NET /Windows
I’ve been using Saxon.net and this has been a problem for me for a while, and I’m just wondering if there is a better way to approach this. When I doing a transformation, I set the BaseURI like the following:
However, if the path contains any special characters, the process fails. In my case, I have a file embedded in a windows directory with a #, and this value is turned into a hex value when saxon tries to find linked files in the style sheet. So for example – say I have: 2 xslts, the primary and a linked xslt at:
C:\mypath\XSLT#\path\myfile.xsl and C:\mypath\XSLT#\path\myfile2.xsl
If I reference myfile2.xsl and use the code above to provide information on resolution, I get an error that says:
Could not find a part of the path at: c:\mypath\XSLT%23\path\myfile2.xsl
Is there any way to over come this. For reference, I’m compiling against .NET 4 client framework – I’m using Saxon HE current via the package manager. I’ve periodically found errors in how .net 4 escapes data versus .net 4.5 – so if that’s the problem, I may have a work around, but I’m stuck and just wanted to know if anyone might have a suggestion.