MichielCM / xsd2html2xml

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

Namespaces - probably a question, not an issue #24

Closed shanerigby closed 5 years ago

shanerigby commented 5 years ago

I'm trying to generate the html forms for a schema that has another namespace used for elements under appinfo, but I keep getting errors that I can't resolve. To demonstrate, based on your double import example, I've added a new namespace and some elements in appinfo.

<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:lx="https://github.com/MichielCM/xsd2html2xml/definition" xmlns="https://github.com/MichielCM/xsd2html2xml/doubleImport" targetNamespace="https://github.com/MichielCM/xsd2html2xml/doubleImport" elementFormDefault="qualified">
    <xs:simpleType name="doubleImportedType">
        <xs:restriction base="xs:string">
            <xs:pattern value="(TRUE|FALSE)"/>
        </xs:restriction>
    </xs:simpleType>
    <xs:element name="doubleImportedElement" type="xs:boolean">
            <xs:annotation>
            <xs:documentation>Yes No Option</xs:documentation>
            <xs:appinfo>
                <lx:mapping>xyz</lx:mapping>
                <lx:instructions>YesNo</lx:instructions>
            </xs:appinfo>
        </xs:annotation></xs:element>
</xs:schema>

Do I need to configure something with respect to the namespace to get this to work? I note that the windows app loads this successfully.

I currently get an error:

xsl:attribute: The QName 'data-appinfo-lx:mapping' has no namespace binding in scope in the stylesheet; this is an error, since the namespace was not specified by the instruction itself.

Thanks & Cheers,

Shane

MichielCM commented 5 years ago

Hi Shane, that's an error on my part. App-info elements are added to HTML tags as attributes. But that code doesn't take into account prefixes. I'll have a look.

The Windows application currently runs on version 2.x, which didn't have this feature.

MichielCM commented 5 years ago

Hi Shane, the latest commit should fix it.

shanerigby commented 5 years ago

Thanks Michiel, that’s great thanks. I’ve tested it on our schema and it looks good. Cheers, Shane