xsddoc/src/net/sf/xframe/xsddoc/xslt model.xsl,1.21,1.22 component.xsl,1.25,1.26 xml2html.xsl,1.29,1.30

Kurt Riede <[email protected]>
Newsgroups gmane.text.xml.xframe.xsddoc.devel
Message-ID <[email protected]>
Update of /cvsroot/xframe/xsddoc/src/net/sf/xframe/xsddoc/xslt
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26235/src/net/sf/xframe/xsddoc/xslt

Modified Files:
	model.xsl component.xsl xml2html.xsl 
Log Message:
fixes and improvements doe nested element declarations

Index: xml2html.xsl
===================================================================
RCS file: /cvsroot/xframe/xsddoc/src/net/sf/xframe/xsddoc/xslt/xml2html.xsl,v
retrieving revision 1.29
retrieving revision 1.30
diff -C2 -d -r1.29 -r1.30
*** xml2html.xsl	3 Sep 2004 08:04:23 -0000	1.29
--- xml2html.xsl	15 Sep 2004 15:18:01 -0000	1.30
***************
*** 1531,1535 ****
      <table width="100%" border="0" cellspacing="0" cellpadding="3">
        <tr>
!         <td colspan="2" class="NavBarCell1">
            <table border="0" cellpadding="0" cellspacing="3">
              <tr align="center" valign="top">
--- 1531,1535 ----
      <table width="100%" border="0" cellspacing="0" cellpadding="3">
        <tr>
!         <td colspan="2" width="70%" class="NavBarCell1">
            <table border="0" cellpadding="0" cellspacing="3">
              <tr align="center" valign="top">
***************
*** 1695,1704 ****
          <td class="NavBarCell2">
            <font size="-2">
!             <xsl:text>DETAILS: </xsl:text>
              <xsl:if test="string($selected) = 'namespace' or string($selected) = 'component'">
                <a href="#documentation">
                  <b>DOCUMENTATION</b>
                </a>
!               <xsl:text> | </xsl:text>
              </xsl:if>
              <xsl:if test="string($selected) = 'component'">
--- 1695,1704 ----
          <td class="NavBarCell2">
            <font size="-2">
!             <xsl:text disable-output-escaping="yes">DETAILS:&amp;nbsp;</xsl:text>
              <xsl:if test="string($selected) = 'namespace' or string($selected) = 'component'">
                <a href="#documentation">
                  <b>DOCUMENTATION</b>
                </a>
!               <xsl:text disable-output-escaping="yes">&amp;nbsp;|&amp;nbsp;</xsl:text>
              </xsl:if>
              <xsl:if test="string($selected) = 'component'">
***************
*** 1706,1714 ****
                  <b>NESTED</b>
                </a>
!               <xsl:text> | </xsl:text>
                <a href="#attributes">
                  <b>ATTRIBUTES</b>
                </a>
!               <xsl:text> | </xsl:text>
                <a href="#source">
                  <b>SOURCE</b>
--- 1706,1714 ----
                  <b>NESTED</b>
                </a>
!               <xsl:text disable-output-escaping="yes">&amp;nbsp;|&amp;nbsp;</xsl:text>
                <a href="#attributes">
                  <b>ATTRIBUTES</b>
                </a>
!               <xsl:text disable-output-escaping="yes">&amp;nbsp;|&amp;nbsp;</xsl:text>
                <a href="#source">
                  <b>SOURCE</b>
***************
*** 1721,1726 ****
              <a href="{concat($rootFolder, 'index.html')}" target="_top">
                <b>FRAMES</b>
!             </a>| <a href="#" target="_top">
!               <b>NO FRAMES</b>
              </a>
            </font>
--- 1721,1726 ----
              <a href="{concat($rootFolder, 'index.html')}" target="_top">
                <b>FRAMES</b>
!             </a><xsl:text disable-output-escaping="yes">&amp;nbsp;|&amp;nbsp;</xsl:text><a href="#" target="_top">
!               <b>NO<xsl:text disable-output-escaping="yes">&amp;nbsp;</xsl:text>FRAMES</b>
              </a>
            </font>

Index: model.xsl
===================================================================
RCS file: /cvsroot/xframe/xsddoc/src/net/sf/xframe/xsddoc/xslt/model.xsl,v
retrieving revision 1.21
retrieving revision 1.22
diff -C2 -d -r1.21 -r1.22
*** model.xsl	3 Sep 2004 08:04:23 -0000	1.21
--- model.xsl	15 Sep 2004 15:18:01 -0000	1.22
***************
*** 45,50 ****
    <!--
      Reference to main schema.
-   -->
    <xsl:variable name="mainSchema" select="/xs:schema"/>
    <!--
      xsddoc namespace uri.
--- 45,50 ----
    <!--
      Reference to main schema.
    <xsl:variable name="mainSchema" select="/xs:schema"/>
+   -->
    <!--
      xsddoc namespace uri.
***************
*** 68,72 ****
            </xsl:apply-templates>
          </xsl:variable>
!         <xsl:apply-templates select="/xs:schema" mode="typeModel">
            <xsl:with-param name="qname" select="$type"/>
          </xsl:apply-templates>
--- 68,72 ----
            </xsl:apply-templates>
          </xsl:variable>
!         <xsl:apply-templates select="$mainSchema" mode="typeModel">
            <xsl:with-param name="qname" select="$type"/>
          </xsl:apply-templates>
***************
*** 181,185 ****
          </xsl:variable>
          <xsl:variable name="refType">
!           <xsl:apply-templates select="/xs:schema" mode="referenceType">
              <xsl:with-param name="qname" select="$qname"/>
              <xsl:with-param name="referer" select="@type"/>
--- 181,185 ----
          </xsl:variable>
          <xsl:variable name="refType">
!           <xsl:apply-templates select="$mainSchema" mode="referenceType">
              <xsl:with-param name="qname" select="$qname"/>
              <xsl:with-param name="referer" select="@type"/>
***************
*** 257,261 ****
            </xsl:apply-templates>
          </xsl:variable>
!         <xsl:apply-templates select="/xs:schema" mode="attributeGroup">
            <xsl:with-param name="qname" select="$qname"/>
            <xsl:with-param name="prohibited" select="$prohibited"/>
--- 257,262 ----
            </xsl:apply-templates>
          </xsl:variable>
!         <xsl:message><xsl:text>process main schema </xsl:text><xsl:value-of select="$schemaLocation"/></xsl:message>
!         <xsl:apply-templates select="$mainSchema" mode="attributeGroup">
            <xsl:with-param name="qname" select="$qname"/>
            <xsl:with-param name="prohibited" select="$prohibited"/>
***************
*** 271,274 ****
--- 272,311 ----
    <!--
    -->
+   <xsl:template match="xs:schema" mode="attributeGroup">
+     <xsl:param name="qname"/>
+     <xsl:param name="prohibited" select="string('')"/>
+     <xsl:message><xsl:text>search for </xsl:text><xsl:value-of select="$qname"/></xsl:message>
+     <xsl:variable name="attributeGroupDefinition" select="key('attributeGroupDefinitions', $qname)"/>
+     <xsl:variable name="attributeGroupRedefinition" select="key('attributeGroupRedefinitions', $qname)"/>
+     <xsl:choose>
+       <xsl:when test="$attributeGroupDefinition">
+         <xsl:message><xsl:text>found group definition for </xsl:text><xsl:value-of select="$qname"/></xsl:message>
+         <xsl:apply-templates select="$attributeGroupDefinition" mode="model">
+           <xsl:with-param name="prohibited" select="$prohibited"/>
+         </xsl:apply-templates>
+       </xsl:when>
+       <xsl:when test="$attributeGroupRedefinition">
+         <xsl:message><xsl:text>found group redefinition for </xsl:text><xsl:value-of select="$qname"/></xsl:message>
+         <xsl:apply-templates select="$attributeGroupRedefinition" mode="model">
+           <xsl:with-param name="prohibited" select="$prohibited"/>
+         </xsl:apply-templates>
+       </xsl:when>
+       <xsl:otherwise>
+         <xsl:message><xsl:text>not found in this schema</xsl:text></xsl:message>
+         <xsl:for-each select="*">
+           <xsl:message><xsl:value-of select="name()"/> <xsl:value-of select="@name"/></xsl:message>
+         </xsl:for-each>
+         <xsl:for-each select="xs:include | xs:import | xs:redefine">
+           <xsl:message><xsl:text>search for </xsl:text><xsl:value-of select="$qname"/><xsl:text> in schema </xsl:text><xsl:value-of select="@schemaLocation"/></xsl:message>
+           <xsl:apply-templates select="document(@schemaLocation)/xs:schema" mode="attributeGroup">
+             <xsl:with-param name="qname" select="$qname"/>
+             <xsl:with-param name="prohibited" select="$prohibited"/>
+           </xsl:apply-templates>
+         </xsl:for-each>
+       </xsl:otherwise>
+     </xsl:choose>
+   </xsl:template>
+   <!--
+   -->
    <xsl:template match="xs:attribute" mode="model">
      <xsl:param name="prohibited" select="string('')"/>
***************
*** 343,347 ****
                  </xsl:variable>
                  <xsl:variable name="refType">
!                   <xsl:apply-templates select="/xs:schema" mode="referenceType">
                      <xsl:with-param name="qname" select="$qname"/>
                      <xsl:with-param name="referer" select="@type"/>
--- 380,384 ----
                  </xsl:variable>
                  <xsl:variable name="refType">
!                   <xsl:apply-templates select="$mainSchema" mode="referenceType">
                      <xsl:with-param name="qname" select="$qname"/>
                      <xsl:with-param name="referer" select="@type"/>
***************
*** 410,414 ****
      </xsl:variable>
      <xsl:variable name="refType">
!       <xsl:apply-templates select="/xs:schema" mode="referenceType">
          <xsl:with-param name="qname" select="$qname"/>
          <xsl:with-param name="referer" select="@base"/>
--- 447,451 ----
      </xsl:variable>
      <xsl:variable name="refType">
!       <xsl:apply-templates select="$mainSchema" mode="referenceType">
          <xsl:with-param name="qname" select="$qname"/>
          <xsl:with-param name="referer" select="@base"/>
***************
*** 579,583 ****
        </xsl:when>
        <xsl:otherwise>
!         <xsl:for-each select="xs:include | xs:import">
            <xsl:apply-templates select="document(@schemaLocation)/xs:schema" mode="attribute">
              <xsl:with-param name="qname" select="$qname"/>
--- 616,620 ----
        </xsl:when>
        <xsl:otherwise>
!         <xsl:for-each select="xs:include | xs:import | xs:redefine">
            <xsl:apply-templates select="document(@schemaLocation)/xs:schema" mode="attribute">
              <xsl:with-param name="qname" select="$qname"/>
***************
*** 618,622 ****
            </xsl:apply-templates>
          </xsl:variable>
!         <xsl:apply-templates select="/xs:schema" mode="attributesForType">
            <xsl:with-param name="qname" select="$baseType"/>
            <xsl:with-param name="prohibited" select="$newProhibited"/>
--- 655,659 ----
            </xsl:apply-templates>
          </xsl:variable>
!         <xsl:apply-templates select="$mainSchema" mode="attributesForType">
            <xsl:with-param name="qname" select="$baseType"/>
            <xsl:with-param name="prohibited" select="$newProhibited"/>
***************
*** 640,644 ****
            </xsl:when>
            <xsl:otherwise>
!             <xsl:apply-templates select="/xs:schema" mode="typeModel">
                <xsl:with-param name="qname" select="$baseType"/>
                <xsl:with-param name="prohibited" select="$newProhibited"/>
--- 677,681 ----
            </xsl:when>
            <xsl:otherwise>
!             <xsl:apply-templates select="$mainSchema" mode="typeModel">
                <xsl:with-param name="qname" select="$baseType"/>
                <xsl:with-param name="prohibited" select="$newProhibited"/>
***************
*** 673,677 ****
            <xsl:with-param name="prohibited" select="$newProhibited"/>
          </xsl:apply-templates>
