xsl-list
[Top] [All Lists]

conditional processing driven by comparison

2004-03-04 01:30:03
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



<Prev in Thread] Current Thread [Next in Thread>
  • conditional processing driven by comparison, Jean-Roch Meurisse <=