xsl-list
[Top] [All Lists]

RE: RE: [xsl] How to apply templates to all child elements except a few

2006-10-17 13:21:48

That worked very well. Thank you all.

From: cknell(_at_)onebox(_dot_)com
Reply-To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: RE: RE: [xsl] How to apply templates to all child elements except a few
Date: Tue, 17 Oct 2006 15:25:36 -0400

Having just been bitten by overlooking a namespace, this couldn't be more timely.
--
Charles Knell
cknell(_at_)onebox(_dot_)com - email



-----Original Message-----
From:     G. Ken Holman <gkholman(_at_)CraneSoftwrights(_dot_)com>
Sent:     Tue, 17 Oct 2006 14:59:18 -0400
To:       xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: RE: [xsl] How to apply templates to all child elements except a few

At 2006-10-17 14:45 -0400, cknell(_at_)onebox(_dot_)com wrote:
><xsl:template match="el1">
>   <xsl:apply-templates match="*[not(local-name() = 'CHILD4'] />
></xsl:template>
>--
>Charles Knell
>cknell(_at_)onebox(_dot_)com - email
>-----Original Message-----
>From:     rfd ewrew <xmlquestions101(_at_)hotmail(_dot_)com>
>Sent:     Tue, 17 Oct 2006 13:38:15 -0500
>To:       xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
>Subject:  [xsl] How to apply templates to all child elements except a few
>
>Hi:
>
>I was wondering if there was any way in xslt to APPLY TEMPLATES a few
>elements and exclude a few
>
>Suppose i have an xml with a root element as el1
><el1>
><CHILD1></CHILD1>
><CHILD2></CHILD2>
><CHILD3></CHILD3>
><CHILD4></CHILD4>
>
></el1>
>I want to write something like apply templates to all elements except
>CHILD4. How do I do this?

I would suggest, Charles, that using the self::
axis is "safer" because while it accommodates the
elements as given it also accommodates the
situation where readers of the archive happen to
be working with elements in a namespace this
usage pattern would be more appropriate:

<xsl:template match="el1">
   <xsl:apply-templates match="*[not(self::CHILD4)]"/>
</xsl:template>

I hope this helps.

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


--
UBL/XSLT/XSL-FO training: Allerød/Vårø Denmark 2006-11-13,17,20/24
UBL International 2006  2006-11-13/17 http://www.ublconference.com
World-wide corporate, govt. & user group UBL, XSL, & XML training.
G. Ken Holman                 mailto:gkholman(_at_)CraneSoftwrights(_dot_)com
Crane Softwrights Ltd.          http://www.CraneSoftwrights.com/s/
Box 266, Kars, Ontario CANADA K0A-2E0    +1(613)489-0999 (F:-0995)
Male Cancer Awareness Aug'05  http://www.CraneSoftwrights.com/s/bc
Legal business disclaimers:  http://www.CraneSoftwrights.com/legal


--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--




--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--


_________________________________________________________________
Stay in touch with old friends and meet new ones with Windows Live Spaces http://clk.atdmt.com/MSN/go/msnnkwsp0070000001msn/direct/01/?href=http://spaces.live.com/spacesapi.aspx?wx_action=create&wx_url=/friends.aspx&mkt=en-us


--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--

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