Hallo!
Ich habe ein Problem, das mit Validität zu tun hat; dabei will ich einfach nur aus xml mittels xsl gültiges xhtml (hier auch html strict mit aufgeführt für unten folgenden Test) erzeugen und darin auch noch javascript verwenden.
****************************************************
Sei XML:
<?xml version="1.0" encoding="ISO-8859-1"?>
<?xml-stylesheet type="text/xsl" href="./xhtml.xsl"?>
<document>
</document>
****************************************************
Sei (xhtml.xsl) XSL:
::::::::::::hier header für xhtml generierung (A):::::::::::::::
<?xml version="1.0" encoding="iso-8859-1"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns="http://www.w3.org/1999/xhtml">
<xsl:output
method="xml"
encoding="iso-8859-1"
doctype-public="-//W3C//DTD XHTML 1.0 Strict//EN"
doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"
indent="yes" />
:::::hier alternativ header für strict html generierung (B)::::
<?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"
doctype-public="-//W3C//DTD HTML 4.01//EN"
doctype-system="http://www.w3.org/TR/html4/strict.dtd"
indent="yes" />
:::::::::::tepmplate definition für beide gleich::::::::::::
<xsl:template match="/">
<html>
<head>
<title>test</title>
<script type="text/javascript">
function someTest()
{
alert(document.getElementsByName("test").length);
}
</script>
</head>
<body onload="someTest()">
<p>text</p>
<input name="test" type="button" value="OK"></input>
<p>text</p>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
Und jetzt kommt's: während ich bei Variante (B) einen alert vom FF erhalte, steht in Variante (A) nur in der Fehlerkonsole:
document.getElementsByName is not a function
Ich will aber xhtml erzeugen, kein html ...
Was mach ich falsch?
Grüsse,
Richard