|
-
Jun 6th, 2001, 01:47 PM
#1
Thread Starter
Junior Member
XML Entities
I have an XML document that references an external dtd. In the dtd I have a list of entities, for some foreign characters. One such entity is <!ENTITY aacute "&#.225;"> (the "." is intentionally put in there otherwise when I post, the á would appear rather than the code) - it works fine except I there is one problem.
I also have an xsl stylesheet that I use to transform the xml document into an html document... the example code I might use to transform the document:
Code:
Dim xmlDoc As DOMDocument, xslDoc as DOMDocument
xmlDoc.async=false
xslDoc.async=false
xmlDoc.load app.path & "\doc.xml"
xslDoc.load app.path & "\doc.xsl"
Text1.Text = xmlDoc.transformNode(xslDoc)
Everything transforms properly, and then I display the output html document in the webbrowser. Everything displays correctly except the "á" which shows up as a little box - to make an already long story a bit shorter, the transformNode creates a META tag in the html document setting the charset=UTF-16. The letter "á" is not in that charset, but the transform node resolves the &#.225; entity to the "á" rather than just passing the &#.225; to the html document.
I found that I could remedy the problem by parsing the file and removing the charset declaration, but I would rather transform the document putting &#.225; in the html document rather than the actual letter "á" so that the UTF-16 charset can remain in place.
Any suggestions? Thanks in advance!
Last edited by Cougar0119; Jun 6th, 2001 at 02:24 PM.
-
Jun 6th, 2001, 02:08 PM
#2
Did you intentioanlly leave out the ; in your Entity you showed? Is that how it is in your code. Chcek on that..
-
Jun 6th, 2001, 02:23 PM
#3
Thread Starter
Junior Member
oops - it's there
I didn't copy and paste it, I just typed it and forgot it... it is in the dtd though... <!ENTITY aacute "&#.225;">
-
Jun 6th, 2001, 02:32 PM
#4
What character set is it in? UTF-8?
-
Jun 6th, 2001, 02:43 PM
#5
Thread Starter
Junior Member
nope...
it's in iso-8859-1 - the Western European character set...
-
Jun 6th, 2001, 02:47 PM
#6
A guess, buttry adding this to your xsl file right below xsl:stylesheet
Code:
<xsl:output method="xml" version="1.0" encoding="ISO-8859-1" omit-xml-declaration="no" indent="no" media-type="text/html"/>
Dont know if it will do any good, but try it out
Last edited by Cander; Jun 6th, 2001 at 02:51 PM.
-
Jun 6th, 2001, 02:52 PM
#7
oof ...that should be a : o without the space instead of
-
Jun 6th, 2001, 03:10 PM
#8
Thread Starter
Junior Member
well...
I modified your xsl output statement just a bit, and it pretty much works... I say "pretty much" because it displayed correctly but the output to the html file still isn't what I'd like... it may be something I just have to deal with... you solved the problem, but not the way I would have liked to see it fixed. 
Maybe if I rephrase my initial question... is there anyway to pass my entity value, "&#.225;" as a literal string rather than have transformNode change it to the "á"? I want transformNode to pass "&#.225" instead...
My reason is this - I don't know if all browsers/platforms/whatever supports the iso-8859-1 character set... UTF-16 - everything supports that charset... maybe this is just something that I'm just gonna have to deal with... I don't know - any other suggestions?
Thanks for the help!
-
Jun 6th, 2001, 03:53 PM
#9
CAnt really think of anything else. But If I can figure anything out Ill let you know.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|