!         <xsl:apply-templates select="/xs:schema" mode="attributesForType">
            <xsl:with-param name="qname" select="$baseType"/>
            <xsl:with-param name="prohibited" select="$newProhibited"/>
--- 710,714 ----
            <xsl:with-param name="prohibited" select="$newProhibited"/>
          </xsl:apply-templates>
!         <xsl:apply-templates select="$mainSchema" mode="attributesForType">
            <xsl:with-param name="qname" select="$baseType"/>
            <xsl:with-param name="prohibited" select="$newProhibited"/>
***************
*** 745,749 ****
          </xsl:variable>
          <xsl:for-each select="$superTypeDefinition/xs:complexContent/xs:*">
!           <xsl:apply-templates select="/xs:schema" mode="attributesForType">
              <xsl:with-param name="qname">
                <xsl:apply-templates select="." mode="resolve">
--- 782,786 ----
          </xsl:variable>
          <xsl:for-each select="$superTypeDefinition/xs:complexContent/xs:*">
!           <xsl:apply-templates select="$mainSchema" mode="attributesForType">
              <xsl:with-param name="qname">
                <xsl:apply-templates select="." mode="resolve">
***************
*** 757,761 ****
        <xsl:otherwise>
          <!-- not found in this schema: recurse into all imported and included schema -->
!         <xsl:for-each select="xs:import | xs:include">
            <xsl:apply-templates select="document(@schemaLocation, .)/xs:schema" mode="attributesforType">
              <xsl:with-param name="qname" select="$qname"/>
--- 794,798 ----
        <xsl:otherwise>
          <!-- not found in this schema: recurse into all imported and included schema -->
!         <xsl:for-each select="xs:import | xs:include | xs:redefine">
            <xsl:apply-templates select="document(@schemaLocation, .)/xs:schema" mode="attributesforType">
              <xsl:with-param name="qname" select="$qname"/>
***************
*** 775,779 ****
--- 812,833 ----
      <xsl:param name="occurs"/>
      <xsl:param name="prohibited" select="string('')"/>
+     <xsl:variable name="redefine" select="ancestor::*[name() = 'xs:redefine']"/>
      <xsl:choose>
+       <xsl:when test="$redefine and (string(@ref) != '')">
+         <xsl:variable name="refQName">
+           <xsl:apply-templates select="." mode="resolve">
+             <xsl:with-param name="qname" select="@ref"/>
+           </xsl:apply-templates>
+         </xsl:variable>
+         <xsl:variable name="localOccurs">
+           <xsl:apply-templates select="." mode="occurs"/>
+         </xsl:variable>
+         <xsl:apply-templates select="document($redefine/@schemaLocation, .)/xs:schema" mode="groupModel">
+           <xsl:with-param name="qname" select="$refQName"/>
+           <xsl:with-param name="occurs" select="$localOccurs"/>
+           <xsl:with-param name="prohibited" select="$prohibited"/>
+           <xsl:with-param name="group" select="."/>
+         </xsl:apply-templates>
+       </xsl:when>
        <xsl:when test="string(@ref) != ''">
          <xsl:variable name="refQName">
***************
*** 785,792 ****
            <xsl:apply-templates select="." mode="occurs"/>
          </xsl:variable>
!         <xsl:apply-templates select="/xs:schema" mode="groupModel">
            <xsl:with-param name="qname" select="$refQName"/>
            <xsl:with-param name="occurs" select="$localOccurs"/>
            <xsl:with-param name="prohibited" select="$prohibited"/>
          </xsl:apply-templates>
        </xsl:when>
--- 839,847 ----
            <xsl:apply-templates select="." mode="occurs"/>
          </xsl:variable>
!         <xsl:apply-templates select="$mainSchema" mode="groupModel">
            <xsl:with-param name="qname" select="$refQName"/>
            <xsl:with-param name="occurs" select="$localOccurs"/>
            <xsl:with-param name="prohibited" select="$prohibited"/>
+           <xsl:with-param name="group" select="."/>
          </xsl:apply-templates>
        </xsl:when>
