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

  • SEARCH
  • Home
  • 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 1009831
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T08:59:19+00:00 2026-05-16T08:59:19+00:00

I have an XSLT transform I am using to process an XML file, inserting

  • 0

I have an XSLT transform I am using to process an XML file, inserting it into the body of my aspx page.

Reference the following for background information:

background on xml/xslt

I have the following in my xml file:

<?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:myCustomStrings="urn:customStrings">
  <xsl:output
    method="xml" version="2.0"
    media-type="text/html"
    omit-xml-declaration="yes"
    indent="yes"
 />...unrelated stuff left out here

Here is the output that is relevent:

<div id="example" />
    <?xml version="1.0" encoding="utf-8"?><div xmlns:myCustomStrings="urn:customStrings"><div id="imFormBody" class="imFormBody">

My question relates to the output, specifically to the <?xml version="1.0" encoding="utf-8"?> which is getting included in the output anyway. Is the issue related to the custom method I have used? If so, I don’t really see the need to include the xml part as the namespace is in the div tag. Is there a way to ensure that this extra stuff gets left out as I asked it to?

transform code: yeah, its ugly but I am prototyping some stuff 🙂

public static string SmartNotePageFromTemplate(string patientVisitId, string followupType, bool copyPreviousNote)
    {
        // create custom object
        CustomStrings customStrings = new CustomStrings();//specify class for use in XSLT

        string noteXmlFile = ImSmartNotesConfig.GetSmartNotesXmlFile();//get xml data file name from config
        string noteXslFile = ImSmartNotesConfig.GetSmartNotesXsltFile();// get xslt file name from config

        string subXmlFile = "../SmartNotesXml/testData.xml";
        string subCSSFile = "../CSS/testCSS.css";
        string subJSFile = "../Js/testJS.js";

        try
        {
            XsltSettings settings = new XsltSettings(true, true);// allow the document() in the xslt

            XsltArgumentList xslArg = new XsltArgumentList();// create argument list for xslt
            xslArg.AddParam("subXmlFile", "", subXmlFile);
            xslArg.AddParam("subCSSFile", "", subCSSFile);
            xslArg.AddParam("subJSFile", "", subJSFile);
            //pass an instance of the custom object
            xslArg.AddExtensionObject("urn:customStrings", customStrings);

            XslCompiledTransform myXslt = new XslCompiledTransform(true);// we will use the compiled xslt processor
            myXslt.Load(noteXslFile, settings, new XmlUrlResolver());// load the xslt in
            StringWriter stWrite = new StringWriter();// create output writer

            //myXslt.Transform(noteXmlFile, xslArg, stWrite);// transform 
            SmartNote.BL.SmartNoteLogic logic = new SmartNote.BL.SmartNoteLogic();
            XmlDocument noteXml = logic.GetNewNoteXml(patientVisitId, followupType, copyPreviousNote);
            myXslt.Transform(noteXml, xslArg, stWrite);// transform 

            return stWrite.ToString();// put the StringWriter as a string to the output- html page in this instance, as used in the .aspx.cs file
        }
        catch (Exception e)
        {
            throw e;
        }
    }
  • 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-16T08:59:20+00:00Added an answer on May 16, 2026 at 8:59 am

    As it turns out this was as a result of the method server side where I did the transform.

    It did not matter what the XSLT said as the .net method overrode that.

    I ended up with the following code snip in my c# code:

    XmlWriterSettings settings = new XmlWriterSettings();
    settings.OmitXmlDeclaration = true;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 516k
  • Answers 516k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer /usr/include/linux/fs.h: /* File is opened for execution with sys_execve /… May 16, 2026 at 6:51 pm
  • Editorial Team
    Editorial Team added an answer Subclassing is definitively your best shot but subclassing class cluster… May 16, 2026 at 6:51 pm
  • Editorial Team
    Editorial Team added an answer While the theory is that since it's SIlverlight it should… May 16, 2026 at 6:51 pm

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Related Questions

All, I have an XML file which I transform it using an XSLT document
I have to process XML files that have a DTD with a XSLT in
In my C# client application, I use XSLT to transform XML into HTML. I
I use VS 2008, .net 3.5 for generate page html using XSLT. I have
I have the following XML: <assessment> <section> <item> <attributes> <variables> <variable> <variable_name value=MORTIMER/> </variable>
I am writing an application that converts an ajax xml response into html using
Been using XML for ages now for data storage & transfer, but have never
Consider the following XSLT script: <?xml version=1.0 encoding=ISO-8859-1?> <xsl:stylesheet version=1.0 xmlns:xsl=http://www.w3.org/1999/XSL/Transform> <xsl:output method=text encoding=iso-8859-1/>
I have to parse a big HTML file, and Im only interested in a
This XML file contained archived news stories for all of last year. I was

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.