Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

simpleType extension doesn't generate select element options #43

Open
aritgithub opened this issue Apr 20, 2021 · 0 comments
Open

simpleType extension doesn't generate select element options #43

aritgithub opened this issue Apr 20, 2021 · 0 comments

Comments

@aritgithub
Copy link

aritgithub commented Apr 20, 2021

My XSD:

<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="/xsd2html2xml/xsd2html2xml.xsl"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">

    <xs:simpleType name="size">
        <xs:restriction base="xs:string">
            <xs:enumeration value="small"/>
            <xs:enumeration value="medium"/>
            <xs:enumeration value="large"/>
        </xs:restriction>
    </xs:simpleType>

    <xs:complexType name="jeans">
        <xs:simpleContent>
            <xs:extension base="size">
                <xs:attribute name="sex">
                    <xs:simpleType>
                        <xs:restriction base="xs:string">
                            <xs:enumeration value="male"/>
                            <xs:enumeration value="female"/>
                        </xs:restriction>
                    </xs:simpleType>
                </xs:attribute>
            </xs:extension>
        </xs:simpleContent>
    </xs:complexType>

    <xs:element name="MY JEANS" type="jeans"/>

</xs:schema>

sex attribute select element options are correctly generated, but the inherited size attribute select element does'n contain options.
This is the HTML generated:

<html>
<body>
    <form action="javascript:void(0);" class="xsd2html2xml" onsubmit="myFunction(htmlToXML(this));">
        <section>
            <fieldset data-xsd2html2xml-namespace="" data-xsd2html2xml-type="element" data-xsd2html2xml-name="MY JEANS"
                data-xsd2html2xml-xpath="/MY JEANS">
                <legend>MY JEANS</legend>
                <label data-xsd2html2xml-namespace="" data-xsd2html2xml-type="content" data-xsd2html2xml-name="MY JEANS"
                    data-xsd2html2xml-xpath="/MY JEANS"><select
                        onchange="this.childNodes.forEach(function(o) { if (o.nodeType == Node.ELEMENT_NODE) o.removeAttribute(&quot;selected&quot;); }); this.children[this.selectedIndex].setAttribute(&quot;selected&quot;,&quot;selected&quot;);"
                        required="required" data-xsd2html2xml-description="MY JEANS"
                        data-xsd2html2xml-primitive="string"></select><span>MY JEANS</span></label>
                <label data-xsd2html2xml-namespace="" data-xsd2html2xml-type="attribute" data-xsd2html2xml-name="sex"
                    data-xsd2html2xml-xpath="/MY JEANS/@sex"><select
                        onchange="this.childNodes.forEach(function(o) { if (o.nodeType == Node.ELEMENT_NODE) o.removeAttribute(&quot;selected&quot;); }); this.children[this.selectedIndex].setAttribute(&quot;selected&quot;,&quot;selected&quot;);"
                        data-xsd2html2xml-description="sex" data-xsd2html2xml-primitive="string">
                        <option value="male">male</option>
                        <option value="female">female</option>
                    </select><span>sex</span></label>
            </fieldset>
        </section><button type="submit"></button>
    </form>
</body>
<html>

Is it an error or is there some concept in the xsd extensions that I have misinterpreted?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant