have you tried putting an <xsl:comment> </xsl:comment> in between the
opening and closing <a> tags, for this result: <a name="id1"><!--
--></a>?
this worked for me in a similar situation.
On Thu, 30 Sep 2004 10:30:50 +0200, Anton Triest <anton(_at_)cking(_dot_)be>
wrote:
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
--
cheers,
Jakob.