I am converting an XML file that should generate some elements based on valid enumeration parameters defined in XSD.
Suppose I have an XSD that declares a type and element something like this:
<xs:simpleType name="optionType" nillable="true"> <xs:restriction base="xs:string"> <xs:maxLength value="50"/> <xs:enumeration value="USERCHOICE"> </xs:enumeration> <xs:enumeration value="DEFAULT"> </xs:enumeration> </xs:restriction> </xs:simpleType> ... <xs:element name="chosenOption" type='optionType'/> ... <xs:element name="availableOption" type='optionType'/>
The input will contain only the selected parameter, so you can imagine that it looks like this:
<options> <chosenOption>USERCHOICE</chosenOption> </options>
I need to have an output that looks like this:
<options> <chosenOption>USERCHOICE</chosenOption> <availableOptions> <availableOption>USERCHOICE</availableOption> <availableOption>DEFAULT</availableOption> </availableOptions> </options>
Is there a way to get the XSL extract of the USERCHOICE and DEFAULT enumeration values ββfrom XSD and create them in the output?
This will work on WebSphere 6 and will be used by the XSLT 1.0 engine. :(
(The schema file does not change often, but it will change now and then, and I would prefer only to update the schema file instead of updating the schema file and XSLT)
source share