Am Mittwoch, 6. M�rz 2002 16:16 schrieben Sie:
> > This is required for doing a schema to schema mapping and produce the
> > XSLT stylesheet for the transformation. So when we present the schema
> > to the user it makes sense to display the schema data structure with
> > all such internal types resolved. This will show the schema structure
> > closer to the way the instance document will look like. As you hinted
> > this is not a simple task as there can be as many number of
> > complexTypes with nested references. I would appreciate any ideas
> > towards the same.

Hi this is something like you are trying to. Note we add to our elements
an attribute "nf2Type" which could be a "tuple" or a "set" to deferentiate
between Tupels an sets. If you don't want to make this deferrence then you 
have to take one of the templates for complexType, and delete the XPATH
expression in the brackets [nf2Type=...]. I hope this will help a bit! 

Morad
--
<?xml version="1.0" encoding='ISO-8859-1' standalone='yes'?>
<xsl:stylesheet version='1.0' xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
                xmlns:xsd="http://www.w3.org/2001/XMLSchema";>

<xsl:output method="html"/>

<xsl:template match="/">
    <HTML>
        <BODY>
            <xsl:apply-templates/>
        </BODY>
    </HTML>
</xsl:template>

<xsl:template match="xsd:schema">
    <xsl:element name="TABLE">
        <xsl:attribute name="CELLPADDING">10</xsl:attribute>
        <xsl:attribute name="CELLSPACING">0</xsl:attribute>
        <xsl:element name="TR">
            <xsl:attribute name="BORDER">1</xsl:attribute>
            <xsl:apply-templates select="xsd:element"/>
        </xsl:element>
    </xsl:element>
</xsl:template>

<xsl:template match="xsd:element">
       <xsl:choose>
             <xsl:when 
test="//xsd:[EMAIL PROTECTED]()/@type]/xsd:attribute
                            [EMAIL PROTECTED]'nf2type' and @use='optional' and 
@default='set']">
                <xsl:element name="TD">
                    <xsl:element name="TABLE">
                        <xsl:attribute name="CELLPADDING">10</xsl:attribute>
                        <xsl:attribute name="CELLSPACING">0</xsl:attribute>
                        <xsl:attribute name="BORDER">1</xsl:attribute>
                        <xsl:element name="TR">
                              <xsl:element name="TD">
                                <xsl:attribute 
name="COLSPAN">10</xsl:attribute>
                                  <xsl:element name="CENTER">
                                     {}<xsl:value-of select="./@name"/>
                                  </xsl:element>
                             </xsl:element>
                        </xsl:element>
                        <!-- Verarbeite die Definition von der Menge -->
                        <xsl:apply-templates 
select="//xsd:[EMAIL PROTECTED]()/@type]"/>
                    </xsl:element>
                </xsl:element>
            </xsl:when>

            <xsl:when 
test="//xsd:[EMAIL PROTECTED]()/@type]/xsd:attribute
                            [EMAIL PROTECTED]'nf2type' and @use='optional' and 
@default='ptuple']">
                <tr>
                   <xsl:apply-templates 
select="//xsd:[EMAIL PROTECTED]()/@type]"/>
                </tr> 
            </xsl:when> 
           
              <xsl:otherwise>    
                <xsl:element name="TD">
                    <xsl:value-of select="./@name"/>
                    <xsl:apply-templates 
select="//xsd:[EMAIL PROTECTED]()/@type]"/>
                </xsl:element>
           </xsl:otherwise>            

        </xsl:choose>
</xsl:template>

<xsl:template match="xsd:complexType">
    <xsl:apply-templates select=".//xsd:element"/>
</xsl:template>

</xsl:stylesheet>

---


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to