|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] RE: Delete XML Node
Deepak,
Given mapping rules like this, a template-based approach is *way* easier: At 04:57 PM 10/31/2002, you wrote: Input XML Output XML
<A>A</A> maps to----> <A1>A</A>
I'm translating this into "maps to Y1 if the source Y contains a B with value "ABC" or a C with value "XYZ". This re-expression is necessary since you can inspect the source tree, but the result tree doesn't exist yet so you can't test the "resultant Y1": <xsl:template match="Y">
<xsl:if test="B[.='ABC'] or C[.='XYZ']">
<Y1>
<xsl:apply-templates/>
</Y1>
</xsl:if>
</xsl:template>
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>(Since you'll never even get to the B if the Y test was not passed, it's safe to just process it.) like B, with appropriate adjustments </Y> </Y1> </X> </X> Put all these templates together in a stylesheet and try it out.... I hope this helps, Wendell
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|

Cart








