Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7444221
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T11:28:04+00:00 2026-05-29T11:28:04+00:00

hi here i am generating hex 01 and hex 03 with xslt and using

  • 0

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

 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..

 <?xml version="1.0" encoding="utf-8"?>
 <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">
<xsl:output method="text" indent="yes"/>

<msxsl:script implements-prefix="myScripts" language="C#">
public string SOH()
{
  return '\u0001'.ToString();
}

  </msxsl:script>
 <msxsl:script implements-prefix="myScripts" language="C#">
   public string ETX()
{
  return '\u0003'.ToString();
}
</msxsl:script>

  <xsl:template match="/">
    <xsl:value-of select="myScripts:SOH()"></xsl:value-of>
    <xsl:value-of select="myScripts:ETX()"></xsl:value-of>
 </xsl:template>

</xsl:stylesheet>

here is my c# code behind 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;
                    }

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 ….

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-29T11:28:05+00:00Added an answer on May 29, 2026 at 11:28 am

    What you’re seeing is the UTF-8 BOM, the Byte Order Mark, that allows UTF-8 aware readers to understand the encoding correctly. Perhaps change your output declaration to:

    <xsl:output method="text" indent="yes" encoding="unicode"/>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Here's a coding problem for those that like this kind of thing. Let's see
This tutorial here is a good source of generating kml from the database using
I am generating events on fullCalendar with this code <script type=text/javascript> $(document).ready(function() { $('#calendar').fullCalendar({
I'm dynamically generating image from text, and existing image on my asp.net website. Here
Here's the situation. I'm tasked with auto-generating a rather large document consisting of a
I'm generating Google map by using the code below. What I am doing here
I have a one-to-one relationship but hibernatetool complains when generating the schema. Here's an
Here's the first exception coding I've ever done and guess what, it's generating an
I am generating the xml file using the DOM and the program is working
I am generating a PDF with fPDF. I need to strikethrough a long text

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.