|
Subject: RE: [xsl] only display if subnodes occur more than once From: "Aron Bock" <aronbock@xxxxxxxxxxx> Date: Sun, 03 Jul 2005 17:01:06 +0000 |
<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>
<xsl:output method="xml" indent="yes"/> <xsl:strip-space elements="*"/>
<xsl:template match="root">
<xsl:copy>
<xsl:for-each select="*">
<xsl:if test="count(key('kElems', .)) != count(*)">
<xsl:copy-of select="."/>
</xsl:if>
</xsl:for-each>
</xsl:copy>
</xsl:template><?xml version="1.0" encoding="UTF-8"?> <root> <sub_b> <elem_1/> <elem_2/> <elem_2/> <elem_2/> <elem_3/> </sub_b> </root>
From: "Prerovsky, Clemens" <Clemens.Prerovsky@xxxxxxx> Reply-To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx To: <xsl-list@xxxxxxxxxxxxxxxxxxxxxx> Subject: [xsl] only display if subnodes occur more than once Date: Thu, 23 Jun 2005 12:06:42 +0200
Hi,
I'm stuck again with my XSL. My XML Structure looks like:
<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>
The thing I want to do is display the element sub_b, because it has subnodes which occur more than once (elem_2). I really have no idea how to test for this - playing around for nearly two hours now. Im using a loop like <xsl:for-each select="/root/*"> and the output should look like
sub_b (this is the header) elem_2 elem_2 (these are the 3 values of elem_2) elem_2
Best regards, Clemens Prerovsky
| Current Thread |
|---|
|
| <- Previous | Index | Next -> |
|---|---|---|
| [xsl] ANN: XML & XSLT FAQ, Mukul Gandhi | Thread | RE: [xsl] only display if subnodes , Wendell Piez |
| [xsl] ANN: XML & XSLT FAQ, Mukul Gandhi | Date | [xsl] Numbers containing 'e+..' not, Drew McLellan |
| Month |