Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > XML > DOCTYPE in XSL-stylesheet while using XMLDOM with JScript

Reply
Thread Tools

DOCTYPE in XSL-stylesheet while using XMLDOM with JScript

 
 
xq386@hotmail.com
Guest
Posts: n/a
 
      03-12-2007
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" xmlnssl="http://www.w3.org/1999/XSL/
Transform">
<xslutput 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) );
}

 
Reply With Quote
 
 
 
 
Martin Honnen
Guest
Posts: n/a
 
      03-12-2007
http://www.velocityreviews.com/forums/(E-Mail Removed) 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/
 
Reply With Quote
 
 
 
 
xq386@hotmail.com
Guest
Posts: n/a
 
      03-13-2007
On 12 mrt, 15:56, Martin Honnen <(E-Mail Removed)> wrote:
> 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!

 
Reply With Quote
 
Martin Honnen
Guest
Posts: n/a
 
      03-13-2007
(E-Mail Removed) 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/
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
CSS Newbie - CSS Works With Invalid DOCTYPE. Fails With Valid DOCTYPE. Larry Lindstrom HTML 19 06-12-2012 02:07 PM
What is Server-Side Jscript (not Jscript.NET)? Maxwell2006 ASP .Net 5 03-07-2006 05:28 AM
Sorting XML using XMLDOM without using XSL Ben Fidge ASP General 0 12-09-2005 10:41 AM
Porting from JScript to JScript.Net - compiler error Jon Maz ASP .Net 4 09-09-2004 10:24 AM



Advertisments