[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

RE: Delete XML Node

Subject: RE: Delete XML Node
From: Wendell Piez <wapiez@xxxxxxxxxxxxxxxx>
Date: Fri, 01 Nov 2002 11:39:15 -0500
msxml remove node
Deepak,

At 11:29 AM 11/1/2002, I wrote:
Or more simply, if a Y will never have more than one B, you can do

<xsl:template match="B">
  <B1>
    <xsl:apply-templates/>
  </B1>
</xsl:template>

This allows your rule (finding that you need a Y since you have a B='ABC') to be in one place, which is better; the down side is that if you have input like


<Y>
  <B>ABC</B>
  <B>LMN</B>
  <C>zzz</C>
<Y>

And your rules are only in the Y template, since "B[.='ABC'] or C[.='XYZ']" is true, all B and C elements will be processed.

Of course the simpler solution to this (doh!) is:


<xsl:template match="Y">
  <xsl:if test="B[.='ABC'] or C[.='XYZ']">
    <Y1>
      <xsl:apply-templates select="B[.='ABC'] | C[.='XYZ']"/>
    </Y1>
  </xsl:if>
</xsl:template>

or the analogous logic. Then you need no logic in the B template.

Incidentally, this can be further compressed (if you like) as:

<xsl:template match="Y[B[.='ABC'] or C[.='XYZ']]">
  <Y1>
    <xsl:apply-templates select="B[.='ABC'] | C[.='XYZ']"/>
  </Y1>
</xsl:template>

<xsl:template match="Y"/> <!-- this suppresses a Y unless it matches the other template -->

Cheers,
Wendell


====================================================================== Wendell Piez mailto:wapiez@xxxxxxxxxxxxxxxx Mulberry Technologies, Inc. http://www.mulberrytech.com 17 West Jefferson Street Direct Phone: 301/315-9635 Suite 207 Phone: 301/315-9631 Rockville, MD 20850 Fax: 301/315-8285 ---------------------------------------------------------------------- Mulberry Technologies: A Consultancy Specializing in SGML and XML ======================================================================


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



Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.