Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


Re: [xsl] links don't work when IE transforms XSL document

From: Anton Triest <anton@-------->
To:
Date: 10/1/2004 3:17:00 PM
Passin, Tom wrote:



Here are my results using your stylesheet -



1) Running the transform with msxml3 produced identical results for the

source document consisting of "<root/>", and the source document

consisting of the stylesheet.  I compared them using examdiff, and they

were exactly the same, as one would expect.

 



So far, the same results here.



2) In both IE6sp1 and Firefox 0.9.2 in Win2000 sp4, the internal links

were visible and worked as expected.

 



Yes, when I open the generated output file in the browser, the links 
work. It's only when I open the

stylesheet directly in the browser (via <?xml-stylesheet PI) that they 
don't work... Have you tried this?

Because if the links work for you, I can't understand why they don't 
work here: I also have IE6sp1

(on Win98, but can that make any difference?)



BUT note that you won't get that result just loading the output into IE

from the file system, at least not if it has a file extension of ".xml".

IE knows nothing about xhtml, and needs to see a .html extension, in

which case IE treats the file as an ordinary html file.  Otherwise it

displays it as xml, which would certainly cause someone to say that they

did not see any links.

 



Using xml:output method="html" doesn't seem to make any difference (see 
below)



I suspect your problem is either the file extension or the MIME type the

file is served with.  IE will try to figure out the file type based on

the MIME, extension, and also the file contents.  I don't know how you

are serving it, but perhaps the combination of the declared type plus

something else causes the difference.  Do you use on embedded stylesheet

PI to specify the stylesheet, or do you transform it separately before

serving it to the browser?  You should look into those factors, and also

explain clearly exactly what was observed instead of the expected

results.

 



I want to use the embedded stylesheet PI. Here's the original stylesheet:
http://users.telenet.be/cking/webstuff/xdoc/xdoc.xsl

The stylesheet is meant to transform any xsl file, including itself (via 
the xml-stylesheet PI).

Now what happens is:



1. in Mozilla (Firefox 0.9.3 and 1.0PR) the links work fine

2. in IE6, the links don't work ("Cannot find server or DNS Error")

3. if I use the the "MSXML-XSL Output IE" tool [1] to display the html 
output, then copy and paste it in

  a file "result.html" and open that in the browser, the page looks 
exactly the same, but now the links do work.



So I tried to cut things down to the smallest stylesheet that still 
demonstrates the problem,

I already posted that, but here's a slightly shorter version that uses 
xsl:output method="html":



--- anchors.xsl ---

<?xml version="1.0"?>

<?xml-stylesheet type="text/xsl" href="anchors.xsl"?>

<xsl:stylesheet version="1.0" 
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

   <xsl:output method="html" indent="yes"/>

   <xsl:template match="/">

       <html>

           <head>

               <title>anchors</title>

               <style type="text/css">div {padding-bottom: 500px;}</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>



The links are broken (1) only in IE, (2) only when the <?xml-stylesheet 
PI is used (ie. client-side)

*and* (3) only if an xsl file is used as input: if I send this file to IE:



--- dummy.xml ---
<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="anchors.xsl"?>
<dummy/>

the links work fine... but as soon as I just rename "dummy.xml" to 
"dummy.xsl" the links are broken again!



Sorry for the long post, but this one is breaking my head, and I wanted 
to describe things as clearly as possible.

Any feedback is greatly appreciated!



Thanks,
Anton


[1] 
http://www.microsoft.com/downloads/details.aspx?FamilyId=D23C1D2C-1571-4D61-BDA8-ADF9F6849DF9&displaylang=en


transparent
Print
Mail
Like It
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent