Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I am not sure what exception you had since what you showed does not seem to be complete. 0x01 is not a valid Xml character and this might be the reason for the exception. I created a slightly different version of your stylesheet that looks like this:</p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:msxsl="urn:schemas-microsoft-com:xslt" exclude-result-prefixes="msxsl" xmlns:myScripts="myScripts"&gt; &lt;xsl:output method="text" indent="yes"/&gt; &lt;msxsl:script implements-prefix="myScripts" language="C#"&gt; public string SOH() { return '\u0001'.ToString(); } &lt;/msxsl:script&gt; &lt;xsl:template match="/"&gt; &lt;xsl:value-of select="myScripts:SOH()"&gt;&lt;/xsl:value-of&gt; &lt;/xsl:template&gt; &lt;/xsl:stylesheet&gt; </code></pre> <p>To prevent it from failing due to the invalid character I needed to disable character checking in the writer that writes the response:</p> <pre><code>var xslt = new XslCompiledTransform(); xslt.Load(@"C:\Temp\xsl.xsl", new XsltSettings() { EnableScript = true }, null); var xml = new XPathDocument(new StringReader("&lt;root/&gt;")); var writerSettigns = xslt.OutputSettings.Clone(); writerSettigns.CheckCharacters = false; xslt.Transform(xml, XmlWriter.Create(Console.Out, writerSettigns)); </code></pre> <p>what resulted in the following output:</p> <pre><code>☺Press any key to continue . . . </code></pre> <p>As you can see the character was written to the output without and there was no exception.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload