RE: [xsl] MS XML Parser

Subject: RE: [xsl] MS XML Parser
From: "Ruane, Conleth" <Conleth.Ruane@xxxxxxxxxx>
Date: Fri, 16 Nov 2001 11:03:06 +0100
I'm not looking for a *special* CR I want to output the escaped
characters that represent the CR. SAXON does it and XML-Spy does it (and
that actually uses MS XML Parser).

Here's the simplest example I could put together to demonstrate

xml (just an empty node):
----
<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="C:\simple.xsl"?>
<dummy/>
----

xsl:
-----
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
xmlns:fo="http://www.w3.org/1999/XSL/Format";>
<xsl:template match="/">
<someTag><xsl:text
disable-output-escaping="yes">XXXX&amp;#x0D;&amp;#x0A;YYYY</xsl:text></s
omeTag>
</xsl:template>
</xsl:stylesheet>
-----

Processing this with SAXON,  XML-Spy or even opening it in the browser
shows:

XXXX&#x0D;&#x0A;YYYY 


but send the XML to this ASP page :

----
<%
		
	' load the xml message sent
	set doc = Server.CreateObject("Msxml2.DOMDocument.3.0")
	doc.async=false
	doc.resolveExternals = false
	doc.validateOnParse = false
	doc.load Request
	
	' check for errors
	if doc.parseError <> 0 then 
		Response.Write "Error parsing initial XML message: " &
doc.parseError
		Response.End		
	end if

	' XSL Transformation
	'Load the XSL
	set xsl = Server.CreateObject("Msxml2.DOMDocument.3.0")
	xsl.async = false
	xsl.load Server.MapPath("simple.xsl")

	' check for errors
	if xsl.parseError <> 0 then 
		Response.Write "Error loading XSL script(" _
			& xslScript & ")" & xsl.parseError
		Response.End
	end if

	'Transform
	set sblDoc = Server.CreateObject("Msxml2.DOMDocument.3.0")
	sblDoc.async = false
	sblDoc.validateOnParse = true
	sblDoc.preserveWhiteSpace = true
	Doc.preserveWhiteSpace = true

	doc.transformNodeToObject xsl, sblDoc 

	' check for errors
	if sblDoc.parseError <> 0 then 
		Response.Write "Failed to transform XML message"
		Response.End		
	end if

	Response.Write "XML: " & sblDoc.xml
	Response.End		
	
	
sub OnTransactionAbort()
response.write("ABORTED...")
response.end()
end sub

sub OnTransactionCommit()
response.write("SUCCESS...")
response.end()
end sub
	
%>

----
returns:
----
Siebel XML: <?xml version="1.0" encoding="UTF-16"?>
<someTag xmlns:fo="http://www.w3.org/1999/XSL/Format";>XXXX
YYYY</someTag>
----

The ASP page is on a W2K server.

Thanks
Conleth Ruane
> COMPAQ  EMEA HQ IM, Munich
Telephone: +49-89-9392-4393
mailto:Conleth.Ruane@xxxxxxxxxx


-----Original Message-----
From: Julian Reschke [mailto:julian.reschke@xxxxxx]
Sent: Friday, November 16, 2001 9:47 AM
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Subject: RE: [xsl] MS XML Parser


You can't have a *special* type of CR in XML output -- it's normalized
in
XML. If you need a special encoding, you'll have to post-process the
output.

> -----Original Message-----
> From: owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> [mailto:owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx]On Behalf Of Ruane,
> Conleth
> Sent: Friday, November 16, 2001 8:59 AM
> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Subject: [xsl] MS XML Parser
>
>
> I'm having a problem that I think has to do with the MS XML Parser.
>
> the XSL snippet:
>
> <someTag><xsl:text
>
disable-output-escaping="yes">XXXX&amp;#x0D;&amp;#x0A;YYYY</xsl:text></s
> omeTag>
>
> outputs
>
> <someTag>XXXX&#x0D;&#x0A;YYYY</someTag>
>
> when processed by Saxon, which is what I want,
> but the following VB code in an asp page produces just
>
> <someTag>XXXX
> YYYY</someTag>
>
> The line is a Unix linefeed (just 1 character) instead of DOS linefeed
> which is what I want.
>
>
>
> *******************************
> 	' load the xml message sent
> 	set doc = Server.CreateObject("Msxml2.DOMDocument.3.0")
> 	doc.async=false
> 	doc.resolveExternals = false
> 	doc.validateOnParse = false
> 	doc.load Request
>
> 	' check for errors
> 	if doc.parseError <> 0 then
> 		writeFail "Error parsing initial XML message: " &
> doc.parseError
> 		cleanUpAsp
> 		Response.End
> 	end if
>
> 	' XSL Transformation
> 	'Load the XSL
> 	set xsl = Server.CreateObject("Msxml2.DOMDocument.3.0")
> 	xsl.async = false
> 	xsl.load Server.MapPath("xslScript")
>
> 	'Transform
> 	set sblDoc = Server.CreateObject("Msxml2.DOMDocument.3.0")
> 	sblDoc.async = false
> 	sblDoc.validateOnParse = true
> 	sblDoc.preserveWhiteSpace = true
> 	Doc.preserveWhiteSpace = true
>
> 	doc.transformNodeToObject xsl, sblDoc
>
> ********************************************
> sblDoc.xml   then contains
>
> <someTag>XXXX
> YYYY</someTag>
>
> It seems that DOMDocument is interpreting the escaped chars again
before
> outputing the XML
>
> Any ideas how I can force the required output.
>
> Conleth Ruane
> > COMPAQ  EMEA HQ IM, Munich
> Telephone: +49-89-9392-4393
> mailto:Conleth.Ruane@xxxxxxxxxx
>
>
>
>  XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
>


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread