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 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 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





------------------------------------------------------------------------------
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_d2d_jan


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