[xsl] XSL Java (&amp;lt; &lt; <) problem

Subject: [xsl] XSL Java (&amp;lt; &lt; <) problem
From: "Robert A. van Ginkel" <robert@xxxxxxxxxxxxx>
Date: Tue, 6 Jan 2004 12:12:32 +0100

Dear Ppl,
 
I am curious about xsl, and like it so far. I use it to make from data an xhtml file with a xsl translation. (so I can change the look/create different looks without changing my serverpages)
Ok so I have _javascript_ in my XHTML that would make it XDHTML i think... But when I have:
(XML)
<?xml version="1.0" encoding="UTF-8"?>
<sg>
  <servervariables>
    <variable name="servertime" type="date" format="YYYYMMDDhhmmss">20031129183059</variable>
  </servervariables>
</sg>
 
(XSL)
<xsl:template match="/">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<script language="_javascript_">
var xmldate = '<xsl:value-of select="/sg/servervariables/variable[@name='servertime']" />';
function xmld(x,l)
{ var r=""; for(i=x;i<(x+l);i++) { if(xmldate[i]!="0" || r!="") {r+=xmldate[i];}
  return r;
}
 
var jdate = new Date();
var sdate = new Date(xmldr(0,4), xmldr(4,2)-1, xmldr(6,2), xmldr(8,2), , xmldr(10,2), , xmldr(12,2));
var plsmn = "";
alert(sdate);
</script>
</head><body>He hallo</body></html>
</xsl:template>
</xsl:stylesheet>
 
(XDHTML)
<?xml version="1.0" encoding="UTF-8"?><html xmlns="http://www.w3.org/1999/xhtml" xmlns:fo="http://www.w3.org/1999/XSL/Format"><head><script language="_javascript_">
var xmldate = '20031129183059';
function xmld(x,4)
{ var r=""; for(i=x;i&lt;(x+l);i++) { if(xmldate[i]!="0" || r!="") {r+=xmldate[i];}
  return r;
}
 
var jdate = new Date();
var sdate = new Date(xmldr(0,4), xmldr(4,2)-1, xmldr(6,2), xmldr(8,2), , xmldr(10,2), , xmldr(12,2));
var plsmn = "";
alert(sdate);
</script></head><body>He hallo</body></html>
[ERROR]
It gives an error cause in _javascript_ i use in the for loop a < sign. ok but if I change it in &lt; the _javascript_ would go wrong.
How can I write clear _javascript_ in XSL without messing up XSL/Java and getting errors?
 

Robert van Ginkel
StyleGate bv
Verspronckweg 63 SG,
2023 BB Haarlem
[ T ] +31 (0) 23 52 51 262
[ F ] +31 (0) 23 54 23 999
[ I ] www.stylegate.com
[ E ] robert@xxxxxxxxxxxxx
Disclaimer
Aan dit bericht kunnen geen rechten worden ontleend. Het bericht is alleen bestemd voor de geadresseerde. Indien dit bericht niet voor u is bestemd, verzoeken wij u dit onmiddellijk aan ons te melden en de inhoud van het bericht te vernietigen.

This message shall not constitute any obligations. This message is intended solely for the addressee. If you have received this message in error, please inform us immediately and delete its contents.

©StyleGate

Current Thread