|
Subject: RE: [xsl] only display if subnodes occur more than once From: Wendell Piez <wapiez@xxxxxxxxxxxxxxxx> Date: Tue, 05 Jul 2005 16:33:49 -0400 |
<xsl:template match="root/*">
<xsl:variable name="include">
<xsl:call-template name="include"/>
</xsl:variable>
<xsl:if test="string($include)">
<xsl:copy-of select="."/>
</xsl:if>
</xsl:template><xsl:template name="include">
<xsl:for-each select="*">
<xsl:if test="following-sibling::*[name()=name(current())]">X</xsl:if>
</xsl:for-each>
</xsl:template>Cheers, Wendell
The original problem asked (I think), given:
<root> <sub_a> <elem_1/> <elem_2/> <elem_3/> </sub_a> <sub_b> <elem_1/> <elem_2/> <elem_2/> <elem_2/> <elem_3/> </sub_b> <sub_c> <elem_1/> <elem_2/> <elem_3/> </sub_c> </root>
output:
<root> <sub_b> <elem_2/> <elem_2/> <elem_2/> </sub_b> </root>
Namely, output those sub_* which have more than 1 elem_* children named the same; also output the elem_* children.
--A
====================================================================== 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] only display if subnodes , Aron Bock | Thread | Re: [xsl] only display if subnodes , David Carlisle |
| [xsl] Re: xsl-list Digest 1 Jul 200, cookie king | Date | [xsl] [ANN] A World Class XML Confe, Scott Abel |
| Month |