I need to convert a .xsd file to .xml file using xslt. Thanks for any suggestion. I have trouble on finding the right xpath. I used the following for loop:
...
<xsl:for-each select="xs:simpleType">
...
</xsl:for-each>
...
It does not work.
Here is thexsd file:
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs=" elementFormDefault="qualified">
<xs:simpleType name="CommentTypeCode">
<xs:annotation>
<xs:documentation>
<term name="CommentTypeCode" code-list-type="enumerated" definition="The type of comment being submitted for consideration." source="" alias=""/>
</xs:documentation>
</xs:annotation>
<xs:restriction base="xs:string">
<xs:enumeration value="General">
<xs:annotation>
<xs:documentation>
<term name="General" definition="Comment being submitted is of a general nature." source="" alias=""/>
</xs:documentation>
</xs:annotation>
</xs:enumeration>
<xs:enumeration value="Specific">
<xs:annotation>
<xs:documentation>
<term name="Specific" definition="Comment being submitted is of a specific nature and includes such things as line number, figure number, paragraph, etc." source="" alias=""/>
</xs:documentation>
</xs:annotation>
</xs:enumeration>
</xs:restriction>
</xs:simpleType>
……
</xs:schema>
Here is the xml file:
<dataroot>
<Code-Data-1>
<Code-List-Name>CommentTypeCode</Code-List-Name>
<Code-List-Type>enumerated</Code-List-Type>
<definition>Comment Type Code (CommentTypeCode) - The type of comment being submitted for consideration.</definition>
<LValue>General</LValue>
<LDefinition>Comment being submitted is of a general nature.</LDefinition>
</Code-Data-1>
<Code-Data-1>
<Code-List-Name>CommentTypeCode</Code-List-Name>
<Code-List-Type>enumerated</Code-List-Type>
<definition>Comment Type Code (CommentTypeCode) - The type of comment being submitted for consideration.</definition>
<LValue>Specific</LValue>
<LDefinition>Comment being submitted is of a specific nature and includes such things as line number, figure number, paragraph, etc.</LDefinition>
</Code-Data-1>
….
</dataroot>
Thanks again,
chrislx
...
<xsl:for-each select="xs:simpleType">
...
</xsl:for-each>
...
It does not work.
Here is thexsd file:
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs=" elementFormDefault="qualified">
<xs:simpleType name="CommentTypeCode">
<xs:annotation>
<xs:documentation>
<term name="CommentTypeCode" code-list-type="enumerated" definition="The type of comment being submitted for consideration." source="" alias=""/>
</xs:documentation>
</xs:annotation>
<xs:restriction base="xs:string">
<xs:enumeration value="General">
<xs:annotation>
<xs:documentation>
<term name="General" definition="Comment being submitted is of a general nature." source="" alias=""/>
</xs:documentation>
</xs:annotation>
</xs:enumeration>
<xs:enumeration value="Specific">
<xs:annotation>
<xs:documentation>
<term name="Specific" definition="Comment being submitted is of a specific nature and includes such things as line number, figure number, paragraph, etc." source="" alias=""/>
</xs:documentation>
</xs:annotation>
</xs:enumeration>
</xs:restriction>
</xs:simpleType>
……
</xs:schema>
Here is the xml file:
<dataroot>
<Code-Data-1>
<Code-List-Name>CommentTypeCode</Code-List-Name>
<Code-List-Type>enumerated</Code-List-Type>
<definition>Comment Type Code (CommentTypeCode) - The type of comment being submitted for consideration.</definition>
<LValue>General</LValue>
<LDefinition>Comment being submitted is of a general nature.</LDefinition>
</Code-Data-1>
<Code-Data-1>
<Code-List-Name>CommentTypeCode</Code-List-Name>
<Code-List-Type>enumerated</Code-List-Type>
<definition>Comment Type Code (CommentTypeCode) - The type of comment being submitted for consideration.</definition>
<LValue>Specific</LValue>
<LDefinition>Comment being submitted is of a specific nature and includes such things as line number, figure number, paragraph, etc.</LDefinition>
</Code-Data-1>
….
</dataroot>
Thanks again,
chrislx