MichielCM / xsd2html2xml

Generates plain HTML5 forms from XML schemas (XSDs). Transforms filled-in forms into XML.
MIT License
95 stars 42 forks source link

xs:sequence in xs:choice is not supported #15

Closed MichielCM closed 5 years ago

MichielCM commented 5 years ago

Fixed in release 3.1.

Luca-Colombo commented 5 years ago

Hello Michiel, great work with this project, thank you! I think that this issue isn't completely closed because I'm having some troubles with the inside the because although the sequences are rendered in the html form, the radio checkbox associated isn't rendered. I'm using v3.1

Kind regards, Luca.

MichielCM commented 5 years ago

Thanks for the notification. I should never commit without testing... :)

It looks like I forgot to include the $choice variable in the xs:sequence file. In matchers/sequence.xsl, add a parameter to the template:

And pass it in the apply-templates call in the same template:

Does that fix the issue?

Luca-Colombo commented 5 years ago

Thanks! This in partially fixes the issue but now even every element in the sequence contained in the choice has it's own checkbox.

<xs:choice>
    <xs:sequence>
        <xs:element name="CustomerID" />
    </xs:sequence>
    <xs:sequence>
        <xs:element name="Name" />
        <xs:element name="Surname" />
    </xs:sequence>
</xs:choice>

With this code, for example, the generated html form has a checkbox for CustomerID, Name and Surname instead of having only two checkboxes: one that enables CustomerID and the other one that enables both Name and Surname fields.

MichielCM commented 5 years ago

I had to refactor quite a bit of code for this to be fixed, but it should work now. Can you check the latest commit and confirm?

Luca-Colombo commented 5 years ago

During my humble tests all went fine after your latest commit, thank you!

MichielCM commented 5 years ago

Great, you're welcome! :)