Issue with XSL Processor's Add Parameter Function

  • Thread starter Thread starter gschmitz1
  • Start date Start date
G

gschmitz1

Guest
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 this 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?

KB4088776 can be found at https://support.microsoft.com/en-us/help/4088776/windows-10-update-kb4088776 - sorry, can't post links yet.

Continue reading...
 
Back
Top