exception in compile and load xslt

Anand R
  • Anand R

    Anand R - 2010-05-04


    I am using xslt 2.0 using saxon processor.

    Everyting is working fine if i load xslt from file using Uri like:
    XsltTransformer transformer = processor.NewXsltCompiler().Compile(new

    But if i want to load xslt from string which is coming from db then i can
    System.Text.ASCIIEncoding myEncoder2 = new System.Text.ASCIIEncoding();
    Byte bytes2 = myEncoder2.GetBytes(stringxslt);
    Stream mstream2 = new MemoryStream(bytes2);
    XmlReader reader2 = XmlReader.Create(mstream2);
    XsltTransformer transformer =

    This is very clear but i get exception saying that "value can not be null.
    parameter name: BaseUri".

    I dont know why i am getting this and what is the best way to load my xslt
    from string insted if URI.

    Please suggest.


  • Michael Kay

    Michael Kay - 2010-05-05

    This interface requires you to supply a base URI for the stylesheet, by
    setting the BaseUri property on the XsltCompiler. The base URI will be used if
    the stylesheet does an xsl:import or xsl:include, or if it uses the doc() or
    document() functions, or in a number of other circumstances. Some other Saxon
    APIs allow the base URI to be left unspecified, in which case you only get the
    error when Saxon tries to use it, but this can lead to errors that are
    difficult to diagnose, so for this API I decided to make the base URI
    mandatory. If you think there's nothing in the stylesheet that will use the
    base URI, then it doesn't matter what value you specify, so long as it isn't


Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

No, thanks