Strange Behavior With Anchor in XSLT

wxdqz

New Member
I have a very simple XML doc:

<?xml version="1.0" encoding="UTF-8"?>
<faqs>
<faq>
<department>ap</department>
<category>gen</category>
<question>QUESTION?</question>
<answer>ANSWER</answer>
</faq>
<faq>
<department>da</department>
<category>pp</category>
<question>QUESTION?</question>
<answer>ANSWER</answer>
</faq>
<faq>
<department>it</department>
<category>rp</category>
<question>QUESTION?</question>
<answer>ANSWER</answer>
</faq>
<faqs>

...and an XSLT stylesheet:

<?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="/">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>FAQ's</title>
</head>
<body>
<h1>FAQ's</h1>
<br />
<br />
<!-- FAQ's categories begin -->
<!--Show General div bar-->
<div class="icebluebar">General FAQ's</div>
<ul>
<xsl:for-each select="faqs/faq">
<xsl:if test="category = 'gen'">
<!--Show General FAQ's-->
<li><xsl:element name="a"><xsl:attribute name="href">#<xsl:number value=http://www.webdeveloper.com/forum/archive/index.php/"position()" format="1" /></xsl:attribute><xsl:value-of select="question" /></xsl:element></li>
</xsl:if>
</xsl:for-each>
</ul>
<!--Show Personal Property div bar-->
<div class="icebluebar">Personal Property FAQ's</div>
<ul>
<xsl:for-each select="faqs/faq">
<xsl:if test="category = 'pp'">
<!--Show Personal Property FAQ's-->
<li><xsl:element name="a"><xsl:attribute name="href">#<xsl:number value=http://www.webdeveloper.com/forum/archive/index.php/"position()" format="1" /></xsl:attribute><xsl:value-of select="question" /></xsl:element></li>
</xsl:if>
</xsl:for-each>
</ul>
<!--Show Real Property div bar-->
<div class="icebluebar">Real Property FAQ's</div>
<ul>
<xsl:for-each select="faqs/faq">
<xsl:if test="category = 'rp'">
<!--Show Real Property FAQ's-->
<li><xsl:element name="a"><xsl:attribute name="href">#<xsl:number value=http://www.webdeveloper.com/forum/archive/index.php/"position()" format="1" /></xsl:attribute><xsl:value-of select="question" /></xsl:element></li>
</xsl:if>
</xsl:for-each>
</ul>
<!-- FAQ's categories end -->

<!-- FAQ's questions/answers begin -->
<xsl:for-each select="faqs/faq">
<xsl:element name="a">
<xsl:attribute name="name"><xsl:number value=http://www.webdeveloper.com/forum/archive/index.php/"position()" format="1" /></xsl:attribute>
<xsl:attribute name="id"><xsl:number value="position()" format="1" /></xsl:attribute>
</xsl:element>
<strong>Q. <xsl:value-of select="question" /></strong>
<br />
<strong><font color="#660000">A. </font></strong><xsl:value-of select="answer" />
<br />
<br />
</xsl:for-each>
<!-- FAQ's questions/answers end -->
</body>
</html>
</xsl:template>
</xsl:stylesheet>

...that gets transformed by an ASP.NET/VB.NET script:

<%@ Page Language="VB" ContentType="text/html" ResponseEncoding="iso-8859-1" Debug="true" %>
<%@ import Namespace="System.Data" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<link rel="stylesheet" href=http://www.webdeveloper.com/forum/archive/index.php/"http://DOMAIN/DIRECTORY/styles/css/default.css">
<%'Load XML
Dim xml = Server.CreateObject("Microsoft.XMLDOM")
xml.async = false
xml.load("http://DOMAIN/DIRECTORY/departments/ap/docs/xml/ap_faqs.xml")

'Load XSL
Dim xsl = Server.CreateObject("Microsoft.XMLDOM")
xsl.async = false
xsl.load("http://DOMAIN/DIRECTORY/departments/ap/docs/xslt/ap_faqs.xsl")

'Transform file
Response.Write(xml.transformNode(xsl))
%>

and here's the resulting code, which appears normal:
<head>
<title>FAQ's</title>
</head>
<body>
<h1>FAQ's</h1>
<br />
<br />
<div class="icebluebar">General FAQ's</div>

<ul>
<li><a href=http://www.webdeveloper.com/forum/archive/index.php/"#1">QUESTION?</a></li>
<li><a href="#2">QUESTION?</a></li>
<li><a href="#3">QUESTION?</a></li>
</ul>

<a name="1" id="1" />
<strong>Q. QUESTION1?</strong>
<br />
<strong><font color="#660000">A. </font></strong>
ANSWER1
<br />
<br />
<a href="#top"><img src="http://DOMAIN/DIRECTORY/IMAGES/GIF/backtotop.gif" alt="Back to Top" title="Back to Top" width="19" height="19" /></a>
<br />
<br />

<a name="2" id="2" />
<strong>Q. QUESTION2?</strong>
<br />
<strong><font color="#660000">A. </font></strong>
ANSWER2
<br />
<br />
<a href="#top"><img src="http://DOMAIN/DIRECTORY/IMAGES/GIF/backtotop.gif" alt="Back to Top" title="Back to Top" width="19" height="19" /></a>

<a name="3" id="3" />
<strong>Q. QUESTION3?</strong>
<br />
<strong><font color="#660000">A. </font></strong>
ANSWER3
<br />
<br />
<a href="#top"><img src="http://DOMAIN/DIRECTORY/IMAGES/GIF/backtotop.gif" alt="Back to Top" title="Back to Top" width="19" height="19" /></a>

</body>
</html>

...but I'm running into a strange problem. The text for the questions & answers next to each anchor is showing up as text with a hover property that changes the text's color to #660000 in Firefox, and just stays stylized in IE6. I've made sure to review the resulting code through the "View Source" method, and everything appears that it should work properly. But it's still acting strange in the browser window.

I'm hoping that someone can see an obvious mistake on my part concerning the XSLT stylesheet. Any & all advice is appreciated. Thanks.
 
Back
Top