473,385 Members | 1,409 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,385 software developers and data experts.

XSLT problem with 'disable-output-espacing' parameter

Hey,

I'm doing a series of XSL Transformations from a C#.NET Console app.

I've designed a .xsl file (to output to "text" not "xml") to generate a text
file with entries that look like:

"<OD:FO:"yes.gif",Picture,"C:\images\yes.gif"> "

I designed the .xsl file in Marrowsofts Xselerator application and when I
run the stylesheet over the .xml file in this application I do infact get the
output entries I want (as shown above). However when I run the XSL
Transformations from my Console application my output becomes, the escaped
version:

"<OD:FO:"yes.gif",Picture,"C:\images\yes.gif"> "

I'm doing the transformation in the Console application using the following
code:

--Start Fragment--

XslTransform transformer = new XslTransform();

XmlUrlResolver resolver = new XmlUrlResolver();
resolver.Credentials = System.Net.CredentialCache.DefaultCredentials;

// Load the .xsl file
transformer.Load(transformationFilePath, resolver);

// Load the target of the transformation
XPathDocument document = new XPathDocument(inFilePath);

// Create a stream to the output file
StreamWriter writer = new StreamWriter(outFilePath);

XmlTextWriter xmlWriter = new XmlTextWriter(writer);

// Perform the transformation and write out the results
transformer.Transform(document, parameters, xmlWriter, resolver);

--End Fragment--

Does anyone have any suggestions as to why my output is coming out as
escaped sequences when I'm specifying that I don't want them to be escaped!

Thank you,

Sam.
Jul 21 '05 #1
1 1481
Shortly after posting this I discovered the reason why this was occuring,
although I am unsure as to whether this is documented anywhere.

The reason why this was occuring is because I was passing an XmlWriter
object to the XslTransform.Transform() function as the object to use to write
out the result of the transformation.

I have edited the code fragment below to illustrate the simple change that I
made.
--Start Fragment--

XslTransform transformer = new XslTransform();

XmlUrlResolver resolver = new XmlUrlResolver();
resolver.Credentials = System.Net.CredentialCache.DefaultCredentials;

// Load the .xsl file
transformer.Load(transformationFilePath, resolver);

// Load the target of the transformation
XPathDocument document = new XPathDocument(inFilePath);

// Create a stream to the output file
StreamWriter writer = new StreamWriter(outFilePath);
// I removed this line
// XmlTextWriter xmlWriter = new XmlTextWriter(writer);

// Then I edited this line to use the straight StreamWriter object instead
transformer.Transform(document, parameters, writer, resolver); // Perform the transformation and write out the results // transformer.Transform(document, parameters, xmlWriter, resolver);
--End Fragment--

Jul 21 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: ted | last post by:
Was wondering if XSLT alone is appropriate for the following situation. From XML, I'm creating a small website (around 50 pages) with pages that link to each other through a nav menu and a...
2
by: Tom Corcoran | last post by:
I am working to ease updating of a html page by transforming 2 xml files. I was going to use xslt for this and had bought 2 unopened books, wrox xslt and o'reilly's xslt cookbook. But am now...
1
by: Mohit | last post by:
Hi Friends I have to call 1 of the 2 child XSLT files from the Main XSLT file based on some criteria. I want one child XSLT file will be executed by version 1 of XSLT processor and the other by...
4
by: Ringo Langly | last post by:
Hi all, I'm a seasoned web programmer, but I've never touched XSLT. It's always been one of those acronyms I've never needed to educate myself on. Now... we're working with a web content...
3
by: Jack Fox | last post by:
I've never had the need to work with XML, but I believe I now have an appropriate application. I have time-series data in objects organized as a tree that I want an ASP.NET program to write out to...
1
by: jwalton | last post by:
Sorry if slightly off-topic, but I have asked / researched many other places already, maybe someone here can help? MSIE has a useful (for users applications) feature of performing XSLT...
3
by: Ian Roddis | last post by:
Hello, I want to embed SQL type queries within an XML data record. The XML looks something like this: <DISPLAYPAGE> <FIELD NAME="SERVER" TYPE="DROPDOWN"> <OPTION>1<OPTION> <OPTION>2<OPTION>...
1
by: Sergey Dubinets | last post by:
In effort to prioritize our goals we composed the list of random features each of them may add value to set of XSLT tools offered from Microsoft. 1. XSLTc (Compiler for XSLT...
12
by: Chris | last post by:
Hi, Just wondering if anyone out there knows if it is possible to convert a CSV to xml using XSLT? I've seen a lot of examples of xml to CSV, but is it possible to go back the other way? I...
2
by: Ronald Raygun | last post by:
I am running a build process (using propel) which requires XSLT for some transformations. I get the following error: "Could not perform XLST transformation. Make sure PHP has been...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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...

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.