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

DOCTYPE in XSL-stylesheet while using XMLDOM with JScript

Question: In the XSL file below I put a part of the code
(concerning the euro-sign) in comment. If I remove the
comment then it doesn't work anymore. How can this be solved?

I run Test.html with Internet Explorer on Window-XP.
Below I give all the files I'm using.

Look at following code:

File: Test.html

<html>
<head>
<script language="javascript" src="z_transform.js"></script>
</head>
<body>
<script language="javascript">
myXml = "test.xml";
myXsl = "test.xsl";
transformXsl();
</script>
</body>
</html>
File: Test.xml

<?xml version="1.0" encoding="ISO-8859-1"?>
<test amount="20.4">
</test>
File: Test.xsl

<?xml version="1.0"?>
<!--
<!DOCTYPE xsl:stylesheet
[
<!ENTITY euro "&#x20AC;">
]>
-->
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/
Transform">
<xsl:output method="html"/>
<xsl:template match="/">
Amount = <xsl:value-of select="/test/@amount"/>
<!-- &euro; -->
</xsl:template>
</xsl:stylesheet>
File: z_transform.js

function transformXsl()
{
var rSourceDoc,rStyleDoc;

rSourceDoc = new ActiveXObject("microsoft.xmldom");
rSourceDoc.async="false";
rSourceDoc.load(myXml);

rStyleDoc = new ActiveXObject("microsoft.xmldom");
rStyleDoc.async="false";
rStyleDoc.load(myXsl);

document.write(rSourceDoc.transformNode(rStyleDoc) );
}

Mar 12 '07 #1
3 3587
xq***@hotmail.com wrote:
function transformXsl()
{
var rSourceDoc,rStyleDoc;

rSourceDoc = new ActiveXObject("microsoft.xmldom");
rSourceDoc.async="false";
rSourceDoc.async = false;
rSourceDoc.load(myXml);

rStyleDoc = new ActiveXObject("microsoft.xmldom");
rStyleDoc.async="false";
rStyleDoc.async = false;
As your XSL contains an incomplete DTD you need to set
rStyleDoc.validateOnParse = false;
to sucessfully load and transform.
rStyleDoc.load(myXsl);

document.write(rSourceDoc.transformNode(rStyleDoc) );
}
Note that XML and XSLT as an XML application fully support Unicode so
there is no need to define entities like euro, you can just use the
character itself "€" like I do in this post.

--

Martin Honnen
http://JavaScript.FAQTs.com/
Mar 12 '07 #2
On 12 mrt, 15:56, Martin Honnen <mahotr...@yahoo.dewrote:
Note that XML and XSLT as an XML application fully support Unicode so
there is no need to define entities like euro, you can just use the
character itself "€" like I do in this post.

Â* Â* Â* Â* Martin Honnen
Â* Â* Â* Â*http://JavaScript.FAQTs.com/
The problem is not the €, but how to use ENTITIES in this situation!

Mar 13 '07 #3
xq***@hotmail.com wrote:
The problem is not the €, but how to use ENTITIES in this situation!
As I said, if you set
rStyleDoc.async = false;
rStyleDoc.validateOnParse = false;
then you can load your stylesheet with the entity declarations.

--

Martin Honnen
http://JavaScript.FAQTs.com/
Mar 13 '07 #4

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

Similar topics

0
by: Rutger Claes | last post by:
In the directory /var/www/dynamo/xsl is the basic xsl file for xhtml documents /var/www/dynamo/xsl/xhtml.xsl. In this file there is an import statement: <xsl:import href="xhtml/basic.xhtml.xsl"...
1
by: Xeon | last post by:
Hi, I'm trying this code snippet below but the parser (sablotron) returns error : <xsl:choose> <xsl:when test="some test case"> <xsl:variable name="test" select="0"/> </xsl:when>...
0
by: Mikael Petterson | last post by:
Hi, I am trying to produce the following in javacode; public void action<An actionName>(String value1, int value 2....,Coordinator c) throws Exception; The arguments to the actionXXX could...
3
by: johkar | last post by:
What is the proper doctype syntax for XHTML transitional??? Strict? How come XSLT doesn't preserve XHTML when it is compiled (Xalan)? Meaning, <br /> tags become <br> <input /> tags become...
5
by: Axial | last post by:
Question: How to select columns from Excel-generated XML when some cells are empty. I've found examples where rows are to be selected, but I can't seem to extrapolate from that to selecting...
0
by: james | last post by:
Hi there! I'm trying to convert an HTML file to CSS and I have problems reading the CSS attributes. For example: for table attribute: <xsl:attribute-set name="table.data"> <xsl:attribute...
13
by: Tjerk Wolterink | last post by:
Hello i've an xsl stylesheet that must support xhtml entities, my solution: ---- <?xml version="1.0" encoding="ISO-8859-1"?> <!DOCTYPE xsl:stylesheet > <xsl:stylesheet version="1.0"...
3
by: danmc91 | last post by:
Hello, I'm new to xml and xslt but that should be obvious from my question. I'm trying to help my wife set up some web pages with some of her art work and what I'm trying to do is find a way...
1
by: howa | last post by:
e.g. <xsl:template match="/"> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http:// www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html...
2
by: jluo | last post by:
Hi all, Need some help here. I'm using these in a xsl: ~~~~~~~~~~~~~~~ <?xml version="1.0" encoding="ISO-8859-1"?> <xsl:stylesheet version="1.0"...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
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...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
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
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

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.