***************
*** 800,804 ****
    </xsl:template>
    <!--
!     - Recursive collect content model of group given by qname parameter in cuttent
      - context.
      - 
--- 855,859 ----
    </xsl:template>
    <!--
!     - Recursive collect content model of group given by qname parameter in current
      - context.
      - 
***************
*** 811,832 ****
      <xsl:param name="occurs"/>
      <xsl:param name="prohibited" select="string('')"/>
!   </xsl:template>
!   <xsl:template match="xs:schema" mode="groupModelx">
!     <xsl:param name="qname"/>
!     <xsl:param name="occurs"/>
!     <xsl:param name="prohibited" select="string('')"/>
!     <xsl:variable name="groupDefinition" select="key('modelGroupDefinitions', string($qname)) | key('modelGroupRedefinitions', string($qname))"/>
!     <xsl:variable name="redefine" select="ancestor::[name(..) = 'xs:redefine']"/>
      <xsl:choose>
!       <!-- try base definition of redefine -->
!       <xsl:when test="$redefine">
!         <xsl:variable name="groupRedefineBase">
!           <xsl:apply-templates select="document($redefine/@schemaLocation)/xs:schema" mode="model">
!             <xsl:with-param name="occurs" select="$occurs"/>
!             <xsl:with-param name="prohibited" select="$prohibited"/>
!           </xsl:apply-templates>
!         </xsl:variable>
!       </xsl:when>
!       <!-- try type definition in current file -->
        <xsl:when test="$groupDefinition">
          <xsl:apply-templates select="$groupDefinition" mode="model">
--- 866,874 ----
      <xsl:param name="occurs"/>
      <xsl:param name="prohibited" select="string('')"/>
!     <xsl:param name="group"/>
!     <xsl:variable name="groupDefinition" select="key('modelGroupDefinitions', string($qname))"/>
!     <xsl:variable name="groupRedefinition" select="key('modelGroupRedefinitions', string($qname))"/>
      <xsl:choose>
!       <!-- try type definition in current file if available -->
        <xsl:when test="$groupDefinition">
          <xsl:apply-templates select="$groupDefinition" mode="model">
***************
*** 835,842 ****
          </xsl:apply-templates>
        </xsl:when>
        <xsl:otherwise>
!         <!-- not found in this schema: recurse into all imported and included schema -->
!         <xsl:for-each select="xs:import | xs:include">
!           <xsl:apply-templates select="document(@schemaLocation, .)/xs:schema" mode="model">
              <xsl:with-param name="qname" select="$qname"/>
              <xsl:with-param name="occurs" select="$occurs"/>
--- 877,895 ----
          </xsl:apply-templates>
        </xsl:when>
+       <!-- try redefined group definition in current file -->
+       <xsl:when test="$groupRedefinition">
+         <xsl:apply-templates select="$groupRedefinition" mode="model">
+           <xsl:with-param name="occurs" select="$occurs"/>
+           <xsl:with-param name="prohibited" select="$prohibited"/>
+         </xsl:apply-templates>
+       </xsl:when>
+       <!-- try local redefined group definitions 
+       <xsl:when test="xs:redefine/xs:group[@name = '']">
+       </xsl:when>
+       -->
+       <!-- not found in this schema: recurse into all imported, included or redefined schema -->
        <xsl:otherwise>
!         <xsl:for-each select="xs:import | xs:include | xs:redefine">
!           <xsl:apply-templates select="document(@schemaLocation, .)/xs:schema" mode="groupModel">
              <xsl:with-param name="qname" select="$qname"/>
              <xsl:with-param name="occurs" select="$occurs"/>
***************
*** 864,868 ****
        <xsl:otherwise>
          <!-- not found in this schema: recurse into all imported and included schema -->
!         <xsl:for-each select="xs:import | xs:include">
            <xsl:apply-templates select="document(@schemaLocation, .)/xs:schema" mode="model">
              <xsl:with-param name="qname" select="$qname"/>
--- 917,921 ----
        <xsl:otherwise>
          <!-- not found in this schema: recurse into all imported and included schema -->
