Cannot find a script or an extension object associated with namespace 'http://schemas.microsoft.com/office/infopath/2003/xslt/xDocument'

StackOverflow https://stackoverflow.com/questions/16601586

  •  29-05-2022
  •  | 
  •  

Question

I'm attempting to XSLT transform an InfoPath document from XML to HTML, and I get the following error:

Cannot find a script or an extension object associated with namespace 'http://schemas.microsoft.com/office/infopath/2003/xslt/xDocument'.

Is it even possible to transform the document? I note the XSL makes use of functions such as xdXDocument:GetDOM which look like the old MSXML syntax. Can you add support for MSXML during the transform?

For reference the Namespace is:

xmlns:xdXDocument="http://schemas.microsoft.com/office/infopath/2003/xslt/xDocument" 

This article suggests that you simply use the Print View of the InfoPath document - but I think that might be unique to InfoPath 2007 (post-2010 it seems you can print any view).


As an aside, I also tried using MSXML and I got a similar error:

Namespace 'http://schemas.microsoft.com/office/infopath/2003/xslt/xDocument' does not contain any functions.

Here's my MSXML code:

var xml = new MSXML2.DOMDocument60();
xml.load(txtXmlFilePath.Text);
var lines = File.ReadAllLines(txtXslFilePath.Text);

// Seemingly need to strip out first <?xml... /> line to work
string sXsl = string.Join("\n", lines.Skip(1).ToArray());

var xsl = new MSXML2.DOMDocument60();
xsl.loadXML(sXsl);

string html = xml.transformNode(xsl);

So the basic question remains - how do you transform an XSLT transform an InfoPath document?

Était-ce utile?

La solution

xdXDocument:GetDOM() is an extension function that is used to access data from secondary data sources in InfoPath. I have worked with the task of using InfoPath view XSLTs to convert InfoPath XML documents to HTML, and the only way I know of to handle these extension functions is to write extension objects that implement them (you could implement dummy extension objects that just return empty nodesets for these functions if you don't need them.

The alternative is to create a view that doesn't have any references to the form's secondary data sources.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top