Hello,
I'm loading XSL from an XML document using this code (XSL has embedded data):public void SetHtmlSourceFromXmlDocument(XmlDocument xmlDocument) { var transform = new XslCompiledTransform(); transform.Load(xmlDocument); // ... }
On customer computers transform.Load(xmlDocument)
will
take 15 seconds the first time. Subsequent calls will take ~1 ms. Software restart: first call takes again 15 seconds.
This happens only with our server build, a build from my computer (also release) will run just fine (the only thing I know that the server build signs assemblies). This problem also occurs only on non-developer systems (no Visual Studio, no internet access, only intranet). On one of the problematic systems this problem disappeared, but I have no idea why (It seems I did something buy I don't know what, can't reproduce the error on this system anymore).
I also tried transform.Load(xmlDocument,
null, null)
or supplying my own XmlResolver
(GetEntity
is
never called), because I read that XslCompiledTransform
could
try to access the xmlns namespace urls to validate the document (maybe I misunderstood that).
I can't install Visual Studio on these machines for debugging. Has someone an idea what could cause this or what I could try to find the issue?
I asked this question a few days ago on stackoverflow (question 29397657) with no luck (can't provide link because I'm not allowed to post links here).
Xml Document:
<?xml version="1.0" encoding="utf-8"?><?xml-stylesheet type="text/xsl" encoding="utf-8" href="#"?><xsl:stylesheet version="1.0" xmlns:data="http://zeiss.com/" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"><data:data><calibrationLog><name>DetectorOffsetCalibration</name><entry timestamp="2015-03-25T18:49:24.0313832+01:00" userGroup="Customer" level="Info" indent="0" message="Created at Wednesday, 25 March 2015 18:49:24 (+01 UTC) by Developer on ZEISS-PC." /></calibrationLog></data:data><xsl:template match="xsl:stylesheet"><xsl:apply-templates select="data:data" /></xsl:template><xsl:template match="calibrationLog"><html><head><meta http-equiv="Content-Type" content="text/html;charset=UTF-8" /><meta http-equiv="X-UA-Compatible" content="IE=edge" /><title><xsl:value-of select="name" /></title><style type="text/css"> html, body, p { margin: 0; padding: 0; font-family: Arial; font-size: 12pt; background-color: #FFFFFF;; } p { white-space: pre-wrap; }</style></head><body><h3 style="margin: 0.2em 1em;">Calibration Log "<xsl:value-of select="name" />"</h3><xsl:for-each select="entry"><xsl:variable name="style"><xsl:choose><xsl:when test="@level = 'Debug'">display: none</xsl:when><xsl:when test="@level = 'Info'">color: Black; background-color: White</xsl:when><xsl:when test="@level = 'IntermediateResult'">color: Black; background-color: CornflowerBlue</xsl:when><xsl:when test="@level = 'Result'">color: Black; background-color: YellowGreen</xsl:when><xsl:when test="@level = 'SilentWarning'">color: Black; background-color: Yellow</xsl:when><xsl:when test="@level = 'Warn'">color: Black; background-color: Yellow</xsl:when><xsl:when test="@level = 'Error'">color: White; background-color: OrangeRed</xsl:when><xsl:when test="@level = 'Device'">color: Lightgray; background-color: White</xsl:when><xsl:when test="@level = 'Section'">color: Darkmagenta; background-color: White; font-weight: Bold; border-color: darkmagenta; border-width: 10; border-top-style: Double; border-bottom-style: Double; margin: 0.5em 0; padding-top: 0.3em; padding-bottom: 0.3em</xsl:when><xsl:when test="@level = 'SubSection'">color: Darkmagenta; background-color: White; font-weight: Bold;</xsl:when></xsl:choose></xsl:variable><xsl:variable name="currentIndent" select="1.25 + @indent" /><p style="{$style}; padding-left: {$currentIndent}em; text-indent: -1em;"><xsl:value-of select="@message" /></p></xsl:for-each></body></html></xsl:template></xsl:stylesheet>