!         <xsl:for-each select="xs:import | xs:include | xs:redefine">
            <xsl:apply-templates select="document(@schemaLocation, .)/xs:schema" mode="model">
              <xsl:with-param name="qname" select="$qname"/>
***************
*** 891,895 ****
        <xsl:otherwise>
          <!-- not found in this schema: recurse into all imported and included schema -->
!         <xsl:for-each select="xs:import | xs:include">
            <xsl:apply-templates select="document(@schemaLocation, .)/xs:schema" mode="model">
              <xsl:with-param name="qname" select="$qname"/>
--- 944,948 ----
        <xsl:otherwise>
          <!-- not found in this schema: recurse into all imported and included schema -->
!         <xsl:for-each select="xs:import | xs:include | xs:redefine">
            <xsl:apply-templates select="document(@schemaLocation, .)/xs:schema" mode="model">
              <xsl:with-param name="qname" select="$qname"/>
***************
*** 902,928 ****
    </xsl:template>
    <!--
-   -->
-   <xsl:template match="xs:schema" mode="attributeGroup">
-     <xsl:param name="qname"/>
-     <xsl:param name="prohibited" select="string('')"/>
-     <xsl:variable name="attributeGroupDefinition" select="key('attributeGroupDefinitions', $qname)"/>
-     <xsl:variable name="attributeGroupRedfinition" select="key('attributeGroupRedefinitions', $qname)"/>
-     <xsl:choose>
-       <xsl:when test="$attributeGroupDefinition | $attributeGroupRedfinition">
-         <xsl:apply-templates select="$attributeGroupDefinition | $attributeGroupRedfinition" mode="model">
-           <xsl:with-param name="prohibited" select="$prohibited"/>
-         </xsl:apply-templates>
-       </xsl:when>
-       <xsl:otherwise>
-         <xsl:for-each select="xs:include | xs:import">
-           <xsl:apply-templates select="document(@schemaLocation)/xs:schema" mode="attributeGroup">
-             <xsl:with-param name="qname" select="$qname"/>
-             <xsl:with-param name="prohibited" select="$prohibited"/>
-           </xsl:apply-templates>
-         </xsl:for-each>
-       </xsl:otherwise>
-     </xsl:choose>
-   </xsl:template>
-   <!--
      explicit default template for nodes.
    -->
--- 955,958 ----

Index: component.xsl
===================================================================
RCS file: /cvsroot/xframe/xsddoc/src/net/sf/xframe/xsddoc/xslt/component.xsl,v
retrieving revision 1.25
retrieving revision 1.26
diff -C2 -d -r1.25 -r1.26
*** component.xsl	3 Sep 2004 08:04:23 -0000	1.25
--- component.xsl	15 Sep 2004 15:18:01 -0000	1.26
***************
*** 57,65 ****
     Type of component to process.
    -->
!   <xsl:param name="type" select="string('simpleType')"/>
    <!--
      Name of component to process.
    -->
!   <xsl:param name="name" select="string('decimal')"/>
    <!--
      Whether to show sub types or not.
--- 57,65 ----
     Type of component to process.
    -->
!   <xsl:param name="type" select="string('element')"/>
    <!--
      Name of component to process.
    -->
!   <xsl:param name="name" select="string('schema')"/>
    <!--
      Whether to show sub types or not.
***************
*** 83,87 ****
    <xsl:param name="hideAttributes" select="string('false')"/>
    <!--
!     Reference to main schema.
    -->
    <xsl:variable name="mainSchema" select="/xs:schema"/>
--- 83,87 ----
    <xsl:param name="hideAttributes" select="string('false')"/>
    <!--
!     Reference to main schema. FIXME reactivate this
    -->
    <xsl:variable name="mainSchema" select="/xs:schema"/>



-------------------------------------------------------
This SF.Net email is sponsored by: thawte's Crypto Challenge Vl
Crack the code and win a Sony DCRHC40 MiniDV Digital Handycam
Camcorder. More prizes in the weekly Lunch Hour Challenge.
Sign up NOW http://ad.doubleclick.net/clk;10740251;10262165;m
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.