Project

Profile

Help

exception in compile and load xslt

Added by Anonymous about 14 years ago

Legacy ID: #8369016 Legacy Poster: Anand R (anandbms)

Hi, 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 Uri(Server.MapPath("MyFile.xsl"))).Load(); But if i want to load xslt from string which is coming from db then i can write: 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 = processor.NewXsltCompiler().Compile(reader2).Load(); 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. Thanks


Replies (1)

RE: exception in compile and load xslt - Added by Anonymous about 14 years ago

Legacy ID: #8369764 Legacy Poster: Michael Kay (mhkay)

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

    (1-1/1)

    Please register to reply