it works! Thank you Martin.

I think it was the lack of setting of transformer.InputXmlResolver in my vb. 

I have also implemented Michael's suggestions.

Thank you both :-)

Andrew



Message: 1
Date: Thu, 31 Jan 2013 18:46:20 +0100
From: Martin Honnen <Martin.Honnen@arcor.de>
Subject: Re: [saxon] .NET saxon failing to load absolute path within
        document() in XSL transformation.
To: Mailing list for the SAXON XSLT and XQuery processor
        <saxon-help@lists.sourceforge.net>
Message-ID: <510AADEC.2080107@arcor.de>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed

Andrew G C Cheung wrote:
> Using vb.net <http://vb.net> and I have referenced the two saxon dll's
> etc. Inside windows 7 x64.
>
> I have a source xml file which contains absolute paths as attributes.
> e.g.
>
> <root>
>      <paths>
>          <history path="G:/path to file name on networked drive which
> includes spaces.xml"/>
>          <history path="G:/path to file name on networked drive which
> includes spaces2.xml"/>
>          <history
> path="file:///G:/Projects/projname/Version4.0/MetaData/ProjName_MD.xml"/>

That format looks fine to me as a URL.


>              Dim transformer As XsltTransformer
>              Dim XmlReader As XmlReader = New XmlNodeReader(xdoc)
>              Dim input As XdmNode =
> proc.NewDocumentBuilder().Build(XmlReader)
>
>              '// Create a transformer for the stylesheet.
>              transformer = compiler.Compile(New
> System.Uri("G:\Projects\cta_createVersionHistory.xsl")).Load()
>
>
>              transformer.InputXmlResolver = Nothing

Why are you setting the InputXmlResolver to Nothing? Shouldn't that be
                transformer.InputXmlResolver = New XmlUrlResolver
?







------------------------------

Message: 2
Date: Fri, 01 Feb 2013 17:50:20 +0000
From: Michael Kay <mike@saxonica.com>
Subject: Re: [saxon] .NET saxon failing to load absolute path within
        document() in XSL transformation.
To: saxon-help@lists.sourceforge.net
Message-ID: <510C005C.4000506@saxonica.com>
Content-Type: text/plain; charset="iso-8859-1"

Sorry, I haven't had a chance to have a proper look at this.

It's not a good idea to use Windows filenames in place of URIs (like
G:\Projects\cta_createVersionHistory.xsl). Even if they can be
dereferenced, resolving relative URIs against them might not work. Use
file:///G:/Projects/cta_createVersionHistory.xsl.

I think the most likely reason though is that the base URI of your
principal source document isn't known - because it's supplied as an
in-memory DOM.

Michael Kay
Saxonica


On 31/01/2013 17:10, Andrew G C Cheung wrote:
> Using vb.net <http://vb.net> and I have referenced the two saxon dll's
> etc. Inside windows 7 x64.
>
> I have a source xml file which contains absolute paths as attributes.
> e.g.
>
> <root>
>     <paths>
>         <history path="G:/path to file name on networked drive which
> includes spaces.xml"/>
>         <history path="G:/path to file name on networked drive which
> includes spaces2.xml"/>
>         <history
> path="file:///G:/Projects/projname/Version4.0/MetaData/ProjName_MD.xml"/>
>     </paths>
> ....
> ....
> </root>
>
>
> Transformation includes document(@path) (within a for-each)
>
> This works in oXygen, inside ANT script and using the "Transform.exe"
> tool bundled with the saxon for .net download (9.4HE).
>
> However from .net I can't seem to get it to work, just doesn't load
> using the document function
>
> I have tried different slashes, multiple slashes, prepending with
> "file://", setting base uri for compiler etc. searched the mailing
> lists/documentation. It's probably something simple but i can't work
> it out!
>
> vb.net <http://vb.net> code:
>
>             Dim proc As New Saxon.Api.Processor()
>             Dim compiler As XsltCompiler = proc.NewXsltCompiler()
>             compiler.BaseUri = New Uri(filepath of source doc - loads
> fine.)
>             Dim transformer As XsltTransformer
>             Dim XmlReader As XmlReader = New XmlNodeReader(xdoc)
>             Dim input As XdmNode =
> proc.NewDocumentBuilder().Build(XmlReader)
>
>             '// Create a transformer for the stylesheet.
>             transformer = compiler.Compile(New
> System.Uri("G:\Projects\cta_createVersionHistory.xsl")).Load()
>
>
>             transformer.InputXmlResolver = Nothing
>             transformer.InitialContextNode = input
>
>             Dim serializer As Serializer = New Serializer()
> serializer.SetOutputFile("versionHistory.xml")
>             transformer.Run(serializer)
>
>
> Any ideas?
>
> Thank you!!!
>
> Andrew