[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:29:12 -0500
msxml delete node
Deepak,

At 09:32 AM 11/1/2002, you wrote:
Thank you very much. Your solution works perfectly fine. But looking at a maintenance point of view, the rule for <B> and <C> are repeated twice, once for <Y> and once of either <B> or <C>. If there is a change to any of the rules for <B> or <C>, I would have to remember to change two places instead of just one. Do you think there is a way to avoid this?

Yes, that issue is what I was referring to when I said


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.

This is because the test on the Y is really "do I need a Y (because lower down I'm going to have a B or C child)", whereas the test on B is really "do I need *this* B". If you know you don't need the second test you can leave it out.

What the best solution is in your actual case will depend on exactly what your data and rules really are. It's a bit more complicated because you have more than one element you want to filter.

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.