RE: [xsl] No-output identity template?

Subject: RE: [xsl] No-output identity template?
From: "Roger Glover" <glover_roger@xxxxxxxxx>
Date: Thu, 23 Jan 2003 10:23:43 -0600
G. Ken Holman wrote:

> At 2003-01-23 09:42 -0500, cknell@xxxxxxxxxx wrote:
> >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,
>
> Your <xsl:apply-templates> in your root node template rule is
> selecting all child nodes because you do not have a select= attribute.
> The <item> is one of the child nodes.  Without a template rule for
> <item>, the built-in  template rules engage and all children are
> processed, which includes text nodes.  Without a template rule for text
> nodes, the built-in template rule is adding the text node to the result.
>
> >I suspect I need some sort of rule with no output, but I haven't
> >been able to discover what the rule should match.
>
> <xsl:template match="menu/item" mode="sub-menu" priority="-1"/>
>
> This will not conflict with match="item[item]" because the inferred
> priority of that rule is ".5".

Is there a reason not just use 'match="item[not(item)]"' instead?  This
seems to me to express the desired behavior more precisely, and it does not
require the priority setting to work correctly in the general case.



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


Current Thread