With the release of Saxon 8.7.1 comes the need for an updated demo. I am presently working on an extended demo that brings together the use of credentials, atom feeds as both config and page content source files, Microsoft’s LiveClipboard and Amazon’s S3. There are a few more finishing touches that need to be made, one of which requires testing against the new LiveClipboard codebase as soon as the new spec and sample code releases. When it does, and all test’s have gone as expected (or my code base fixed if they haven’t) I will create a new post with the code an annotated overview.

However, to help get you going here is a non-annotated code base that implements use of a direct .NET Stream and a couple of changes to setting the baseURI. Please see the original post in this series for more details.

I will create a new post with the above mentioned features as soon as its ready to go.

In the mean time, enjoy!


<%@ Page Trace="false" Language="C#" Debug="false"%>
<%@ Import Namespace="System" %>
<%@ Import Namespace="System.IO" %>
<%@ Import Namespace="System.Xml" %>
<%@ Import Namespace="Saxon.Api" %>

<script runat="server">

    void Page_Load(Object sender, EventArgs e)
    {

    String sourceUri = Server.MapPath("./index.xml");
    String xsltUri = Server.MapPath("./index.xslt");
    String baseUri = Request.Url.AbsoluteUri.ToString();

    XmlUrlResolver resolver = new XmlUrlResolver();
    Uri sUri = new Uri(sourceUri);
    Uri xUri = new Uri(xsltUri);

    using (Stream sXml = (Stream)resolver.GetEntity(sUri, null, typeof(Stream)))
    {

    using (Stream sXsl = (Stream)resolver.GetEntity(xUri, null, typeof(Stream)))
    {

    Processor processor = new Processor();

    DocumentBuilder builder = processor.NewDocumentBuilder();

    builder.BaseUri = new Uri(baseUri);

    XdmNode input = builder.Build(sXml);

    XsltCompiler compiler = processor.NewXsltCompiler();

    compiler.BaseUri = new Uri(baseUri);

    XsltTransformer transformer = compiler.Compile(sXsl).Load();

    transformer.InitialContextNode = input;

    Serializer serializer = new Serializer();

    serializer.SetOutputWriter(Response.Output);

    transformer.Run(serializer);
    }
    }
    }

</script>

This code base requires the Saxon 8.7.1 processor binaries for the .NET platform, accessible directly from Saxonica.

Please feel free to comment, ask questions, etc.. that are specific to this implementation. Technical support for the Saxon Processing Engine should, as always, be directed through the SourceForge support list accessible from http://saxon.sf.net