Changing the XSLT to use the source document base URI isn't going to make any difference, because that isn't known either; you need to change the calling application to set a base URI (on either the stylesheet or the source document or both) as I suggested.

By default, for resolving URIs Saxon does what Java does - more specifically in this case, the OpenJDK Java library. Generally this is a pretty strict interpretation of the relevant W3C and IETF specifications.

If you want to handle things in a more Windows-like way, for example handling UNC filenames (which don't map at all well to any of the URI/URL specifications), or names with spaces that haven't been %HH escaped, then I would suggest using an XmlResolver to intercept the calls and resolve them yourself.

Michael Kay
Saxonica

On 13/04/2012 17:24, Tsosie, Lawrence SIK wrote:
Thank you for the reply Micheal.
 
I have changed my XSLT and the document() call.  It now contains the following update:
<xsl:variable name ="_intfModelName" select ="substring-before(@Text,':/')"/>
<xsl:variable name ="_intfFileName" select ="concat('../../OtherXMLFiles/',$_intfModelName,'.xml')"/>
<xsl:apply-templates select ="document($_intfFileName, /)/*[@Name=$_intfModelName]/*">
</xsl:apply-templates>
 
Unfortunately, the results are the same – no data.  By the way, there are no blanks.
 
In my Internet searches (and I cannot recall the source) I might have read that the saxon XSLT processor does not handle UNC paths that contain spaces well?  If that is so, then there is a problem with that.  Also, the location of our saxon.HE executable & dll files are located on a dedicated server which our app references and our data resides on another server(s) and/or personal computers.  Regardless, the directory structure will always be the same, in regards to relative paths (based on the initial source XML File).
 
I’m at a loss at this point… any assistance is appreciated.
Thank you.
- Lawrence D Tsosie
 
_____________________________________________
From: Michael Kay (mi...@saxonica.com)
Subject: Re: [saxon] App using saxonHE (9.2.1.1) api to process XSLT (v2.0) against multiple XML files
 
 
The problem is that you are calling document() to resolve a relative URI
whose base URI is unknown. Because you use substring-before to compute
the relative URI, the argument is a string, so the base URI it will use
is that of the stylesheet. The stylesheet's base URI is unknown because
you built the stylesheet from a stream; in this situation Saxon defaults
to the current working directory. You can set the base URI using the
XsltCompiler.BaseUri property.
 
Alternatively, if you want the relative URI resolved relative to the XML
source document, use "/" as the second argument of the call to document().
 
I'm a little surprised that it's producing blank output rather than an
error. Perhaps Saxon isn't catching all the relevant exceptions.
 
Michael Kay
Saxonica
 
On 12/04/2012 22:20, LAWRENCE D TSOSIE wrote:
I have an application that uses the SAXONHE 9.2.1.1 api files to transform XML
data to plain text. My form has textboxes for
1) XMLInput_FilePath
2) XSLT_FilePath
3) TextOutput_FilePath
 
On the okButton_Click() event of my form, I have the following:
private void okButton_Click(object sender, EventArgs e) {
      FileStream xsltTransform_FileStream = File.Open
(xsltTransform_FilePath.Text, FileMode.Open, FileAccess.Read,
FileShare.ReadWrite);
      FileStream xmlInput_FileStream = File.Open(xmlInput_FilePath.Text,
FileMode.Open, FileAccess.Read, FileShare.ReadWrite);
       XmlTextReader modelFileXML = new XmlTextReader(xmlInput_FileStream);
modelFileXML.XmlResolver = null;
       Processor processor = new Processor();
       XdmNode input = processor.NewDocumentBuilder().Build(modelFileXML);
       XsltTransformer xsltTransformer = processor.NewXsltCompiler().Compile
(xsltTransform_FileStream).Load();
       xsltTransformer.InputXmlResolver = null;
       xsltTransformer.InitialContextNode = input;
       Serializer serializer = new Serializer();
       serializer.SetOutputFile(writeFile);
       xsltTransformer.Run(serializer);
       xsltTransform_FileStream.Close();
      modelFileStream.Close();
}
 
Within the context of my XMLInput file there is a reference to data in another
XML file (save XMLInput2_File).
<Path Text="XMLInput2_File:/XMLInput2_File/Subsystem_1/Field_3" />
 
The Text attribute is where the external XML File path is stored, in the above
example, the XML filename would be "XMLInput2_File.xml".
 
Within my XSLT, I have the following:
<xsl:variable name ="_intfModelName" select ="substring-before(@Text,':/')"/>
<xsl:variable name ="_intfFileName" select ="concat
('../../OtherXMLFiles/',$_intfModelName,'.xml')"/>
<xsl:apply-templates select ="document($_intfFileName)/*
[@Name=$_intfModelName]/*">
</xsl:apply-templates>
 
Every time I use the C# Winforms application with the saxon api calls, my
resulting output is blank.  Using Microsoft's Visual Studio 2008 Professional
Edition to test the XSLT against the files - I get data.  Is there something
with my saxon api calls??  Any help is appreciated.  Thank you in advance.
 
- Lawrence D Tsosie
 
------------------------------------------------------------------------------
For Developers, A Lot Can Happen In A Second.
Boundary is the first to Know...and Tell You.
Monitor Your Applications in Ultra-Fine Resolution. Try it FREE!
http://p.sf.net/sfu/Boundary-d2dvs2
_______________________________________________
saxon-help mailing list archived at http://saxon.markmail.org/
saxo...@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/saxon-help
 
------------------------------------------------------------------------------
For Developers, A Lot Can Happen In A Second.
Boundary is the first to Know...and Tell You.
Monitor Your Applications in Ultra-Fine Resolution. Try it FREE!
http://p.sf.net/sfu/Boundary-d2dvs2
_______________________________________________
saxon-help mailing list archived at http://saxon.markmail.org/
saxo...@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/saxon-help
 
 


------------------------------------------------------------------------------
For Developers, A Lot Can Happen In A Second.
Boundary is the first to Know...and Tell You.
Monitor Your Applications in Ultra-Fine Resolution. Try it FREE!
http://p.sf.net/sfu/Boundary-d2dvs2


_______________________________________________
saxon-help mailing list archived at http://saxon.markmail.org/
saxon-help@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/saxon-help