Forum Moderators: open
XML file (firefox.xml):
<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="firefox.xsl"?>
<webPage xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<view>
<application />
<span id="foo">#*$!</span>
<span id="bar">yyy</span>
</view>
</webPage>
------------------------
XSL file (firefox.xsl):
<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="webPage">
<html>
<head>
<title><xsl:value-of select="@title" /></title>
</head>
<body>
<xsl:apply-templates select="./view"/>
</body>
</html>
</xsl:template>
<xsl:template match="view">
<xsl:apply-templates/>
</xsl:template>
<xsl:template match="span">
<script language="JavaScript">
startX("<xsl:value-of select="@id"/>");
</script>
<xsl:apply-templates/>
<script language="JavaScript">
endX();
</script>
</xsl:template>
<xsl:template match="application">
<script language="JavaScript" type="text/javascript" src="firefox.js"></script>
</xsl:template>
-----------------
JS file (firefox.js):
if (typeof(startX) == "undefined") {
alert('defining');
function startX(p_id) {
alert('startX: ' + p_id);
}
function endX() {
alert('endX');
document.open();
document.write('foo');
}
}
I'll need someone to follow my post up as I feel I can only give you a partial but well leading answer.
document.write does not work with application/xhtml+xml mimetype. From what I'm guessing it doesn't work with XSLT either. Again don't go by my word alone on this one.
John