M
mali djuro
Hi, all.
i try to use xsl to show xml in IE6+ and NN7+
i got:
index.htm
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html;
charset=iso-8859-1">
<link rel="stylesheet" href="./css/style.css">
<script language="JavaScript">
function init(){
//here is checking of browser -> type is IE or
NN
var docXML = initXML(type);
var docXSL = initXML(type);
if (type == "NN"){
var count = 0;
docXML.onload = transform;
docXML.load(test.xml);
docXSL.onload = transform;
docXSL.load(test.xsl);
}
else if (type == "IE"){
docXML.async = false;
docXML.load(test.xml);
docXSL.async = false;
docXSL.load(test.xsl);
document.write(docXML.transformNode(docXSL));
}
function transform(){
count++;
if (count == 2){
var xsltProcessor = new XSLTProcessor();
var outdoc = initXML(type);
xsltProcessor.transformDocument(docXML,
docXSL, outdoc, null);
document.write(outdoc.documentElement.innerHTML);
}
}
}
</script>
</head>
<body bgcolor="#EFEFEF">
<script language="JavaScript"> init(); </script>
</body>
</html>
test.xsl:
<?xml version="1.0" encoding="ISO-8859-2"?>
<xsl:transform xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
<xsl:template match="root">
<html>
<head />
<body bgcolor="#EFEFEF">
<table bordercolor="#ffffff" cellspacing="0" width="98%"
bordercolorlight="#6b5c35" border="1" cellpadding="0">
<tr>
<td align="center" class="captionXSL"> TEST </td>
</tr>
</table>
...
</body>
</html>
</xsl:template>
</xsl:transform>
style.css
..captionXSL {
font: 12px Arial;
font-weight: bold;
}
in IE it all works OK.
styles define in style.css are used in transformation of XML with XSL in
HTML
but in NN
there is no styles. It shows all needed data but it didn't read and apply
styles.
i hope you will help me.
thanks
i try to use xsl to show xml in IE6+ and NN7+
i got:
index.htm
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html;
charset=iso-8859-1">
<link rel="stylesheet" href="./css/style.css">
<script language="JavaScript">
function init(){
//here is checking of browser -> type is IE or
NN
var docXML = initXML(type);
var docXSL = initXML(type);
if (type == "NN"){
var count = 0;
docXML.onload = transform;
docXML.load(test.xml);
docXSL.onload = transform;
docXSL.load(test.xsl);
}
else if (type == "IE"){
docXML.async = false;
docXML.load(test.xml);
docXSL.async = false;
docXSL.load(test.xsl);
document.write(docXML.transformNode(docXSL));
}
function transform(){
count++;
if (count == 2){
var xsltProcessor = new XSLTProcessor();
var outdoc = initXML(type);
xsltProcessor.transformDocument(docXML,
docXSL, outdoc, null);
document.write(outdoc.documentElement.innerHTML);
}
}
}
</script>
</head>
<body bgcolor="#EFEFEF">
<script language="JavaScript"> init(); </script>
</body>
</html>
test.xsl:
<?xml version="1.0" encoding="ISO-8859-2"?>
<xsl:transform xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
<xsl:template match="root">
<html>
<head />
<body bgcolor="#EFEFEF">
<table bordercolor="#ffffff" cellspacing="0" width="98%"
bordercolorlight="#6b5c35" border="1" cellpadding="0">
<tr>
<td align="center" class="captionXSL"> TEST </td>
</tr>
</table>
...
</body>
</html>
</xsl:template>
</xsl:transform>
style.css
..captionXSL {
font: 12px Arial;
font-weight: bold;
}
in IE it all works OK.
styles define in style.css are used in transformation of XML with XSL in
HTML
but in NN
there is no styles. It shows all needed data but it didn't read and apply
styles.
i hope you will help me.
thanks