[XSL-LIST Mailing List Archive Home]
[By Thread]
[By Date]
If you want to the XSLT processor to execute some javascript, then it shud be through Extension Element.
With what you have asked , it looks to me that you want to just have some javascript included in the HTML file that your xsl generates.
for this just include your javascript code in the XSL..
example
<?xml version="1.0"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<script>
alert('hello');
</script>
</xsl:template>
</xsl:stylesheet>
The above will get an alert box with a hello message
If you want to use some looping logic into the javascript body , then you may force yourself to write your code like below..
<xsl:template match="/">
<script>
for(var i = 0;i<3;i++)
{
alert('hello');
}
</script>
</xsl:template>
This however is not correct because you are not allowed to use the reserved character '<' ( in i<3 )
In which case your xsl should be as below..
<xsl:template match="/">
<script>
<xsl:text disable-output-escaping="yes">
<![CDATA[
for(var i = 0; i<3;i++){
alert('hello');
}]]>
</xsl:text>
</script>
</xsl:template>
--OR--
_________________________________________________________________
MSN Photos is the easiest way to share and print your photos: http://photos.msn.com/support/worldwide.aspx
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Re: [xsl] How I can include javscript code ?
Subject: Re: [xsl] How I can include javscript code ? From: "Vasu Chakkera" <vasucv@xxxxxxxxxxx> Date: Tue, 09 Jul 2002 19:24:21 +0000 |
Hi I nedd to include some javascript in my XSLT.Its not clear as to what you actually want to do..
If you want to the XSLT processor to execute some javascript, then it shud be through Extension Element.
With what you have asked , it looks to me that you want to just have some javascript included in the HTML file that your xsl generates.
for this just include your javascript code in the XSL..
example
<?xml version="1.0"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<script>
alert('hello');
</script>
</xsl:template>
</xsl:stylesheet>
The above will get an alert box with a hello message
If you want to use some looping logic into the javascript body , then you may force yourself to write your code like below..
<xsl:template match="/">
<script>
for(var i = 0;i<3;i++)
{
alert('hello');
}
</script>
</xsl:template>
This however is not correct because you are not allowed to use the reserved character '<' ( in i<3 )
In which case your xsl should be as below..
<xsl:template match="/">
<script>
<xsl:text disable-output-escaping="yes">
<![CDATA[
for(var i = 0; i<3;i++){
alert('hello');
}]]>
</xsl:text>
</script>
</xsl:template>
--OR--
<xsl:template match="/"> <script> <xsl:text disable-output-escaping="yes">
for(var i = 0; i<3;i++){ alert('hello'); } </xsl:text> </script> </xsl:template>
cheers Vasu
From: Patrick <patricks@xxxxxxxxxxx> Reply-To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx To: XSL-List@xxxxxxxxxxxxxxxxxxxxxx Subject: [xsl] How I can include javscript code ? Date: Tue, 09 Jul 2002 19:24:19 +0200
Hi I nedd to include some javascript in my XSLT. How i can do that ? Thanks PAtrick
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
_________________________________________________________________
MSN Photos is the easiest way to share and print your photos: http://photos.msn.com/support/worldwide.aspx
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] How I can include javscri, Charles Knell | Thread | RE: [xsl] How I can include javscri, Julian Reschke |
[xsl] Sorting Nested Loops, Tyler Queen | Date | [xsl] Reverse lookup table, Dunning, John |
Month |