Click to See Complete Forum and Search --> : XML/XSL Template appears twice


D_M
10-06-2010, 11:26 AM
Hey folks,

I was hoping someone could help me with this.

XSL -

<xsl:stylesheet version="1.0" xmlns:ddwrt="http://schemas.microsoft.com/WebParts/v2/DataView/runtime" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:ddwrt2="urn:frontpage:internal" >


<!-- passed from Javascript, selects report in another template -->
<xsl:param name="param1" />
<xsl:variable name="selectedProgram" select="$param1"/>


<xsl:template match="/" >

<xsl:call-template name="option"/>

</xsl:template>


<xsl:template name="option">
<xsl:param name="select" />
<tr><td>
<select onchange="document.location=this.options[this.selectedIndex].value">
<xsl:element name="option">Select Discipline or Program</xsl:element>
<xsl:for-each select="/dataroot/ReportsForWeb">
<xsl:sort select="Title" data-type="text"/>
<xsl:element name="option">
<xsl:attribute name="value">program.aspx?Code=<xsl:value-of select="Prefix"/></xsl:attribute>
<xsl:if test="Prefix = $select"><xsl:attribute name="selected">selected</xsl:attribute></xsl:if>
<xsl:value-of select="Published_x0020_Title"/>
</xsl:element>
</xsl:for-each>
</select>
</td></tr>
</xsl:template>

</xsl:stylesheet>


Somehow it outputs this:

http://i51.tinypic.com/16h9p8j.jpg

Could it be the Javascript (which is hacked together) or the way it is called in the page?

If I add in my other template, like this:


<xsl:call-template name="option"/>
<xsl:call-template name="report"/>


I get a result that looks like this:

Dropdown (option template)
Report (report template)
Dropdown (option template)