Note that there are some explanatory texts on larger screens.

plurals
  1. POwhile compling junk message was generating by using xslt transform in c#
    primarykey
    data
    text
    <p>hi here i am generating hex 01 and hex 03 with xslt and using c# on transformation hex 01 was genarating like a space in text document if i see in hexadecimal format i could see </p> <p> some junk is generating before the hex 01, note this issue was not replicating for hex 03 it was working good,exactly etx was generating, how could i solve this issue ? any idea please..</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;msxsl:script implements-prefix="myScripts" language="C#"&gt; public string ETX() { return '\u0003'.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:value-of select="myScripts:ETX()"&gt;&lt;/xsl:value-of&gt; &lt;/xsl:template&gt; &lt;/xsl:stylesheet&gt; </code></pre> <p>here is my c# code behind code :</p> <pre><code> XslCompiledTransform transform = new XslCompiledTransform(true); transform.Load(strCTD, new XsltSettings() { EnableScript = true }, null); // Loading the given Xslt document var writerSettigns = transform.OutputSettings.Clone(); writerSettigns.CheckCharacters = false; string strFileName = strpath + langid + strCSVFILE + strMsgType + strORGMSG + strSeqNum + strNowDate + strHour + strMin + strSec + ".FTS"; try { MemoryStream memoryStream = new MemoryStream(); XmlWriterSettings xmlWriterSettings = new XmlWriterSettings(); xmlWriterSettings.Encoding = new UTF8Encoding(false); xmlWriterSettings.ConformanceLevel = ConformanceLevel.Document; xmlWriterSettings.Indent = true; using (XmlWriter writer = XmlWriter.Create(strFileName, writerSettigns)) { transform.Transform("sampleCTD.xml", xmlArgsList, writer); } string xmlString = Encoding.UTF8.GetString(memoryStream.ToArray()); System.IO.StreamWriter file = new System.IO.StreamWriter(strFileName); file.WriteLine(xmlString); file.Close(); } catch (Exception ex) { LogError(1, "Form1", "FileGenerationForCID", ex.Message.ToString(), ex.StackTrace.ToString()); throw ex; } </code></pre> <p>i have added some code to to avoid BOM error on starting of the text, even though it was not sorted out kindly please can any one suggest on this to me soon ....</p>
    singulars
    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.
 

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