1<?xml version="1.0"?> 2 3 4 5<!-- xt sampleXMLSchema.xml XMLSchema2c++.xslt --> 6 7 8 9<xsl:stylesheet 10 11 xmlns:xsl='http://www.w3.org/1999/XSL/Transform' 12 13 xmlns:xsch="http://www.w3.org/1999/XMLSchema" 14 15 version="1.0" > 16 17 18 19<xsl:output method="text"/> 20 21 22 23<xsl:template match = '/' > 24 25typedef int integer; 26 27 <xsl:apply-templates/> 28 29</xsl:template> 30 31<xsl:template match = 'text()' > 32 33</xsl:template> 34 35 36 37<xsl:template match="@*|*"> 38 39 <xsl:apply-templates /> 40 41</xsl:template> 42 43 44 45<xsl:template match = 'xsch:complexType' > 46 47class <xsl:value-of select="@name"/> 48 49 <xsl:if test="@derivedBy='extension'" > : public <xsl:value-of select="@source"/> 50 51 </xsl:if> 52 53{ 54 55 <xsl:if test="@type" > 56 57 <xsl:value-of select="@type"/> content; 58 59 </xsl:if> 60 61<xsl:apply-templates/> 62 63}; 64 65</xsl:template> 66 67 68 69<xsl:template match = 'xsch:element' > 70 71<xsl:variable name="type"> 72 73<xsl:value-of select="@type"/> 74 75</xsl:variable> 76 77<xsl:choose> 78 79 <xsl:when test="$type != ''"> 80 81 <xsl:value-of select="$type"/> 82 83 </xsl:when> 84 85 <xsl:otherwise> 86 87 no_type_specified 88 89 </xsl:otherwise> 90 91</xsl:choose> 92 93<xsl:text> </xsl:text><xsl:value-of select="@name"/> ; 94 95</xsl:template> 96 97 <!-- 98 * Licensed to the Apache Software Foundation (ASF) under one 99 * or more contributor license agreements. See the NOTICE file 100 * distributed with this work for additional information 101 * regarding copyright ownership. The ASF licenses this file 102 * to you under the Apache License, Version 2.0 (the "License"); 103 * you may not use this file except in compliance with the License. 104 * You may obtain a copy of the License at 105 * 106 * http://www.apache.org/licenses/LICENSE-2.0 107 * 108 * Unless required by applicable law or agreed to in writing, software 109 * distributed under the License is distributed on an "AS IS" BASIS, 110 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 111 * See the License for the specific language governing permissions and 112 * limitations under the License. 113 --> 114 115</xsl:stylesheet> 116