Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Converting xsd to xml using xslt

Status
Not open for further replies.

chrislx

Programmer
Oct 17, 2003
32
US
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
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top