2

I have some code that's worked fine for years, but has recently stopped after the update to Windows 10 v1709. The IXSLProcessor.addParameter function has stopped working when using the processor returned by XSLTemplate60.CreateProcessor(). Here's a simple console snippet that shows the issue:

C#:

class Program
{
    static void Main(string[] args)
    {
        FreeThreadedDOMDocument60 oXSLDocument = new FreeThreadedDOMDocument60();
        XSLTemplate60 oXSLTemplate = new XSLTemplate60();
        IXSLProcessor oXSLProcessor;

        oXSLDocument.load(@"ParameterTest.xslt");
        oXSLTemplate.stylesheet = oXSLDocument;
        oXSLProcessor = oXSLTemplate.createProcessor();

        oXSLProcessor.input = new DOMDocument60();

        Console.WriteLine("\nThis should say that the value of myParameter is \"Default\":");
        oXSLProcessor.transform();
        Console.WriteLine(oXSLProcessor.output);

        oXSLProcessor.addParameter("myParameter", "Override");
        Console.WriteLine("\nThis should say that the value of myParameter is \"Override\":");
        oXSLProcessor.transform();
        Console.WriteLine(oXSLProcessor.output);

        Console.WriteLine();
        Console.ReadKey();
    }
}

XSLT:

<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
    <xsl:output method="html" omit-xml-declaration="yes" indent="no" />
    <xsl:param name="myParameter" select="'Default'" />
    <xsl:template match="/">
        My parameter is set to: <xsl:value-of select="$myParameter" />
    </xsl:template>
</xsl:stylesheet>

Current Output:

This should say that the value of myParameter is "Default":

            My parameter is set to: Default

This should say that the value of myParameter is "Override":

            My parameter is set to: Default

This used to work properly, as I mentioned, and I can recreate the correct behavior using Windows 10 v1603. The only hint I can find as to what might be going on is KB4088776 from this past March mentioning security fixes to the MSXML library. Does anyone know what I can do to make this work again that doesn't include switching the XML/XSL library I'm using?

1 Answers1

1

I am on Windows version 1803 but could confirm the problem on that version as well. However, a test here that replaces

    oXSLProcessor.addParameter("myParameter", "Override");

with

        oXSLProcessor.addParameter("myParameter", "Override", "");

fixes the problem for me, so you could try that, i.e. instead of not providing a namespace third argument explicitly pass in an empty string.

Martin Honnen
  • 160,499
  • 6
  • 90
  • 110