Topic: Embedding JavaScript into XSL Pages that link to <a href="https://ozoneasylum.com/backlink?for=11152" title="Pages that link to Topic: Embedding JavaScript into XSL" rel="nofollow" >Topic: Embedding JavaScript into XSL\

 
Author Thread
Karl
Bipolar (III) Inmate

From: Phoenix
Insane since: Jul 2001

IP logged posted posted 02-19-2004 08:15 Edit Quote

Is there anyone in the asylum familiar with howto embed complex javascript functions into XSL? I can do a simple alert('foo'); from xsl... but beyond that, not having much luck.
Ultimately, I need to load an client side activex XML object with some XSL generate XML. (was that confusing?)

This is pretty complicated stuff! Things are getting parsed at different times, and text being inetrpetid and different levels different way... wow very tough.

Karl

poi
Paranoid (IV) Inmate

From: France
Insane since: Jun 2002

IP logged posted posted 02-19-2004 09:29 Edit Quote

Karl: You can do it that way :

code:
<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="html" encoding="ISO-8859-1"/>

<!-- some XLST commands -->

<script type="text/javascript">
<![CDATA[

// your javasript code here

]]>
</script>

<!-- the rest of the XLST soup -->

</xsl:stylesheet>



Hope that helps,
[edit] disabling Slimies [/edit]



[This message has been edited by poi (edited 02-19-2004).]

Karl
Bipolar (III) Inmate

From: Phoenix
Insane since: Jul 2001

IP logged posted posted 02-19-2004 16:02 Edit Quote

Okay, now lets add a layer of complexity!
You see, I am instantiating an XML ActiveX element on the client side. My intention is to load the XML object with: loadXML
The XML string I am attempting to load has a CDATA section. So now we have a CDATA section within a CDATA section (we wrapped the jscript's script in a CDATA section) and even though they are of 2 completely seperate instances (in time of parsing) it seems to confuse the XSL parser.
Here is the code that I would attempt to insert within the example you have provided that I am having no luck with:

dom.loadXML('<TEST><T att="1"/><T att="2"><![CDATA[This is a snippet of <b>marked up</b><i>HTML</i>]]></T></TEST>');

Any ideas on handling this? The error produced is:
End tag 'T' does not match the start tag 'script'.

Thanks, Karl


poi
Paranoid (IV) Inmate

From: France
Insane since: Jun 2002

IP logged posted posted 02-19-2004 16:35 Edit Quote

Oh, you're loading an XML string directly ( I didn't even knew that was possible ). So it should be a simple problem of parsing reserved words/symbols. Try to split your XML string in strategic areas like.

dom.loadXML( '<TEST><T att="1"/><T att="2"><!' + '[CD'+ 'ATA[This is a snippet of <b>marked up</b><i>HTML</i>]' + ']' + '></T></TEST>');

Well you see what I mean

Karl
Bipolar (III) Inmate

From: Phoenix
Insane since: Jul 2001

IP logged posted posted 02-19-2004 18:34 Edit Quote

Good suggestion... i will try that for sure.



Post Reply
 
Your User Name:
Your Password:
Login Options:
 
Your Text:
Loading...
Options:


« BackwardsOnwards »

Show Forum Drop Down Menu