xsddoc/src/net/sf/xframe/xsddoc/xslt model.xsl,1.20,1.21 component.xsl,1.24,1.25 xmldoc.xsl,1.10,1.11 overview-namespace.xsl,1.10,1.11 xml2html.xsl,1.28,1.29 schema-index.xsl,1.11,1.12
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-serv3194/src/net/sf/xframe/xsddoc/xslt
Modified Files:
model.xsl component.xsl xmldoc.xsl overview-namespace.xsl
xml2html.xsl schema-index.xsl
Log Message:
improved support for nested components: use seperate pages for nested element declarations
Index: xmldoc.xsl
===================================================================
RCS file: /cvsroot/xframe/xsddoc/src/net/sf/xframe/xsddoc/xslt/xmldoc.xsl,v
retrieving revision 1.10
retrieving revision 1.11
diff -C2 -d -r1.10 -r1.11
*** xmldoc.xsl 6 May 2004 16:38:03 -0000 1.10
--- xmldoc.xsl 3 Sep 2004 08:04:23 -0000 1.11
***************
*** 23,26 ****
--- 23,28 ----
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
+ xmlns:doc="http://xframe.sf.net/xsddoc/doc"
+ xmlns:net.sf.xframe.xsddoc="http://xframe.sf.net/xsddoc/doc"
exclude-result-prefixes="xs" version="1.0">
<!--
***************
*** 49,53 ****
</span>
<xsl:variable name="instance" select="/xs:schema"/>
! <xsl:for-each select="@*">
<xsl:apply-templates select="$instance" mode="attributesHandler">
<xsl:with-param name="attribute" select="."/>
--- 51,55 ----
</span>
<xsl:variable name="instance" select="/xs:schema"/>
! <xsl:for-each select="@*[local-name() != 'xsddocid']">
<xsl:apply-templates select="$instance" mode="attributesHandler">
<xsl:with-param name="attribute" select="."/>
***************
*** 145,147 ****
--- 147,154 ----
</span>
</xsl:template>
+ <!--
+ ignore some attributes
+ -->
+ <xsl:template match="@doc:*">
+ </xsl:template>
</xsl:stylesheet>
Index: xml2html.xsl
===================================================================
RCS file: /cvsroot/xframe/xsddoc/src/net/sf/xframe/xsddoc/xslt/xml2html.xsl,v
retrieving revision 1.28
retrieving revision 1.29
diff -C2 -d -r1.28 -r1.29
*** xml2html.xsl 30 Aug 2004 07:13:31 -0000 1.28
--- xml2html.xsl 3 Sep 2004 08:04:23 -0000 1.29
***************
*** 729,733 ****
<!--
Format content model.
- <xsl:variable name="nestedElements" select=".//doc:element[not(@ref or @type)]"/>
-->
<xsl:template match="doc:model">
--- 729,732 ----
***************
*** 737,752 ****
<tt>
<xsl:apply-templates select="." mode="model"/>
- <xsl:variable name="nestedElements" select=".//doc:element[count(*) > 0]"/>
- <xsl:if test="$nestedElements">
- <br/>
- <br/>
- <xsl:apply-templates select="$nestedElements" mode="model"/>
- </xsl:if>
</tt>
</dd>
</dl>
<hr/>
! <br/>
<xsl:if test="doc:attribute">
<a name="attributes"/>
<table border="1" cellpadding="3" cellspacing="0" width="100%">
--- 736,762 ----
<tt>
<xsl:apply-templates select="." mode="model"/>
</tt>
</dd>
</dl>
<hr/>
! <xsl:variable name="nested" select="//doc:element"/>
! <xsl:if test="$nested">
! <br/>
! <a name="elements"/>
! <table border="1" cellpadding="3" cellspacing="0" width="100%">
! <tr bgcolor="#CCCCFF" class="TableHeadingColor">
! <td colspan="2">
! <font size="+2">
! <b>Nested Element Summary</b>
! </font>
! </td>
! </tr>
! <xsl:apply-templates select="$nested" mode="summary">
! <xsl:sort select="@name"/>
! </xsl:apply-templates>
! </table>
! </xsl:if>
<xsl:if test="doc:attribute">
+ <br/>
<a name="attributes"/>
<table border="1" cellpadding="3" cellspacing="0" width="100%">
***************
*** 762,765 ****
--- 772,777 ----
</xsl:apply-templates>
</table>
+ </xsl:if>
+ <xsl:if test="doc:attribute">
<br/>
<table border="1" cellpadding="3" cellspacing="0" width="100%">
***************
*** 882,886 ****
</xsl:template>
<!--
! Format the model.
-->
<xsl:template match="doc:attribute" mode="summary">
--- 894,898 ----
</xsl:template>
<!--
! Format the attribute summary.
-->
<xsl:template match="doc:attribute" mode="summary">
***************
*** 921,924 ****
--- 933,990 ----
</xsl:template>
<!--
+ Format the nested element summary.
+ -->
+ <xsl:template match="doc:element" mode="summary">
+ <xsl:variable name="prefix" select="substring-before(@type, ':')"/>
+ <xsl:variable name="ns" select="namespace::*[name() = $prefix]"/>
+ <tr bgcolor="white" class="TableRowColor">
+ <td align="right" valign="top" width="1">
+ <font size="-1">
+ <code>
+ <xsl:choose>
+ <xsl:when test="@type and ($ns = 'http://www.w3.org/2001/XMLSchema')">
+ <xsl:value-of select="@type"/>
+ </xsl:when>
+ <xsl:when test="@type and @href">
+ <a href="{@href}">
+ <xsl:value-of select="@type"/>
+ </a>
+ </xsl:when>
+ <xsl:when test="@type">
+ <xsl:value-of select="@type"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:text disable-output-escaping="yes">&nbsp;</xsl:text>
+ </xsl:otherwise>
+ </xsl:choose>
+ </code>
+ </font>
+ </td>
+ <td>
+ <code>
+ <xsl:choose>
+ <xsl:when test="@type and ($ns = 'http://www.w3.org/2001/XMLSchema')">
+ <xsl:value-of select="@name"/>
+ </xsl:when>
+ <xsl:when test="@name and @href">
+ <a href="{@href}">
+ <xsl:value-of select="@name"/>
+ </a>
+ </xsl:when>
+ <xsl:when test="@type">
+ <xsl:value-of select="@type"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:text disable-output-escaping="yes">&nbsp;</xsl:text>
+ </xsl:otherwise>
+ </xsl:choose>
+ </code>
+ <br/>
+ <xsl:text disable-output-escaping="yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</xsl:text>
+ <xsl:apply-templates select="doc:*[position() = 1]" mode="short-documentation"/>
+ </td>
+ </tr>
+ </xsl:template>
+ <!--
Format the model.
-->
***************
*** 1634,1639 ****
--- 1700,1709 ----
<b>DOCUMENTATION</b>
</a>
+ <xsl:text> | </xsl:text>
</xsl:if>
<xsl:if test="string($selected) = 'component'">
+ <a href="#elements">
+ <b>NESTED</b>
+ </a>
<xsl:text> | </xsl:text>
<a href="#attributes">
Index: schema-index.xsl
===================================================================
RCS file: /cvsroot/xframe/xsddoc/src/net/sf/xframe/xsddoc/xslt/schema-index.xsl,v
retrieving revision 1.11
retrieving revision 1.12
diff -C2 -d -r1.11 -r1.12
*** schema-index.xsl 5 Aug 2004 21:23:52 -0000 1.11
--- schema-index.xsl 3 Sep 2004 08:04:23 -0000 1.12
***************
*** 98,101 ****
--- 98,106 ----
<xsl:with-param name="ignore" select="$ignore"/>
</xsl:apply-templates>
+ <xsl:for-each select="xs:element | xs:complexType">
+ <xsl:apply-templates select=".//xs:element[(not (@ref)) and (not (@type))]" mode="doc">
+ <xsl:with-param name="ignore" select="$ignore"/>
+ </xsl:apply-templates>
+ </xsl:for-each>
<xsl:for-each select="xs:include | xs:redefine">
<xsl:variable name="redefinedComponents">
***************
*** 118,131 ****
<xsl:param name="ignore"/>
<xsl:if test="not(contains($ignore, concat('|', local-name(), ':', @name, '|')))">
! <doc:component type="{local-name()}" name="{@name}" href="">
<xsl:attribute name="href">
! <xsl:choose>
! <xsl:when test="contains(name(),':')">
! <xsl:value-of select="concat(substring-after(name(), ':'), '/', @name, '.html')"/>
! </xsl:when>
! <xsl:otherwise>
! <xsl:value-of select="concat(name(), '/', @name, '.html')"/>
! </xsl:otherwise>
! </xsl:choose>
</xsl:attribute>
<xsl:if test="xs:annotation/xs:documentation">
--- 123,145 ----
<xsl:param name="ignore"/>
<xsl:if test="not(contains($ignore, concat('|', local-name(), ':', @name, '|')))">
! <xsl:variable name="hierarchy">
! <xsl:apply-templates select=".." mode="parent"/>
! </xsl:variable>
! <xsl:variable name="name">
! <xsl:choose>
! <xsl:when test="string($hierarchy) != ''">
! <xsl:value-of select="concat(string($hierarchy), @name)"/>
! </xsl:when>
! <xsl:otherwise>
! <xsl:value-of select="concat(local-name(), '/', @name)"/>
! </xsl:otherwise>
! </xsl:choose>
! </xsl:variable>
! <doc:component type="{substring-before($name, '/')}">
! <xsl:attribute name="name">
! <xsl:value-of select="substring-after($name, '/')"/>
! </xsl:attribute>
<xsl:attribute name="href">
! <xsl:value-of select="concat($name, '.html')"/>
</xsl:attribute>
<xsl:if test="xs:annotation/xs:documentation">
***************
*** 141,144 ****
--- 155,185 ----
<!--
-->
+ <xsl:template match="*" mode="parent">
+ <xsl:param name="parent"/>
+ <xsl:choose>
+ <xsl:when test="local-name() = 'schema'">
+ <xsl:value-of select="$parent"/>
+ </xsl:when>
+ <xsl:when test="@name">
+ <xsl:apply-templates select=".." mode="parent">
+ <xsl:with-param name="parent">
+ <xsl:if test="local-name(..) = 'schema'">
+ <xsl:value-of select="concat(local-name(), '/')"/>
+ </xsl:if>
+ <xsl:value-of select="@name"/>
+ <xsl:text>.</xsl:text>
+ <xsl:value-of select="$parent"/>
+ </xsl:with-param>
+ </xsl:apply-templates>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:apply-templates select=".." mode="parent">
+ <xsl:with-param name="parent" select="$parent"/>
+ </xsl:apply-templates>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <!--
+ -->
<xsl:template name="tostring">
<xsl:param name="nodes"/>
Index: component.xsl
===================================================================
RCS file: /cvsroot/xframe/xsddoc/src/net/sf/xframe/xsddoc/xslt/component.xsl,v
retrieving revision 1.24
retrieving revision 1.25
diff -C2 -d -r1.24 -r1.25
*** component.xsl 30 Aug 2004 07:16:54 -0000 1.24
--- component.xsl 3 Sep 2004 08:04:23 -0000 1.25
***************
*** 24,27 ****
--- 24,28 ----
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:doc="http://xframe.sf.net/xsddoc/doc"
+ xmlns:net.sf.xframe.xsddoc="http://xframe.sf.net/xsddoc/doc"
version="1.0">
<!--
***************
*** 106,113 ****
<xsl:variable name="component" select="xs:*[@name = $name and local-name() = $type]"/>
<xsl:variable name="redefinedComponent" select="xs:redefine/xs:*[@name = $name and local-name() = $type]"/>
! <xsl:variable name="nestedComponent" select="./xs:*//*[string(@xsddocid) != '']"/>
<xsl:choose>
<xsl:when test="count($nestedComponent) > 0">
- <xsl:message>nested component: <xsl:value-of select="local-name($nestedComponent)"/>-<xsl:value-of select="$nestedComponent/@name"/>-<xsl:value-of select="count($nestedComponent)"/></xsl:message>
<xsl:apply-templates select="$nestedComponent" mode="doc"/>
</xsl:when>
--- 107,115 ----
<xsl:variable name="component" select="xs:*[@name = $name and local-name() = $type]"/>
<xsl:variable name="redefinedComponent" select="xs:redefine/xs:*[@name = $name and local-name() = $type]"/>
! <xsl:variable name="nestedComponent" select="./xs:*//*[string(@net.sf.xframe.xsddoc:xsddocid) != '']"/>
! <xsl:if test="$nestedComponent">
! </xsl:if>
<xsl:choose>
<xsl:when test="count($nestedComponent) > 0">
<xsl:apply-templates select="$nestedComponent" mode="doc"/>
</xsl:when>
Index: overview-namespace.xsl
===================================================================
RCS file: /cvsroot/xframe/xsddoc/src/net/sf/xframe/xsddoc/xslt/overview-namespace.xsl,v
retrieving revision 1.10
retrieving revision 1.11
diff -C2 -d -r1.10 -r1.11
*** overview-namespace.xsl 30 Aug 2004 07:14:02 -0000 1.10
--- overview-namespace.xsl 3 Sep 2004 08:04:23 -0000 1.11
***************
*** 116,129 ****
</xsl:when>
<xsl:otherwise>
! <xsl:value-of select="@name"/>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
! <doc:component type="{local-name()}">
<xsl:attribute name="name">
! <xsl:value-of select="$name"/>
</xsl:attribute>
<xsl:attribute name="href">
! <xsl:value-of select="concat(local-name(), '/', $name, '.html')"/>
</xsl:attribute>
</doc:component>
--- 116,129 ----
</xsl:when>
<xsl:otherwise>
! <xsl:value-of select="concat(local-name(), '/', @name)"/>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
! <doc:component type="{substring-before($name, '/')}">
<xsl:attribute name="name">
! <xsl:value-of select="substring-after($name, '/')"/>
</xsl:attribute>
<xsl:attribute name="href">
! <xsl:value-of select="concat($name, '.html')"/>
</xsl:attribute>
</doc:component>
***************
*** 141,144 ****
--- 141,147 ----
<xsl:apply-templates select=".." mode="parent">
<xsl:with-param name="parent">
+ <xsl:if test="local-name(..) = 'schema'">
+ <xsl:value-of select="concat(local-name(), '/')"/>
+ </xsl:if>
<xsl:value-of select="@name"/>
<xsl:text>.</xsl:text>
Index: model.xsl
===================================================================
RCS file: /cvsroot/xframe/xsddoc/src/net/sf/xframe/xsddoc/xslt/model.xsl,v
retrieving revision 1.20
retrieving revision 1.21
diff -C2 -d -r1.20 -r1.21
*** model.xsl 5 Aug 2004 21:23:52 -0000 1.20
--- model.xsl 3 Sep 2004 08:04:23 -0000 1.21
***************
*** 20,24 ****
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-->
! <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:doc="http://xframe.sf.net/xsddoc/doc" exclude-result-prefixes="" version="1.0">
<!--
This transformation generates XML documentation of a conent model.
--- 20,29 ----
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-->
! <xsl:stylesheet
! xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
! xmlns:xs="http://www.w3.org/2001/XMLSchema"
! xmlns:doc="http://xframe.sf.net/xsddoc/doc"
! xmlns:net.sf.xframe.xsddoc="http://xframe.sf.net/xsddoc/doc"
! exclude-result-prefixes="" version="1.0">
<!--
This transformation generates XML documentation of a conent model.
***************
*** 107,110 ****
--- 112,117 ----
</xsl:template>
<!--
+ -->
+ <!--
- Collect content model of particles.
-
***************
*** 112,116 ****
- attributes, the so called particles.</p>
-->
! <xsl:template match="xs:element | xs:any | xs:all | xs:sequence | xs:choice" mode="model">
<xsl:param name="prohibited" select="string('')"/>
<xsl:param name="occurs"/>
--- 119,123 ----
- attributes, the so called particles.</p>
-->
! <xsl:template match="xs:element[count(*) = 0] | xs:any | xs:all | xs:sequence | xs:choice" mode="model">
<xsl:param name="prohibited" select="string('')"/>
<xsl:param name="occurs"/>
***************
*** 219,222 ****
--- 226,236 ----
<xsl:with-param name="prohibited" select="$prohibited"/>
</xsl:apply-templates>
+ <xsl:if test="xs:annotation/xs:documentation">
+ <doc:documentation>
+ <xsl:for-each select="xs:annotation/xs:documentation">
+ <xsl:copy-of select="* | text()"/>
+ </xsl:for-each>
+ </doc:documentation>
+ </xsl:if>
</xsl:element>
</xsl:template>
***************
*** 401,405 ****
</xsl:apply-templates>
</xsl:variable>
! <xsl:element name="{concat('doc:', local-name())}">
<xsl:if test="string($refType) != ''">
<xsl:attribute name="href">
--- 415,419 ----
</xsl:apply-templates>
</xsl:variable>
! <xsl:element name="doc:{local-name()}">
<xsl:if test="string($refType) != ''">
<xsl:attribute name="href">
***************
*** 419,429 ****
</xsl:template>
<!--
default elements model.
-->
! <xsl:template match="xs:*" mode="model" priority="-1">
<xsl:param name="prohibited" select="string('')"/>
! <xsl:element name="{concat('doc:', local-name())}">
<xsl:apply-templates select="@*" mode="model"/>
! <xsl:apply-templates select="xs:*" mode="model">
<xsl:with-param name="prohibited" select="$prohibited"/>
</xsl:apply-templates>
--- 433,511 ----
</xsl:template>
<!--
+ nested elements.
+ -->
+ <xsl:template match="xs:element" mode="model" priority="-1">
+ <xsl:param name="prohibited" select="string('')"/>
+ <xsl:variable name="folder">
+ <xsl:call-template name="namespaceFolder">
+ <xsl:with-param name="uri" select="/xs:schema/@targetNamespace"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:element name="doc:{local-name()}">
+ <xsl:apply-templates select="@*" mode="model"/>
+ <xsl:variable name="hierarchy">
+ <xsl:apply-templates select="." mode="parent"/>
+ </xsl:variable>
+ <xsl:attribute name="href"><!-- xxxxx -->
+ <xsl:value-of select="concat('../../', $folder, '/', $hierarchy, 'html')"/>
+ </xsl:attribute>
+ <xsl:if test="xs:annotation/xs:documentation">
+ <doc:documentation>
+ <xsl:for-each select="xs:annotation/xs:documentation">
+ <xsl:copy-of select="* | text()"/>
+ </xsl:for-each>
+ </doc:documentation>
+ </xsl:if>
+ </xsl:element>
+ </xsl:template>
+ <!--
+ collect hierarchy
+ -->
+ <xsl:template match="*" mode="hierarchy">
+ <xsl:choose>
+ <xsl:when test="@name">
+ <xsl:apply-templates select=".." mode="hierarchy"/>
+ <xsl:value-of select="concat(@name, '.')"/>
+ </xsl:when>
+ <xsl:when test="local-name(.) != 'schema'">
+ <xsl:apply-templates select=".." mode="hierarchy"/>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:template>
+ <!--
+ -->
+ <xsl:template match="*" mode="parent">
+ <xsl:param name="parent"/>
+ <xsl:choose>
+ <xsl:when test="local-name() = 'schema'">
+ <xsl:value-of select="$parent"/>
+ </xsl:when>
+ <xsl:when test="@name">
+ <xsl:apply-templates select=".." mode="parent">
+ <xsl:with-param name="parent">
+ <xsl:if test="local-name(..) = 'schema'">
+ <xsl:value-of select="concat(local-name(), '/')"/>
+ </xsl:if>
+ <xsl:value-of select="@name"/>
+ <xsl:text>.</xsl:text>
+ <xsl:value-of select="$parent"/>
+ </xsl:with-param>
+ </xsl:apply-templates>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:apply-templates select=".." mode="parent">
+ <xsl:with-param name="parent" select="$parent"/>
+ </xsl:apply-templates>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <!--
default elements model.
-->
! <xsl:template match="xs:*" mode="model" priority="-2">
<xsl:param name="prohibited" select="string('')"/>
! <xsl:element name="doc:{local-name()}">
<xsl:apply-templates select="@*" mode="model"/>
! <xsl:apply-templates select="xs:annotation" mode="model">
<xsl:with-param name="prohibited" select="$prohibited"/>
</xsl:apply-templates>
***************
*** 724,734 ****
- included or imported schemas.</p>
-->
<xsl:template match="xs:schema" mode="groupModel">
<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:choose>
! <!-- found: return type definition and terminate -->
<xsl:when test="$groupDefinition">
<xsl:apply-templates select="$groupDefinition" mode="model">
--- 806,832 ----
- included or imported schemas.</p>
-->
+ <!-- XXX FIXME -->
<xsl:template match="xs:schema" mode="groupModel">
<xsl:param name="qname"/>
<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">
***************
*** 827,835 ****
</xsl:template>
<!--
- Ignore anything else in model mode.
- <xsl:template match="* | @* | text()" mode="model">
- </xsl:template>
- -->
- <!--
explicit default template for nodes.
-->
--- 925,928 ----
-------------------------------------------------------
This SF.Net email is sponsored by BEA Weblogic Workshop
FREE Java Enterprise J2EE developer tools!
Get your free copy of BEA WebLogic Workshop 8.1 today.
http://ads.osdn.com/?ad_id=5047&alloc_id=10808&op=click