473,406 Members | 2,356 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,406 software developers and data experts.

Euro Dollar Frustration - XSLT, ASP

I'm having problems displaying the ? euro dollar sign in XML produced
from an XSL transform.

SQL Server 2000 is used to produce XML (SELECT .. FOR XML) from a
database table containing data. The euro dollar displays fine in the
database table and in the SQL Server generated XML(snippet below) but
not in the transformed XML. In fact in this post it will probably
appear as a question mark anyway!

<transporttype>Vehicle types include Suzuki Samurai Jeep, closed
air-con cars, Jimny Jeeps with A/C, and Vitara convertible Jeeps with
A/C. Rates from ?70 to ?85 per day. The above rate includes 3rd party
insurance, unlimited kilometres and delivery to
hotels.</transporttype>

Having done the transform in ASP (below) the output XML file has the
'?' instead of the intended '?'. Having fiddled with encoding types
set in ASP code (see below) I coaxed a '¤' out of it!

ASP scripts are used to request the XML from database (stored
procedure) then transform it using XSLT:

Set objConn = CreateObject("ADODB.Connection")
Set objCMD = CreateObject("ADODB.Command")
set objDOM = CreateObject("Msxml2.FreeThreadedDOMDocument.3.0")
set objDOMOutput = CreateObject("Msxml2.FreeThreadedDOMDocument.3.0")
set objXSL = CreateObject("Msxml2.FreeThreadedDOMDocument.3.0")
objDOM.async = false
objXSL.async = false
.... some setting up db connections and SQL strings for objCMD here
objCMD.Properties("Output Stream") = objDOM
objCMD.Execute , , 1024
Dim objPI
set objPI = objDom.createProcessingInstruction("xml", "version='1.0'
encoding='UTF-8'")
objDom.insertBefore objPI, objDom.childNodes(0)
objXSL.load(arrStyleSheet(i))
objDOM.transformNodeToObject objXSL, objDOMOutput

the transformed xml is then passed to the function:

asCreateFile(lcase(strFilePath), lcase(strFileName),
asDOM2XML(objDOMOutput))

function asCreateFile(path, name, content)
Dim objStream
asCreateFile = false
if asCreatePath(path) then
set objStream = Server.CreateObject("ADODB.Stream")
objStream.Type = 2
objStream.Charset = "iso-8859-1"
objStream.Open
objStream.writetext(content)
objStream.SaveToFile path & name, 2
objStream.Close
Set objStream = nothing
asCreateFile = true
end if
end function

Not entirely sure what asDOM2XML function does but here it is for all
those interested:

function asDOM2XML(objDOM)
'/* used to be: objDOMOutput.firstChild.xml &
replace(objDOMOutput.childNodes(1).xml,chr(13)+chr (10),"<br/>")
if objDOM.childNodes.length > 1 then
asDOM2XML = objDOM.firstChild.xml &
replace(objDOM.lastChild.xml,chr(13)+chr(10),"<br/>")
else
'asDOM2XML = replace(objDOM.firstChild.xml,chr(13)+chr(10),"<br/>")
asDOM2XML = objDOM.xml
end if
end function
Jul 20 '05 #1
2 5192
In article <26**************************@posting.google.com >,
Iain Toft <i.****@uea.ac.uk> wrote:
I'm having problems displaying the ? euro dollar sign in XML produced
from an XSL transform.
I don't know anything about SQL or ASP, but I notice you have
objStream.Charset = "iso-8859-1"


The Euro symbol does not exist in iso-8859-1. Try using iso-8859-15
instead.

-- Richard
--
Spam filter: to mail me from a .com/.net site, put my surname in the headers.

FreeBSD rules!
Jul 20 '05 #2
See http://msdn.microsoft.com/library/en...lencodings.asp

The problem is most likely in the asCreateFile function which is saving the
DOM document to a file via the SaveToFile method on an ADODB.Stream object
specifying the an encoding that cannot handle the Euro character. This is
silly. You can easily save a DOM document to file using the DOM object's
own save method, and it is more likely to encode the document correctly that
way as follows:

objDOMOutput.save(path);

It appears the author of this code was concerned about converting the
newlines in the xml markup to <br/> tags, perhaps in an attempt at having
the XML formatted properly in the browser.

Another way to achieve this is to wrap the XML output in <pre> tags. Or if
you really still need to call asDOM2XML then you could "reload" this string
into the DOM object so you can use the DOM object to save the xml to disk
properly.
"Iain Toft" <i.****@uea.ac.uk> wrote in message
news:26**************************@posting.google.c om...
I'm having problems displaying the ? euro dollar sign in XML produced
from an XSL transform.

SQL Server 2000 is used to produce XML (SELECT .. FOR XML) from a
database table containing data. The euro dollar displays fine in the
database table and in the SQL Server generated XML(snippet below) but
not in the transformed XML. In fact in this post it will probably
appear as a question mark anyway!

<transporttype>Vehicle types include Suzuki Samurai Jeep, closed
air-con cars, Jimny Jeeps with A/C, and Vitara convertible Jeeps with
A/C. Rates from ?70 to ?85 per day. The above rate includes 3rd party
insurance, unlimited kilometres and delivery to
hotels.</transporttype>

Having done the transform in ASP (below) the output XML file has the
'?' instead of the intended '?'. Having fiddled with encoding types
set in ASP code (see below) I coaxed a '¤' out of it!

ASP scripts are used to request the XML from database (stored
procedure) then transform it using XSLT:

Set objConn = CreateObject("ADODB.Connection")
Set objCMD = CreateObject("ADODB.Command")
set objDOM = CreateObject("Msxml2.FreeThreadedDOMDocument.3.0")
set objDOMOutput = CreateObject("Msxml2.FreeThreadedDOMDocument.3.0")
set objXSL = CreateObject("Msxml2.FreeThreadedDOMDocument.3.0")
objDOM.async = false
objXSL.async = false
... some setting up db connections and SQL strings for objCMD here
objCMD.Properties("Output Stream") = objDOM
objCMD.Execute , , 1024
Dim objPI
set objPI = objDom.createProcessingInstruction("xml", "version='1.0'
encoding='UTF-8'")
objDom.insertBefore objPI, objDom.childNodes(0)
objXSL.load(arrStyleSheet(i))
objDOM.transformNodeToObject objXSL, objDOMOutput

the transformed xml is then passed to the function:

asCreateFile(lcase(strFilePath), lcase(strFileName),
asDOM2XML(objDOMOutput))

function asCreateFile(path, name, content)
Dim objStream
asCreateFile = false
if asCreatePath(path) then
set objStream = Server.CreateObject("ADODB.Stream")
objStream.Type = 2
objStream.Charset = "iso-8859-1"
objStream.Open
objStream.writetext(content)
objStream.SaveToFile path & name, 2
objStream.Close
Set objStream = nothing
asCreateFile = true
end if
end function

Not entirely sure what asDOM2XML function does but here it is for all
those interested:

function asDOM2XML(objDOM)
'/* used to be: objDOMOutput.firstChild.xml &
replace(objDOMOutput.childNodes(1).xml,chr(13)+chr (10),"<br/>")
if objDOM.childNodes.length > 1 then
asDOM2XML = objDOM.firstChild.xml &
replace(objDOM.lastChild.xml,chr(13)+chr(10),"<br/>")
else
'asDOM2XML = replace(objDOM.firstChild.xml,chr(13)+chr(10),"<br/>")
asDOM2XML = objDOM.xml
end if
end function

Jul 20 '05 #3

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

Similar topics

4
by: Robert Zierhofer | last post by:
hi there, it seems as if i can´t convert the euro and pound sign to their html equivalents. i tried eregi_replace("€", "&euro;", $haystack); eregi_replace("£", "&pound;", $haystack); as...
11
by: MH | last post by:
Thai may have been asked before but I'm new here.... How can I put the Euro symbol, ? using alt0128 in my page and get it validated as HTML 4.01 ? -------------- MH
18
by: gabriel | last post by:
greetings, I am currently working on a website where I need to print the Euro symbol and some "oe" like in "oeuvre". If I choose this : <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0...
5
by: SalamElias | last post by:
I followed instructions in MSDN help articles and wrotethe folowing code in order to display numeric numbers with Euro symbol as follows : ---------------------------- Dim OutString As = "" Dim...
8
by: Max | last post by:
My client has decided to use the Euro for the entire web site. Is there an easy way to get my ASP.NET app to format currency to Euro instead of US-dollar? Right now it's just reading the server...
1
by: news.wanadoo.nl | last post by:
Hi, Is there a sollution for a DataFormatString as currency that shows always the euro sign: ? <asp:BoundColumn DataField="UnitCost" HeaderText="Prijs"...
7
by: kingski | last post by:
Any idea about this ? http://www.developerfusion.co.uk/forums/thread/114379/#114379 "Can any one help me as i am building a shopping cart and it supports multiple currencies but while sending...
0
by: kingski | last post by:
Any idea about this? http://www.developerfusion.co.uk/forums/thread/114379/#114379 "Can any one help me as i am building a shopping cart and it supports multiple currencies but while sending...
7
by: Robertu | last post by:
Hi at all I'ld want inserrt into my emails body the ? euro symbol therefore I wrote the header of my emails like : $headers="From: $mail_from\n\r"; $headers.='X-Mailer: PHP/' ....
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
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: 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
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
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
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...

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.