Subject: RE: [xsl] Delete XML Node From: Wendell Piez <wapiez@xxxxxxxxxxxxxxxx> Date: Thu, 31 Oct 2002 16:43:48 -0500 |
... <xsl:for-each select="Y"> <xsl:if test="*"><!-- tests whether any element children of a Y exist --> <Y>...</Y> </xsl:if> </xsl:for-each>
<X> <A>A</A> <Y></Y> </X>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="*"> <!-- the default template for an element simply copies that element --> <xsl:copy> <xsl:apply-templates/> </xsl:copy> </xsl:template>
<xsl:template match="Y[not(*)]"/> <!-- except Y elements with no element children are removed -->
Good luck, Wendell
Whoops, I shot myself in the foot here....
sorry folks I am new to XSL.... and pardon my ignorrance
To clarify things, I want an XSL which would output a <Y> if and only if it has a sub element in this case a <Z>. In the current example I have only one sub element <Z> but there can be more than one sub-element of <Y>.
e.g.
<Y> <Z></Z> <D></D> ...... </Y>
I do not want <Y></Y> to appear in the output if all the sub-elements do not map.
Thanks, Deepak
====================================================================== 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 | RE: [xsl] Delete XML Node, KIENLE, STEVEN C [IT |
[xsl] Re: variables in XSLT, karan bhasin | Date | RE: [xsl] Delete XML Node, Deepak Rao |
Month |