Subject: RE: [xsl] links don't work when IE transforms XSL document From: Pieter Reint Siegers Kort <pieter.siegers@xxxxxxxxxxx> Date: Fri, 1 Oct 2004 08:56:03 -0500 |
Hi Anton, I could reproduce your (interesting) problem. IE is loading the xsl as xml because of its extension. Renaming the file's extension to .html solves the problem. You're right about that IE doesn't use MSXML 4.0 - you should work against what IE uses: 3.0 or make sure that your clients use 4.0 and use Javascript to use the 4.0 version-specific dll classes. Like Tom Passin already pointed out, serving an .xml or .xsl in IE will not activate the html rendering feature, therefore the anchors do not appear. I tried to make IE aware of how it should treat the .xsl: <xsl:output method="html" encoding="utf-8" indent="yes" doctype-public="-//W3C//DTD XHTML 1.0 Strict//EN" doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd" media-type="html"/> I first added the attribute media-type but nothing changed. Then I changed the attribute method from xml to html. Nothing changed. I'm afraid you will need to change the MIME-type that IE recieves from the server that sends the file out. See http://www.xml.com/pub/a/2003/03/19/dive-into-xml.html HTH, <prs/> -----Original Message----- From: Anton Triest [mailto:anton@xxxxxxxx] Sent: Thursday, September 30, 2004 3:31 AM To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx Subject: [xsl] links don't work when IE transforms XSL document Hello everybody, I want to create a html document (client-side transformation) with internal hyperlinks (links to anchors within the document). This is my stylesheet (anchors.xsl): <?xml version="1.0" encoding="utf-8"?> <?xml-stylesheet type="text/xsl" href="anchors.xsl"?> <xsl:stylesheet version="1.0" xmlns="http://www.w3.org/1999/xhtml" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:output method="xml" encoding="utf-8" indent="yes" doctype-public="-//W3C//DTD XHTML 1.0 Strict//EN" doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"/> <xsl:template match="/"> <html lang="en" xml:lang="en"> <head> <title>anchors</title> <style type="text/css"> div { padding-bottom: 800px; } </style> </head> <body> <div> <p>contents</p> <ul> <li><a href="#s1">Section 1</a></li> <li><a href="#s2">Section 2</a></li> <li><a href="#s3">Section 3</a></li> </ul> </div> <div><a id="s1"></a><h1>Section 1</h1></div> <div><a id="s2"></a><h1>Section 2</h1></div> <div><a id="s3"></a><h1>Section 3</h1></div> </body> </html> </xsl:template> </xsl:stylesheet> Against any input file, this should display a file with 3 hyperlinks (a href) to their appropriate anchor (a id). This all works well... except when I use an xsl stylesheet as input file: in IE, the links don't work (clicking them results in "Cannot find server or DNS Error"). I tried using '<a name=' instead of '<a id=', and also tried putting something inside the anchor element (<a id="s1"> </a>), but it doesn't help. Is this a bug in IE or MSXML? (I'm using IE 6.0.2800.1106, MSXML 4.20.9818.0). In Mozilla it works as expected. And when I generate a html file with Saxon, the resulting file works, also in IE. If anybody wonders why I want to use an xsl as input: the above code is a simplified example, for a similar problem occuring here: http://users.telenet.be/cking/webstuff/xdoc/xdoc.xsl TIA, Anton
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] links don't work when IE , Anton Triest | Thread | Re: [xsl] links don't work when IE , Anton Triest |
Re: [xsl] xsl:apply-template and xs, Anton Triest | Date | [xsl] # linking and searching, Nicholas Gower Morss |
Month |