recursive transform output different in IE and FF
I am trying to create an HTML DOM that is unnested, as the XML input. All folders should be siblings of one another in the output HTML DOM. In IE this works great with the attached XSLT logic. In FF, on the other hand, all folder nodes end up as[list]s embeded in one another resulting in folder 1 as parent of folder 2, 2 parent of 3, etc.
Intrestingly, if any folder has a child node it will display correctly in the resulting HTML DOM.
Why the diff? Even if my XSLT logic is crap, I would expect the same crappy result from both browsers, perhaps in an ideal world. Ideas?
input XML:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
...
<channelListNodes>
<channel>
<name>blah</name>
</channel>
<folder>
<name>1</name>
</folder>
<folder>
<name>2</name>
</folder>
<folder>
<name>3</name>
</folder>
<folder>
<name>4</name>
</folder>
</channelListNodes>
...
XSL stylesheet:
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output
method="html"
encoding="UTF-8"
omit-xml-declaration="no"
doctype-public="-//W3C//DTD XHTML 1.0 Transitional//EN"
doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"
indent="yes"
standalone="yes"
/>
<xsl:template match="//channelListNodes">
<html>
<head>
<title>ChannelList</title>
</head>
<body>
<table class="channelListTable" id="channelListTable">
<thead>
<th class="leftChannelCol">#160;</th>
<th class="midChannelCol">#160;</th>
<th class="rightChannelCol">#160;</th>
</thead>
</table>
<ul class="tree" id="channelListTree">
<xsl:variable name="channels" select="./channel"/>
<xsl:variable name="folders" select="./folder"/>
<xsl:if test="$channels">
<xsl:for-each select="$channels">
<xsl:call-template name="processChannel">
<xsl:with-param name="channel" select="."/>
</xsl:call-template>
</xsl:for-each>
</xsl:if>
<xsl:if test="$folders">
<xsl:for-each select="$folders">
<xsl:call-template name="processFolder">
<xsl:with-param name="folder" select="."/>
</xsl:call-template>
</xsl:for-each>
</xsl:if>
</ul>
</body>
</html>
</xsl:template>
<xsl:template name="processFolder">
<xsl:param name="folder"/>
<xsl:variable name="name"><xsl:value-of select="$folder/name"/></xsl:variable>
<li class="folder" id='{$name}'>
<a href="#"><xsl:value-of select='$name'/></a>
[list]
<xsl:variable name="channels" select="$folder/channel"/>
<xsl:variable name="folders" select="$folder/folder"/>
<xsl:if test="$channels">
<xsl:for-each select="$channels">
<xsl:call-template name="processChannel">
<xsl:with-param name="channel" select="."/>
</xsl:call-template>
</xsl:for-each>
</xsl:if>
<xsl:if test="$folders">
<xsl:for-each select="$folders">
<xsl:call-template name="processFolder">
<xsl:with-param name="folder" select="."/>
</xsl:call-template>
</xsl:for-each>
</xsl:if>
</ul>
</li>
</xsl:template>
<xsl:template name="processChannel">
<xsl:param name="channel"/>
<xsl:variable name="thisName"><xsl:value-of select="$channel/name"/></xsl:variable>
<li class="channelListEntry" id='{$thisName}' xpath='{$path}' ro='{$ro}'>
<a href="#">
<span class="channelListEntryData" id = "channelListEntryDataName"><xsl:value-of select='$thisName'/></span>
</a>
</li>
</xsl:template>
<xsl:template match="text()" />
</xsl:stylesheet>
|