[xsl] conditional processing driven by comparison

Subject: [xsl] conditional processing driven by comparison
From: Jean-Roch Meurisse <jrm@xxxxxxxxxxxxxxxx>
Date: Thu, 04 Mar 2004 09:30:03 +0100
Hi,

I've just joined the list (I'm a XSLT newbie) and can't find in the archives a response to my problem.
My purpose is to transform the following xml structures into valid xml-schema structures.
example
<myelement name="globalConcept">
<mychoice>
<mygroup>
<myelement ref="subconcept1"/>
<myelement ref="subconcept2"/>
</mygroup>
<mygroup>
<myelement ref="subconcept3"/>
<myelement ref="subconcept4/">
</mygroup>
<mygroup>
<myelement ref="subconcept3"/>
<myelement ref="subconcept4"/>
<myelement ref="subconcept5"/>
</mygroup>
<mygroup>
<myelement ref="subconcept1"/>
<myelement ref="subconcept2"/>
</mygroup>
</mychoice>
</myelement>


should be transformed to
<element name="globalConcept">
	<complexType>
		<choice>
			<sequence>
				<element ref="subconcept1"/>
				<element ref="subconcept2/>
			</sequence>
			<sequence>
				<element ref="subconcept3"/>
				<element ref="subconcept4"/>
				<element ref="subconcept5" minOccurs="0"/>
			</sequence>
		</choice>
	</complexType>
</element>

Furthermore, if all "mygroup" nodes are identical, it should produce only one sequence directly under the complexType element (without the choice element)
I would yet be satisfied with a transformation only copying group nodes but eliminating duplicates (in the example copying the 3 first groups and eliminating 4th)


thank you all in advance

JR


XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list



Current Thread