473,396 Members | 1,772 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.

Different behaviours for xmlTransform

Using the same xml and xsl files, the result of the xmlTransform.Transform
is different depending if a xmlTextwriter or a StringWriter is used. In the
first case, the output file is as expected, but in the second case, a new
<metatag is added, and the existing ones loose the /closing tag; that
means xmDocument.LoadXml(Stringbuilder.ToString) fails.

The code is:

#If 1 Then 'Good

objXMLWriter = New Xml.XmlTextWriter(sPathDoc, Nothing)

objTransform.Transform(objXPathDocument, Nothing, objXMLWriter, Nothing)

objXMLWriter.Close()

Docum.Load(sPathDoc)

#Else 'Fails

sb = New Text.StringBuilder

objXMLStream = New System.IO.StringWriter(sb)

objTransform.Transform(objXPathDocument, Nothing, objXMLStream, Nothing)

objXMLStream.Close()

Docum.LoadXml(sb.ToString)

#End If

Alfons Puig
Dec 27 '06 #1
1 1407
Alfons Puig wrote:
Using the same xml and xsl files, the result of the xmlTransform.Transform
is different depending if a xmlTextwriter or a StringWriter is used. In the
first case, the output file is as expected, but in the second case, a new
<metatag is added, and the existing ones loose the /closing tag; that
means xmDocument.LoadXml(Stringbuilder.ToString) fails.
If you want XML output then make sure you have
<xsl:output method="xml"/>
in the stylesheet. If you have <xsl:output method="html"/in the
stylesheet then the processor will add a meta element as per
specification. And with the html output method known empty elements like
the meta element are serialized according to HTML rules so what you see
is probably simply the result of xsl:output method="html".

If you still have problems then post a minimal XML input and minimal
XSLT stylesheet where the problem occurs.

--

Martin Honnen --- MVP XML
http://JavaScript.FAQTs.com/
Dec 29 '06 #2

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

Similar topics

137
by: Philippe C. Martin | last post by:
I apologize in advance for launching this post but I might get enlightment somehow (PS: I am _very_ agnostic ;-). - 1) I do not consider my intelligence/education above average - 2) I am very...
3
by: S | last post by:
I have a database and an application in .net using it. In that database I have a stored procedure where is an import mechaism using ODBC driver and a .csv file. On my machine everything works...
4
by: Dave | last post by:
Hi, I tried something with 'return value' of a function and i got two different behaviours. My question is: why does method 1 not work? Thanks Dave method 1: here, whatever i choose (ok or...
3
by: b0yce | last post by:
Hi Group, I think I have found a problem with the <xsl:element> when being transformed by the .NET xmlTransform class. When using XmlSpy for development and debugging, the <xsl:number>...
1
by: Vidar | last post by:
I have a problem in dotNET XSL convertion object. (XMLTRANSFORM) It won't convert UTF-8 to ISO-8859-1 I use this stylesheet for konvertion: <?xml version="1.0" encoding="ISO-8859-1"?> <!--...
1
by: Hoots | last post by:
I'm trying to transform an xml file that contains empty short elements like the following: <element attrib="abc"/> using the XmlTransform class. But I cannot seem to preserve the short format...
5
by: nospam | last post by:
I'm trying to transform an xml file that contains empty short elements like the following: <element attrib="abc"/> using the XmlTransform class. But I cannot seem to preserve the short format...
1
by: Lars Behrmann | last post by:
Hi, i have an ActiveX control placed on my windowsform. Visual Studio has wrapped this and everything should be fine, but it isn't :( The control shows different behaviours between the Visual...
2
by: Bart | last post by:
Hi, I ran the same code with two different providers (oledb abd sqlclient), and i got two different behaviours. The code with OLEDB runs perfect without error. The same code with SQLClient...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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?
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

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.