473,396 Members | 1,966 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

c# .net xslTransform using XsltArgumentList

15
Hi all,
Help needed in the xsl transformation in c# while passing with arguments.
I am trying to transform an xml programtically (c#), while passing with two parameters using the
XsltArgumentList class.
My problem is in the transformed xml.
Even when I set in my XmlWriter the Encoding to UTF-8, or even when I set it null,
my output transformed xml is without the xml header encoding attribute:<?xml version="1.0" encoding="utf-8"?>
Wether I set the encoding to utf-8 or null, it does not have any effect on my output file.

My bits of code doing the transformation is:

XslTransform myTran = new XslTransform();
myTran.Load(xsl);

XsltArgumentList args = new XsltArgumentList();
args.AddParam("param1", "", param1);
args.AddParam("param2", "", param2);

XPathDocument xpathdocument = new XPathDocument(iFile);
XmlTextWriter xmlWriter = new XmlTextWriter(oFile, Encoding.UTF8);
// XmlTextWriter xmlWriter = new XmlTextWriter(oFile, null);
myTran.Transform(xpathdocument, args, xmlWriter);
xmlWriter.Close();

Please help me clear my mind on this!
Thanks in advance.
Jun 30 '08 #1
0 1791

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Graham Pengelly | last post by:
Hi I am trying to transform on System.Xml.XmlDocument into another using XslTransform without writing the object out to a file. I am guessing it should work something like this... public...
6
by: BLechmann | last post by:
Hello *, I'm trying to transform my DocBook document with the FO stylesheet from the DocBook XSL distribution (the transformation with the XHTML stylesheet works). I changed "$years + 1" to...
3
by: Steve | last post by:
Is there any way of specifying the startMode when using the xslTransform class? We are updating code which used msxml to the system.xml classes but can find no way to specify the startMode. We...
1
by: Yuriy | last post by:
Hi, Can anybody explain the following? Say I have the following source XML and XSLT (see below). No matter what this XSLT does. It is just a sample to show a problem. the idea is that XSLT...
1
by: fawzib.rojas | last post by:
I have the following class and function: class MathExtension{ public double max(double a,double b){ Console.WriteLine("math:max("+a.ToString()+","+b.ToString()+")"); return Math.Max(a,b); } }...
2
by: KJS | last post by:
Hello, I'm receiving: 'System.Xml.Xsl.XsltException: Missing mandatory attribute 'version' After I try and run my transformation. I spent a good few days coming up with the appropriate (I think)...
4
by: Sean Hoffman | last post by:
Framework 1.1 SP1. Page.xml is about 1.5mg. m_oXSLTransform.Transform takes about 2 minutes. When Page.xml is trimmed down to a smaller doc, it takes about 2 seconds. Same code ran in about...
1
by: rmgalante | last post by:
Hello, I have a VB.Net component that uses the XslTransform object. I am using the FXSL randomizeList function in my XSL template. When I transform the XML in the VB.Net component, my...
9
by: WT | last post by:
Hello, I have code created with .net 1.0 and migrated to 3.5. Form 2.0 the XslTransform class is obsolete and the vs2008 compiler generates warnings that these classes are absolete suggesting to...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.