xsl-list
[Top] [All Lists]

Re: No-output identity template?

2003-01-23 08:07:55


I don't know what template or rule is causing its creation,

It's the default element rule in the mode sub-menu

Here

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

you apply this mode to all child elements, there is just one, <menu>,
you don't have a template for that so the default gets applied which
just recurses on child nodes, in the same mode.


so now this mode is applied to the two child nodes of menu.

The first is an item containing an item so
  <xsl:template match="item[item]" mode="sub-menu">
applies.

the second is an item not containing an item so none of your templates
applies so the default will fire. This will in turn apply the sub-menu
mode templates to the text node children of the item node and you
get bugs bunny.

so either you want a template for menu in sub-menu that is more careful
in which children it applies templates to, or simpler if it does the job,

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

which will zap all items not covered by the higher priority  match="item[item]" 
template

David

________________________________________________________________________
This e-mail has been scanned for all viruses by Star Internet. The
service is powered by MessageLabs. For more information on a proactive
anti-virus service working around the clock, around the globe, visit:
http://www.star.net.uk
________________________________________________________________________

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



<Prev in Thread] Current Thread [Next in Thread>