[xsl] No-output identity template?

Subject: [xsl] No-output identity template?
From: cknell@xxxxxxxxxx
Date: Thu, 23 Jan 2003 09:42:18 -0500
If any of you received this yesterday, my apologies. I didn't receive a copy of this posting, or what I suspect were many other postings to the list yesterday afternoon. Perhaps the server was having trouble.

I have included an XML data document, an XSLT stylesheet, and the resulting output. The XML and XSLT have been severly edited for brevity. The problem I have been working for several hours is the extraneous? "Bugs Bunny" text node output at the end of the output document. I don't know what template or rule is causing its creation, so I haven't been able to suppress it. I need the aid of other eyes and brains.

I suspect I need some sort of rule with no output, but I haven't been able to discover what the rule should match.

Thanks.

XML Input
===================================
<menu>
  <item type="menu" title="AMD">
    <item>Library Home</item>
    <item>Phone Directories</item>
  </item>
  <item>Bugs Bunny</item>
</menu>

XSLT Stylesheet
===================================
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform";>
  <xsl:output method="html" indent="yes" encoding="UTF-8" />
  <xsl:strip-space elements="*" />

  <xsl:template match="/">
    <xsl:apply-templates mode="sub-menu" />
  </xsl:template>

  <xsl:template match="item[item]" mode="sub-menu">
    <div>
      <xsl:apply-templates mode="sub-menu-item" />
    </div>
  </xsl:template>

  <xsl:template match="item" mode="sub-menu-item">
    <div class="sub-menu-item" ><xsl:value-of select="." /></div>
  </xsl:template>

</xsl:stylesheet>

XML Output
===================================
<div>
   <div class="sub-menu-item">Library Home</div>
   <div class="sub-menu-item">Phone Directories</div>
</div>Bugs Bunny

-- 
Charles Knell
cknell@xxxxxxxxxx - email

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread