[XSL-LIST Mailing List Archive Home]
Re: [xsl] No-output identity template?
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".
With the above you are suppressing those items that are children of menu
that are not matched by another template rule with a higher priority.
Without priority both "menu/item" and "item[item]" will match the node
which can be reported as an error by the processor.
I hope this helps.
Upcoming hands-on in-depth Europe: February 17-21, 2003
XSLT/XPath and/or XSL-FO North America: June 16-20, 2003
G. Ken Holman mailto:gkholman@xxxxxxxxxxxxxxxxxxxx
Crane Softwrights Ltd. http://www.CraneSoftwrights.com/s/
Box 266, Kars, Ontario CANADA K0A-2E0 +1(613)489-0999 (F:-0995)
ISBN 0-13-065196-6 Definitive XSLT and XPath
ISBN 0-13-140374-5 Definitive XSL-FO
ISBN 1-894049-08-X Practical Transformation Using XSLT and XPath
ISBN 1-894049-10-1 Practical Formatting Using XSL-FO
Male Breast Cancer Awareness http://www.CraneSoftwrights.com/s/bc
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list