Re: [xsl] XPATH or 2 templates ?

Subject: Re: [xsl] XPATH or 2 templates ?
From: "G. Ken Holman" <gkholman@xxxxxxxxxxxxxxxxxxxx>
Date: Mon, 18 Nov 2002 08:11:02 -0500
At 2002-11-18 13:21 +0100, Delaney Robin wrote:
If I template-match on <Concat> then I get the correct text for the 1st part
and not for the 2nd although it's close
If I template-match on <Concat/*> then I get the correct text for the 2nd
part but not for the first !

Why can I not have template match on <Concat> and <Concat/*> within the same
stylesheet ?

You can, but you haven't asked your stylesheet to do so. Inside your template rule for <Concat> you are not "pushing" the child elements at the stylesheet. This is done with <xsl:apply-templates/>. Since you are only asking the stylesheet to act on <Concat>, that is all that it is doing.


Your fix is to find out where during the building of <Concat> you want the children to be processed, and at that point, adding <xsl:apply-templates/> in order for the children to be pushed at the stylesheet, thereby triggering their templates to add nodes to the result tree. When the children have finished their processing (and whatever children they might have, and so on, and so on), then the template for <Concat> will continue and finish off building that part of the result tree it is responsible for.

I hope this helps.

.................. Ken


-- Upcoming hands-on in-depth XSLT/XPath and/or XSL-FO: - North America: Feb 3 - Feb 7,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
Next conference training:                    2002-12-08,03-03,06


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



Current Thread