|
Subject: RE: [xsl] Delete XML Node From: Wendell Piez <wapiez@xxxxxxxxxxxxxxxx> Date: Thu, 31 Oct 2002 17:12:52 -0500 |
Input XML Output XML
<X> maps to----> <X1>
<xsl:template match="X"> <X1> <xsl:apply-templates/> </X1> </xsl:template>
<A>A</A> maps to----> <A1>A</A>
<xsl:template match="A"> <A1> <xsl:apply-templates/> </A1> </xsl:template>
<Y> maps to---> <Y1>
if resultant <Y1>
has got elements within it
<xsl:template match="Y">
<xsl:if test="B[.='ABC'] or C[.='XYZ']">
<Y1>
<xsl:apply-templates/>
</Y1>
</xsl:if>
</xsl:template> <B>B</B> maps to----> <B1>B1</B1>
only if data contained
in <B> is "ABC"
<xsl:template match="B"> <xsl:if test=". ='ABC'"> <B1> <xsl:apply-templates/> </B1> </xsl:if> </xsl:template>
<xsl:template match="B">
<B1>
<xsl:apply-templates/>
</B1>
</xsl:template> <C>C</C> maps to----> <C1>C1</C1>
only if data contained
in <C> is "XYZ"
</Y> </Y1> </X> </X>
According to the mapping rules for <B> and <C> the output XML should not contain <B1> and <C1> and thus <Y1> would be empty. But <Y1> should appear in the output only if <B1> or <C1> is present.
I hope this helps, 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 ======================================================================
| Current Thread |
|---|
|
| <- Previous | Index | Next -> |
|---|---|---|
| RE: [xsl] Delete XML Node, Deepak Rao | Thread | [xsl] Using substring call with for, Alan K. Gay |
| RE: [xsl] Delete XML Node, Deepak Rao | Date | RE: [xsl] String Manipulation - Dis, TEA Lanham, Kevin |
| Month |