--- /dev/null
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>\r
+<!--\r
+ Copyright (C) DSTC Pty Ltd (ACN 052 372 577) 2002\r
+ \r
+ The software contained on this media is the property of the\r
+ DSTC Pty Ltd. Use of this software is strictly in accordance\r
+ with the license agreement in the accompanying LICENSE file.\r
+ If your distribution of this software does not contain a\r
+ LICENSE file then you have no rights to use this software\r
+ in any manner and should contact DSTC at the address below\r
+ to determine an appropriate licensing arrangement.\r
+ \r
+ DSTC Pty Ltd\r
+ Level 7, General Purpose South \r
+ The University of Queensland\r
+ QLD 4072 Australia \r
+ Tel: +61 7 3365 4310\r
+ Fax: +61 7 3365 4311\r
+ Email: titanium_enquiries@dstc.edu.au\r
+ \r
+ This software is being provided "AS IS" without warranty of\r
+ any kind. In no event shall DSTC Pty Ltd be liable for\r
+ damage of any kind arising out of or in connection with\r
+ the use or performance of this software.\r
+-->\r
+<!-- \r
+ File:\r
+ xs3p.xsl\r
+ Description:\r
+ Stylesheet that generates XHTML documentation, given an XML \r
+ Schema document\r
+ Assumptions:\r
+ -Resulting documentation will only be displayed properly with \r
+ the latest browsers that support XHTML and CSS. Older \r
+ browsers are not supported.\r
+ -Assumed that XSD document conforms to the XSD recommendation.\r
+ No validity checking is done.\r
+ Constraints:\r
+ -Local schema components cannot contain two dashes in \r
+ 'documentation' elements within their 'annotation' element.\r
+ This is because the contents of those 'documentation' \r
+ elements are displayed in a separate window using Javascript. \r
+ This Javascript code is enclosed in comments, which do not\r
+ allow two dashes inside themselves.\r
+ Notes:\r
+ -Javascript code is placed within comments, even though in \r
+ strict XHTML, JavaScript code should be placed within CDATA \r
+ sections. This is because current browsers generate a syntax \r
+ error if the page contains CDATA sections. Placing Javascript \r
+ code within comments means that the code cannot contain two \r
+ dashes.\r
+ (See 'PrintJSCode' named template.)\r
+ Stylesheet Sections:\r
+ -Global Parameters\r
+ Specify parameters that can be set externally to customise \r
+ stylesheet\r
+ -Constants\r
+ Constants used by the stylesheet\r
+ -Main Document\r
+ Templates to generate the overall document and the top-level \r
+ sections within it\r
+ -Hierarchy table\r
+ Templates for displaying type hierarchy for simple and \r
+ complex types, and substitution group hierarchy for elements\r
+ -Properties table\r
+ Templates for displaying the properties of top-level schema \r
+ components\r
+ -XML Instance Representation table\r
+ Templates for displaying how an XML instance conforming to \r
+ the schema component would look like\r
+ -Schema Component Representation table\r
+ Templates for displaying the XML representation of the schema\r
+ component\r
+ -XML Pretty Printer\r
+ Templates for displaying arbitrary XML instances\r
+ -Handling Schema Component References\r
+ Templates for generating internal and external links\r
+ -General Utility Templates\r
+ General templates used by other templates in this stylesheet\r
+ To Do List:\r
+ -It is not clever when printing out element and attribute \r
+ wildcards in the XML Instance Representation tables. It prints \r
+ out all wildcards, rather than working out the actual wildcard \r
+ is from multiple wildcard instances.\r
+ -Same as above for simple type constraints, e.g. it doesn't \r
+ summarise multiple pattern constraints.\r
+-->\r
+<xsl:stylesheet \r
+ xmlns:xsl="http://www.w3.org/1999/XSL/Transform" \r
+ xmlns="http://www.w3.org/1999/xhtml" \r
+ xmlns:html="http://www.w3.org/1999/xhtml" \r
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema" \r
+ xmlns:ppp="http://titanium.dstc.edu.au/xml/xs3p" \r
+ version="1.0" \r
+ exclude-result-prefixes="xsd ppp html">\r
+\r
+ <xsl:output \r
+ method="xml" \r
+ encoding="ISO-8859-1"\r
+ standalone="yes"\r
+ version="1.0"\r
+ doctype-public="-//W3C//DTD XHTML 1.0 Strict//EN" \r
+ doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd" \r
+ indent="yes"/>\r
+\r
+ <xsl:key name="type" match="/xsd:schema/xsd:complexType | /xsd:schema/xsd:simpleType | /xsd:schema/xsd:redefine/xsd:complexType | /xsd:schema/xsd:redefine/xsd:simpleType" use="@name" />\r
+ <xsl:key name="complexType" match="/xsd:schema/xsd:complexType | /xsd:schema/xsd:redefine/xsd:complexType" use="@name" />\r
+ <xsl:key name="simpleType" match="/xsd:schema/xsd:simpleType | /xsd:schema/xsd:redefine/xsd:simpleType" use="@name" />\r
+ <xsl:key name="attributeGroup" match="/xsd:schema/xsd:attributeGroup | /xsd:schema/xsd:redefine/xsd:attributeGroup" use="@name" />\r
+ <xsl:key name="group" match="/xsd:schema/xsd:group | /xsd:schema/xsd:redefine/xsd:group" use="@name" />\r
+ <xsl:key name="attribute" match="/xsd:schema/xsd:attribute" use="@name" />\r
+ <xsl:key name="element" match="/xsd:schema/xsd:element" use="@name" />\r
+\r
+ <!-- ******** Global Parameters ******** -->\r
+\r
+ <!-- Title of XHTML document. -->\r
+ <xsl:param name="title"></xsl:param>\r
+\r
+ <!-- If 'true', sorts the top-level schema components by type, \r
+ then name. Otherwise, displays the components by the order that \r
+ they appear in the schema. -->\r
+ <xsl:param name="sortByComponent">true</xsl:param>\r
+\r
+ <!-- If 'true', XHTML document uses JavaScript for added\r
+ functionality, such as pop-up windows and information-\r
+ hiding.\r
+ Otherwise, XHTML document does not use JavaScript. -->\r
+ <xsl:param name="useJavaScript">true</xsl:param>\r
+\r
+ <!-- If 'true', prints all super-types in the\r
+ type hierarchy box.\r
+ Otherwise, prints the parent type only in the\r
+ type hierarchy box. -->\r
+ <xsl:param name="printAllSuperTypes">true</xsl:param>\r
+\r
+ <!-- If 'true', prints all sub-types in the\r
+ type hierarchy box.\r
+ Otherwise, prints the direct sub-types only in the\r
+ type hierarchy box. -->\r
+ <xsl:param name="printAllSubTypes">true</xsl:param>\r
+\r
+ <!-- If 'true', prints out the Glossary section. -->\r
+ <xsl:param name="printGlossary">true</xsl:param>\r
+\r
+ <!-- If 'true', prints out the Legend section. -->\r
+ <xsl:param name="printLegend">true</xsl:param>\r
+\r
+ <!-- If 'true', prints prefix matching namespace of schema\r
+ components in XML Instance Representation tables. -->\r
+ <xsl:param name="printNSPrefixes">true</xsl:param>\r
+\r
+ <!-- If 'true', searches 'included' schemas for schema components \r
+ when generating links and XML Instance Representation tables. -->\r
+ <xsl:param name="searchIncludedSchemas">false</xsl:param>\r
+\r
+ <!-- If 'true', searches 'imported' schemas for schema components \r
+ when generating links and XML Instance Representation tables. -->\r
+ <xsl:param name="searchImportedSchemas">false</xsl:param>\r
+\r
+ <!-- File containing the mapping from file locations of external \r
+ (e.g. included, imported, refined) schemas to file locations \r
+ of their XHTML documentation. -->\r
+ <xsl:param name="linksFile"></xsl:param>\r
+ \r
+ <!-- Set the base URL for resolving links. -->\r
+ <xsl:param name="baseURL"></xsl:param>\r
+ \r
+ <!-- Uses an external CSS stylesheet rather than using \r
+ internally-declared CSS properties. -->\r
+ <xsl:param name="externalCSSURL"></xsl:param>\r
+\r
+\r
+ <!-- ******** Constants ******** -->\r
+\r
+ <!-- XML Schema Namespace -->\r
+ <xsl:variable name="XSD_NS">http://www.w3.org/2001/XMLSchema</xsl:variable>\r
+\r
+ <!-- XML Namespace -->\r
+ <xsl:variable name="XML_NS">http://www.w3.org/XML/1998/namespace</xsl:variable>\r
+\r
+ <!-- Number of 'em' to indent from parent element's start tag to\r
+ child element's start tag -->\r
+ <xsl:variable name="ELEM_INDENT">1.5</xsl:variable>\r
+\r
+ <!-- Number of 'em' to indent from parent element's start tag to\r
+ attribute's tag -->\r
+ <xsl:variable name="ATTR_INDENT">0.5</xsl:variable>\r
+\r
+ <!-- Title to use if none provided -->\r
+ <xsl:variable name="DEFAULT_TITLE">XML Schema Documentation</xsl:variable>\r
+\r
+ <!-- Prefixes used for anchor names -->\r
+ <!-- Type definitions -->\r
+ <xsl:variable name="TYPE_PREFIX">type_</xsl:variable>\r
+ <!-- Attribute declarations -->\r
+ <xsl:variable name="ATTR_PREFIX">attribute_</xsl:variable>\r
+ <!-- Attribute group definitions -->\r
+ <xsl:variable name="ATTR_GRP_PREFIX">attributeGroup_</xsl:variable>\r
+ <!-- Complex type definitions -->\r
+ <xsl:variable name="CTYPE_PREFIX" select="$TYPE_PREFIX"/>\r
+ <!-- Element declarations -->\r
+ <xsl:variable name="ELEM_PREFIX">element_</xsl:variable>\r
+ <!-- Key definitions -->\r
+ <xsl:variable name="KEY_PREFIX">key_</xsl:variable>\r
+ <!-- Group definitions -->\r
+ <xsl:variable name="GRP_PREFIX">group_</xsl:variable>\r
+ <!-- Notations -->\r
+ <xsl:variable name="NOTA_PREFIX">notation_</xsl:variable>\r
+ <!-- Namespace declarations -->\r
+ <xsl:variable name="NS_PREFIX">ns_</xsl:variable>\r
+ <!-- Simple type definitions -->\r
+ <xsl:variable name="STYPE_PREFIX" select="$TYPE_PREFIX"/>\r
+ <!-- Glossary terms -->\r
+ <xsl:variable name="TERM_PREFIX">term_</xsl:variable>\r
+\r
+ <!-- The original schema needs to be stored because when\r
+ calculating links for references, the links have to be\r
+ relative to the original schema. See 'PrintCompRef'\r
+ template. -->\r
+ <xsl:variable name="ORIGINAL_SCHEMA" select="/xsd:schema"/>\r
+\r
+ <!-- ******** Main Document ******** -->\r
+\r
+ <!--\r
+ Main template that starts the process\r
+ -->\r
+ <xsl:template match="/xsd:schema">\r
+ <!-- Check that links file is provided if searching external\r
+ schemas for components. -->\r
+ <xsl:if test="$linksFile='' and (normalize-space(translate($searchIncludedSchemas, 'TRUE', 'true'))='true' or normalize-space(translate($searchImportedSchemas, 'TRUE', 'true'))='true')">\r
+ <xsl:call-template name="HandleError">\r
+ <xsl:with-param name="isTerminating">true</xsl:with-param>\r
+ <xsl:with-param name="errorMsg">\r
+'linksFile' variable must be provided if either \r
+'searchIncludedSchemas' or 'searchImportedSchemas' is true.\r
+ </xsl:with-param>\r
+ </xsl:call-template>\r
+ </xsl:if>\r
+\r
+ <!-- Get title of document -->\r
+ <xsl:variable name="actualTitle">\r
+ <xsl:choose>\r
+ <xsl:when test="$title != ''">\r
+ <xsl:value-of select="$title"/>\r
+ </xsl:when>\r
+ <xsl:otherwise>\r
+ <xsl:value-of select="$DEFAULT_TITLE"/>\r
+ </xsl:otherwise>\r
+ </xsl:choose>\r
+ </xsl:variable>\r
+\r
+ <html>\r
+ <head>\r
+ <!-- Set title bar -->\r
+ <title><xsl:value-of select="$actualTitle"/></title>\r
+\r
+ <!-- Set content type -->\r
+ <meta http-equiv="Content-Type" content="text/xml; charset=iso-8859-1"/>\r
+\r
+ <!-- Set base URL to use in working out relative paths -->\r
+ <xsl:if test="$baseURL != ''">\r
+ <xsl:element name="base">\r
+ <xsl:attribute name="href"><xsl:value-of select="$baseURL"/></xsl:attribute> \r
+ </xsl:element>\r
+ </xsl:if>\r
+\r
+ <!-- Set CSS styles -->\r
+ <style type="text/css">\r
+ <xsl:choose>\r
+ <!-- Use external CSS stylesheet -->\r
+ <xsl:when test="$externalCSSURL != ''">\r
+ <xsl:text>\r
+@import url(</xsl:text><xsl:value-of select="$externalCSSURL"/><xsl:text>);\r
+</xsl:text>\r
+ </xsl:when>\r
+ <!-- Use internal CSS styles -->\r
+ <xsl:otherwise>\r
+ <xsl:call-template name="DocumentCSSStyles"/>\r
+ </xsl:otherwise>\r
+ </xsl:choose>\r
+ </style>\r
+\r
+ <!-- Add Javascript code to make the collapseable boxes work -->\r
+ <xsl:if test="normalize-space(translate($useJavaScript,'TRUE','true'))='true'">\r
+ <xsl:call-template name="PrintJSCode">\r
+ <xsl:with-param name="code">\r
+ <xsl:call-template name="DocumentJSCode"/>\r
+ </xsl:with-param>\r
+ </xsl:call-template>\r
+ </xsl:if>\r
+ </head>\r
+ <body>\r
+ <!-- Title -->\r
+ <h1><a name="top"><xsl:value-of select="$actualTitle"/></a></h1>\r
+\r
+ <!-- Buttons for displaying printer-friendly version, and\r
+ expanding and collapsing all boxes -->\r
+ <xsl:call-template name="GlobalControlButtons"/>\r
+\r
+ <!-- Section: Table of Contents -->\r
+ <h2>Table of Contents</h2>\r
+ <xsl:apply-templates select="." mode="toc"/>\r
+ <xsl:call-template name="SectionFooter"/>\r
+\r
+ <!-- Section: Schema Document Properties -->\r
+ <h2><a name="SchemaProperties">Schema Document Properties</a></h2>\r
+ <!-- Sub-section: Properties table -->\r
+ <xsl:apply-templates select="." mode="properties"/>\r
+ <!-- Sub-section: Namespace Legend -->\r
+ <h3>Declared Namespaces</h3>\r
+ <xsl:apply-templates select="." mode="namespaces"/>\r
+ <!-- Sub-section: Schema Component Representation table -->\r
+ <xsl:call-template name="SchemaComponentTable">\r
+ <xsl:with-param name="component" select="."/>\r
+ </xsl:call-template>\r
+ <xsl:call-template name="SectionFooter"/>\r
+\r
+ <!-- Section: Redefined Schema Components -->\r
+ <xsl:if test="xsd:redefine">\r
+ <h2><a name="Redefinitions">Redefined Schema Components</a></h2>\r
+ <xsl:apply-templates select="xsd:redefine/xsd:simpleType | xsd:redefine/xsd:complexType | xsd:redefine/xsd:attributeGroup | xsd:redefine/xsd:group" mode="topSection"/>\r
+ </xsl:if>\r
+\r
+ <!-- Sections: Top-level Schema Components -->\r
+ <xsl:choose>\r
+ <!-- Sort schema components -->\r
+ <xsl:when test="normalize-space(translate($sortByComponent,'TRUE','true'))='true'">\r
+ <!-- Declarations -->\r
+ <xsl:if test="xsd:attribute or xsd:element">\r
+ <h2><a name="SchemaDeclarations">Global Declarations</a></h2>\r
+ <xsl:apply-templates select="xsd:attribute | xsd:element" mode="topSection">\r
+ <xsl:sort select="local-name(.)" order="ascending"/>\r
+ <xsl:sort select="@name" order="ascending"/>\r
+ </xsl:apply-templates>\r
+ </xsl:if>\r
+ <!-- Definitions -->\r
+ <xsl:if test="xsd:attributeGroup or xsd:complexType or xsd:group or xsd:notation or xsd:simpleType">\r
+ <h2><a name="SchemaDefinitions">Global Definitions</a></h2>\r
+ <xsl:apply-templates select="xsd:attributeGroup | xsd:complexType | xsd:group | xsd:notation | xsd:simpleType" mode="topSection">\r
+ <xsl:sort select="local-name(.)" order="ascending"/>\r
+ <xsl:sort select="@name" order="ascending"/>\r
+ </xsl:apply-templates>\r
+ </xsl:if>\r
+ </xsl:when>\r
+ <!-- Display schema components as they occur -->\r
+ <xsl:otherwise>\r
+ <h2><a name="SchemaComponents">Global Schema Components</a></h2>\r
+ <xsl:apply-templates select="xsd:attribute | xsd:attributeGroup | xsd:complexType | xsd:element | xsd:group | xsd:notation | xsd:simpleType" mode="topSection"/>\r
+ </xsl:otherwise>\r
+ </xsl:choose>\r
+\r
+ <!-- Section: Legend -->\r
+ <xsl:if test="normalize-space(translate($printLegend,'TRUE','true'))='true'">\r
+ <div id="legend">\r
+ <h2><a name="Legend">Legend</a></h2>\r
+ <xsl:call-template name="Legend"/>\r
+ <xsl:call-template name="SectionFooter"/>\r
+ </div>\r
+ </xsl:if>\r
+\r
+ <!-- Section: Glossary -->\r
+ <xsl:if test="normalize-space(translate($printGlossary,'TRUE','true'))='true'">\r
+ <div id="glossary">\r
+ <h2><a name="Glossary">Glossary</a></h2>\r
+ <xsl:call-template name="Glossary"/>\r
+ <xsl:call-template name="SectionFooter"/>\r
+ </div>\r
+ </xsl:if>\r
+\r
+ <!-- Document Footer -->\r
+ <p class="footer">\r
+ <xsl:text>Generated by </xsl:text>\r
+ <a href="http://xml.fiforms.org/xs3p/">xs3p</a> (<a href="http://titanium.dstc.edu.au/xml/xs3p">old link</a>)\r
+ <xsl:text>.</xsl:text>\r
+ <xsl:if test="normalize-space(translate($useJavaScript,'TRUE','true'))='true'">\r
+ <xsl:text> Last modified: </xsl:text>\r
+ <xsl:call-template name="PrintJSCode">\r
+ <xsl:with-param name="code">document.write(document.lastModified);</xsl:with-param>\r
+ </xsl:call-template>\r
+ </xsl:if>\r
+ </p>\r
+ </body>\r
+ </html>\r
+ </xsl:template>\r
+\r
+ <!--\r
+ Prints out the table of Declared Namespaces for the\r
+ current schema.\r
+ -->\r
+ <xsl:template match="xsd:schema" mode="namespaces">\r
+ <table class="namespaces">\r
+ <tr>\r
+ <th>Prefix</th>\r
+ <th>Namespace</th>\r
+ </tr>\r
+ <!-- Default namespace (no prefix) -->\r
+ <xsl:if test="namespace::*[local-name(.)='']">\r
+ <xsl:variable name="ns" select="namespace::*[local-name(.)='']"/>\r
+ <tr>\r
+ <td>\r
+ <a name="{$NS_PREFIX}">Default namespace</a>\r
+ </td>\r
+ <td>\r
+ <xsl:choose>\r
+ <xsl:when test="/xsd:schema/@targetNamespace and $ns=normalize-space(/xsd:schema/@targetNamespace)">\r
+ <span class="targetNS">\r
+ <xsl:value-of select="$ns"/>\r
+ </span>\r
+ </xsl:when>\r
+ <xsl:otherwise>\r
+ <xsl:value-of select="$ns"/>\r
+ </xsl:otherwise>\r
+ </xsl:choose>\r
+ </td>\r
+ </tr>\r
+ </xsl:if>\r
+ <!-- Namespaces with prefixes -->\r
+ <xsl:for-each select="namespace::*[local-name(.)!='']">\r
+ <xsl:variable name="prefix" select="local-name(.)"/>\r
+ <xsl:variable name="ns" select="."/>\r
+ <tr>\r
+ <td>\r
+ <a name="{concat($NS_PREFIX, $prefix)}">\r
+ <xsl:value-of select="$prefix"/>\r
+ </a>\r
+ </td>\r
+ <td>\r
+ <xsl:choose>\r
+ <xsl:when test="/xsd:schema/@targetNamespace and $ns=normalize-space(/xsd:schema/@targetNamespace)">\r
+ <span class="targetNS">\r
+ <xsl:value-of select="$ns"/>\r
+ </span>\r
+ </xsl:when>\r
+ <xsl:otherwise>\r
+ <xsl:value-of select="$ns"/>\r
+ </xsl:otherwise>\r
+ </xsl:choose>\r
+ </td>\r
+ </tr>\r
+ </xsl:for-each>\r
+ </table>\r
+ </xsl:template>\r
+\r
+ <!--\r
+ Prints out the Table of Contents.\r
+ -->\r
+ <xsl:template match="xsd:schema" mode="toc">\r
+ <ul>\r
+ <!-- Section: Schema Document Properties -->\r
+ <li>\r
+ <a href="#SchemaProperties">Schema Document Properties</a>\r
+ </li>\r
+\r
+ <!-- Section: Redefined Schema Components -->\r
+ <xsl:if test="xsd:redefine">\r
+ <li>\r
+ <a href="#Redefinitions">Redefined Schema Components</a>\r
+ </li>\r
+ </xsl:if>\r
+\r
+ <!-- Sections: Top-level Schema Components -->\r
+ <xsl:choose>\r
+ <!-- Sort schema components -->\r
+ <xsl:when test="normalize-space(translate($sortByComponent,'TRUE','true'))='true'">\r
+ <!-- Declarations -->\r
+ <xsl:if test="xsd:attribute or xsd:element">\r
+ <li><a href="#SchemaDeclarations">Global Declarations</a>\r
+ <ul>\r
+ <xsl:apply-templates select="xsd:attribute | xsd:element" mode="toc">\r
+ <xsl:sort select="local-name(.)" order="ascending"/>\r
+ <xsl:sort select="@name" order="ascending"/>\r
+ </xsl:apply-templates>\r
+ </ul>\r
+ </li>\r
+ </xsl:if>\r
+ <!-- Definitions -->\r
+ <xsl:if test="xsd:attributeGroup or xsd:complexType or xsd:group or xsd:notation or xsd:simpleType">\r
+ <li><a href="#SchemaDefinitions">Global Definitions</a>\r
+ <ul>\r
+ <xsl:apply-templates select="xsd:attributeGroup | xsd:complexType | xsd:group | xsd:notation | xsd:simpleType" mode="toc">\r
+ <xsl:sort select="local-name(.)" order="ascending"/>\r
+ <xsl:sort select="@name" order="ascending"/>\r
+ </xsl:apply-templates>\r
+ </ul>\r
+ </li>\r
+ </xsl:if>\r
+ </xsl:when>\r
+ <!-- Display schema components in order as they appear in schema -->\r
+ <xsl:otherwise>\r
+ <li><a href="#SchemaComponents">Global Schema Components</a>\r
+ <ul>\r
+ <xsl:apply-templates select="xsd:attribute | xsd:attributeGroup | xsd:complexType | xsd:element | xsd:group | xsd:notation | xsd:simpleType" mode="toc"/>\r
+ </ul>\r
+ </li>\r
+ </xsl:otherwise>\r
+ </xsl:choose>\r
+ </ul>\r
+\r
+ <!-- Section: Legend -->\r
+ <xsl:if test="normalize-space(translate($printLegend,'TRUE','true'))='true'">\r
+ <ul id="legendTOC" style="margin-top: 0em">\r
+ <li><a href="#Legend">Legend</a></li>\r
+ </ul>\r
+ </xsl:if>\r
+\r
+ <!-- Section: Glossary -->\r
+ <xsl:if test="normalize-space(translate($printGlossary,'TRUE','true'))='true'">\r
+ <ul id="glossaryTOC" style="margin-top: 0em">\r
+ <li><a href="#Glossary">Glossary</a></li>\r
+ </ul>\r
+ </xsl:if>\r
+ </xsl:template>\r
+\r
+ <!--\r
+ Prints out a link to a top-level schema component section in the\r
+ Table of Contents.\r
+ -->\r
+ <xsl:template match="xsd:*[@name]" mode="toc">\r
+ <xsl:variable name="componentID">\r
+ <xsl:call-template name="GetComponentID">\r
+ <xsl:with-param name="component" select="."/>\r
+ </xsl:call-template>\r
+ </xsl:variable>\r
+\r
+ <li>\r
+ <a href="#{$componentID}">\r
+ <xsl:call-template name="GetComponentDescription">\r
+ <xsl:with-param name="component" select="."/>\r
+ </xsl:call-template>\r
+ <xsl:text>: </xsl:text>\r
+ <strong><xsl:value-of select="@name"/></strong>\r
+ </a>\r
+ </li>\r
+ </xsl:template>\r
+\r
+ <!--\r
+ Prints out the section for a top-level schema component.\r
+ -->\r
+ <xsl:template match="xsd:*[@name]" mode="topSection">\r
+ <!-- Header -->\r
+ <xsl:call-template name="ComponentSectionHeader">\r
+ <xsl:with-param name="component" select="."/>\r
+ </xsl:call-template>\r
+\r
+ <!-- Hierarchy table (for types and elements) -->\r
+ <xsl:apply-templates select="." mode="hierarchy"/>\r
+\r
+ <!-- Properties table -->\r
+ <xsl:apply-templates select="." mode="properties"/>\r
+\r
+ <!-- XML Instance Representation table -->\r
+ <xsl:call-template name="SampleInstanceTable">\r
+ <xsl:with-param name="component" select="."/>\r
+ </xsl:call-template>\r
+\r
+ <!-- Schema Component Representation table -->\r
+ <xsl:call-template name="SchemaComponentTable">\r
+ <xsl:with-param name="component" select="."/>\r
+ </xsl:call-template>\r
+\r
+ <!-- Footer -->\r
+ <xsl:call-template name="SectionFooter"/>\r
+ </xsl:template>\r
+\r
+ <!--\r
+ Prints out the buttons that can expand and collapse all boxes in\r
+ this page.\r
+ -->\r
+ <xsl:template name="GlobalControlButtons">\r
+ <xsl:if test="normalize-space(translate($useJavaScript,'TRUE','true'))='true'">\r
+ <div style="float: right;">\r
+ <!-- Printer-friendly Version -->\r
+ <div id="printerControls" style="display:none;">\r
+ <input type="checkbox" onclick="displayMode(this.checked)"/>\r
+ <xsl:text>Printer-friendly Version</xsl:text>\r
+ </div>\r
+ <xsl:call-template name="PrintJSCode">\r
+ <xsl:with-param name="code">\r
+var pc = getElementObject("printerControls");\r
+if (pc != null) {\r
+ pc.style.display="block";\r
+}\r
+ </xsl:with-param>\r
+ </xsl:call-template>\r
+\r
+ <!-- Expand/Collapse All buttons -->\r
+ <div id="globalControls" style="display:none">\r
+ <strong>XML Instance Representation:</strong><br/>\r
+ <span style="margin-left: 1em; white-space: nowrap">\r
+ <xsl:text>[ </xsl:text>\r
+ <a href="javascript:void(0)" onclick="expandAll(xiBoxes)">Expand All</a>\r
+ <xsl:text> | </xsl:text>\r
+ <a href="javascript:void(0)" onclick="collapseAll(xiBoxes)">Collapse All</a>\r
+ <xsl:text> ]</xsl:text>\r
+ </span><br/><br/>\r
+ <strong>Schema Component Representation:</strong><br/>\r
+ <span style="margin-left: 1em; white-space: nowrap">\r
+ <xsl:text>[ </xsl:text>\r
+ <a href="javascript:void(0)" onclick="expandAll(scBoxes)">Expand All</a>\r
+ <xsl:text> | </xsl:text>\r
+ <a href="javascript:void(0)" onclick="collapseAll(scBoxes)">Collapse All</a>\r
+ <xsl:text> ]</xsl:text>\r
+ </span>\r
+ </div>\r
+ <xsl:call-template name="PrintJSCode">\r
+ <xsl:with-param name="code">\r
+var gc = getElementObject("globalControls");\r
+if (gc != null) {\r
+ gc.style.display="block";\r
+}\r
+ </xsl:with-param>\r
+ </xsl:call-template>\r
+ </div>\r
+ </xsl:if>\r
+ </xsl:template>\r
+\r
+ <!--\r
+ Prints out the section header of a top-level schema component.\r
+ Param(s):\r
+ component (Node) required\r
+ Top-level schema component\r
+ -->\r
+ <xsl:template name="ComponentSectionHeader">\r
+ <xsl:param name="component"/>\r
+\r
+ <xsl:variable name="componentID">\r
+ <xsl:call-template name="GetComponentID">\r
+ <xsl:with-param name="component" select="$component"/>\r
+ </xsl:call-template>\r
+ </xsl:variable>\r
+ <xsl:variable name="componentDescription">\r
+ <xsl:call-template name="GetComponentDescription">\r
+ <xsl:with-param name="component" select="$component"/>\r
+ </xsl:call-template>\r
+ </xsl:variable>\r
+ <xsl:variable name="componentTermRef">\r
+ <xsl:call-template name="GetComponentTermRef">\r
+ <xsl:with-param name="component" select="$component"/>\r
+ </xsl:call-template>\r
+ </xsl:variable>\r
+\r
+ <h3>\r
+ <!-- Description -->\r
+ <xsl:choose>\r
+ <xsl:when test="$componentTermRef != ''">\r
+ <xsl:call-template name="PrintGlossaryTermRef">\r
+ <xsl:with-param name="code" select="$componentTermRef"/>\r
+ <xsl:with-param name="term" select="$componentDescription"/>\r
+ </xsl:call-template>\r
+ </xsl:when>\r
+ <xsl:otherwise>\r
+ <xsl:value-of select="$componentDescription"/>\r
+ </xsl:otherwise>\r
+ </xsl:choose>\r
+ <xsl:text>: </xsl:text>\r
+ <!-- Name -->\r
+ <a name="{$componentID}" class="name">\r
+ <xsl:value-of select="$component/@name"/>\r
+ </a>\r
+ </h3>\r
+ </xsl:template>\r
+\r
+ <!-- \r
+ Prints out footer for top-level sections. \r
+ -->\r
+ <xsl:template name="SectionFooter">\r
+ <!-- Link to top of page-->\r
+ <div style="text-align: right; clear: both;"><a href="#top">top</a></div>\r
+ <hr/>\r
+ </xsl:template>\r
+\r
+ <!-- \r
+ Java Script code required by the entire HTML document.\r
+ -->\r
+ <xsl:template name="DocumentJSCode">\r
+ <!-- Get all IDs of XML Instance Representation boxes\r
+ and place them in an array. -->\r
+ <xsl:text>/* IDs of XML Instance Representation boxes */\r
+</xsl:text>\r
+ <xsl:text>var xiBoxes = new Array(</xsl:text>\r
+ <xsl:for-each select="/xsd:schema/xsd:*[@name]">\r
+ <xsl:if test="position()!=1">\r
+ <xsl:text>, </xsl:text>\r
+ </xsl:if>\r
+ <xsl:text>'</xsl:text>\r
+ <xsl:call-template name="GetComponentID">\r
+ <xsl:with-param name="component" select="."/>\r
+ </xsl:call-template>\r
+ <xsl:text>_xibox'</xsl:text>\r
+ </xsl:for-each>\r
+ <xsl:text>);\r
+</xsl:text>\r
+ <!-- Get all IDs of Schema Component Representation boxes\r
+ and place them in an array. -->\r
+ <xsl:text>/* IDs of Schema Component Representation boxes */\r
+</xsl:text>\r
+ <xsl:text>var scBoxes = new Array('schema_scbox'</xsl:text>\r
+ <xsl:for-each select="/xsd:schema/xsd:*[@name]">\r
+ <xsl:text>, '</xsl:text>\r
+ <xsl:call-template name="GetComponentID">\r
+ <xsl:with-param name="component" select="."/>\r
+ </xsl:call-template>\r
+ <xsl:text>_scbox'</xsl:text>\r
+ </xsl:for-each>\r
+ <xsl:text>);\r
+</xsl:text>\r
+ <!-- Functions -->\r
+ <xsl:text>\r
+/**\r
+ * Can get the ID of the button controlling\r
+ * a collapseable box by concatenating\r
+ * this string onto the ID of the box itself.\r
+ */\r
+var B_SFIX = "_button";\r
+\r
+/**\r
+ * Counter of documentation windows\r
+ * Used to give each window a unique name\r
+ */\r
+var windowCount = 0;\r
+\r
+/**\r
+ * Returns an element in the current HTML document.\r
+ * \r
+ * @param elementID Identifier of HTML element\r
+ * @return HTML element object\r
+ */\r
+function getElementObject(elementID) {\r
+ var elemObj = null;\r
+ if (document.getElementById) {\r
+ elemObj = document.getElementById(elementID);\r
+ }\r
+ return elemObj;\r
+} \r
+\r
+/**\r
+ * Closes a collapseable box.\r
+ * \r
+ * @param boxObj Collapseable box\r
+ * @param buttonObj Button controlling box\r
+ */\r
+function closeBox(boxObj, buttonObj) {\r
+ if (boxObj == null || buttonObj == null) {\r
+ // Box or button not found\r
+ } else {\r
+ // Change 'display' CSS property of box\r
+ boxObj.style.display="none";\r
+\r
+ // Change text of button \r
+ if (boxObj.style.display=="none") {\r
+ buttonObj.value=" + ";\r
+ }\r
+ }\r
+}\r
+\r
+/**\r
+ * Opens a collapseable box.\r
+ * \r
+ * @param boxObj Collapseable box\r
+ * @param buttonObj Button controlling box\r
+ */\r
+function openBox(boxObj, buttonObj) {\r
+ if (boxObj == null || buttonObj == null) {\r
+ // Box or button not found\r
+ } else {\r
+ // Change 'display' CSS property of box\r
+ boxObj.style.display="block";\r
+\r
+ // Change text of button\r
+ if (boxObj.style.display=="block") {\r
+ buttonObj.value=" - ";\r
+ }\r
+ }\r
+}\r
+\r
+/**\r
+ * Sets the state of a collapseable box.\r
+ * \r
+ * @param boxID Identifier of box\r
+ * @param open If true, box is "opened",\r
+ * Otherwise, box is "closed".\r
+ */\r
+function setState(boxID, open) {\r
+ var boxObj = getElementObject(boxID);\r
+ var buttonObj = getElementObject(boxID+B_SFIX);\r
+ if (boxObj == null || buttonObj == null) {\r
+ // Box or button not found\r
+ } else if (open) {\r
+ openBox(boxObj, buttonObj);\r
+ // Make button visible\r
+ buttonObj.style.display="inline";\r
+ } else {\r
+ closeBox(boxObj, buttonObj);\r
+ // Make button visible\r
+ buttonObj.style.display="inline";\r
+ }\r
+}\r
+\r
+/**\r
+ * Switches the state of a collapseable box, e.g.\r
+ * if it's opened, it'll be closed, and vice versa.\r
+ * \r
+ * @param boxID Identifier of box\r
+ */\r
+function switchState(boxID) {\r
+ var boxObj = getElementObject(boxID);\r
+ var buttonObj = getElementObject(boxID+B_SFIX);\r
+ if (boxObj == null || buttonObj == null) {\r
+ // Box or button not found\r
+ } else if (boxObj.style.display=="none") {\r
+ // Box is closed, so open it\r
+ openBox(boxObj, buttonObj);\r
+ } else if (boxObj.style.display=="block") {\r
+ // Box is opened, so close it\r
+ closeBox(boxObj, buttonObj);\r
+ }\r
+}\r
+\r
+/**\r
+ * Closes all boxes in a given list.\r
+ * \r
+ * @param boxList Array of box IDs\r
+ */\r
+function collapseAll(boxList) {\r
+ var idx;\r
+ for (idx = 0; idx < boxList.length; idx++) {\r
+ var boxObj = getElementObject(boxList[idx]);\r
+ var buttonObj = getElementObject(boxList[idx]+B_SFIX);\r
+ closeBox(boxObj, buttonObj);\r
+ }\r
+}\r
+\r
+/**\r
+ * Open all boxes in a given list.\r
+ * \r
+ * @param boxList Array of box IDs\r
+ */\r
+function expandAll(boxList) {\r
+ var idx;\r
+ for (idx = 0; idx < boxList.length; idx++) {\r
+ var boxObj = getElementObject(boxList[idx]);\r
+ var buttonObj = getElementObject(boxList[idx]+B_SFIX);\r
+ openBox(boxObj, buttonObj);\r
+ }\r
+}\r
+\r
+/**\r
+ * Makes all the control buttons of boxes appear.\r
+ * \r
+ * @param boxList Array of box IDs\r
+ */\r
+function viewControlButtons(boxList) {\r
+ var idx;\r
+ for (idx = 0; idx < boxList.length; idx++) {\r
+ buttonObj = getElementObject(boxList[idx]+B_SFIX);\r
+ if (buttonObj != null) {\r
+ buttonObj.style.display = "inline";\r
+ }\r
+ }\r
+}\r
+\r
+/**\r
+ * Makes all the control buttons of boxes disappear.\r
+ * \r
+ * @param boxList Array of box IDs\r
+ */\r
+function hideControlButtons(boxList) {\r
+ var idx;\r
+ for (idx = 0; idx < boxList.length; idx++) {\r
+ buttonObj = getElementObject(boxList[idx]+B_SFIX);\r
+ if (buttonObj != null) {\r
+ buttonObj.style.display = "none";\r
+ }\r
+ }\r
+}\r
+\r
+/**\r
+ * Sets the page for either printing mode\r
+ * or viewing mode. In printing mode, the page\r
+ * is made to be more readable when printing it out.\r
+ * In viewing mode, the page is more browsable.\r
+ *\r
+ * @param isPrinterVersion If true, display in\r
+ * printing mode; otherwise, \r
+ * in viewing mode\r
+ */\r
+function displayMode(isPrinterVersion) {\r
+ var obj;\r
+ if (isPrinterVersion) {\r
+ // Hide global control buttons\r
+ obj = getElementObject("globalControls");\r
+ if (obj != null) {\r
+ obj.style.visibility = "hidden";\r
+ }\r
+ // Hide Legend\r
+ obj = getElementObject("legend");\r
+ if (obj != null) {\r
+ obj.style.display = "none";\r
+ }\r
+ obj = getElementObject("legendTOC");\r
+ if (obj != null) {\r
+ obj.style.display = "none";\r
+ }\r
+ // Hide Glossary\r
+ obj = getElementObject("glossary");\r
+ if (obj != null) {\r
+ obj.style.display = "none";\r
+ }\r
+ obj = getElementObject("glossaryTOC");\r
+ if (obj != null) {\r
+ obj.style.display = "none";\r
+ }\r
+\r
+ // Expand all XML Instance Representation tables\r
+ expandAll(xiBoxes);\r
+ // Expand all Schema Component Representation tables\r
+ expandAll(scBoxes);\r
+\r
+ // Hide Control buttons\r
+ hideControlButtons(xiBoxes);\r
+ hideControlButtons(scBoxes);\r
+ } else {\r
+ // View global control buttons\r
+ obj = getElementObject("globalControls");\r
+ if (obj != null) {\r
+ obj.style.visibility = "visible";\r
+ }\r
+ // View Legend\r
+ obj = getElementObject("legend");\r
+ if (obj != null) {\r
+ obj.style.display = "block";\r
+ }\r
+ obj = getElementObject("legendTOC");\r
+ if (obj != null) {\r
+ obj.style.display = "block";\r
+ }\r
+ // View Glossary\r
+ obj = getElementObject("glossary");\r
+ if (obj != null) {\r
+ obj.style.display = "block";\r
+ }\r
+ obj = getElementObject("glossaryTOC");\r
+ if (obj != null) {\r
+ obj.style.display = "block";\r
+ }\r
+\r
+ // Expand all XML Instance Representation tables\r
+ expandAll(xiBoxes);\r
+ // Collapse all Schema Component Representation tables\r
+ collapseAll(scBoxes);\r
+\r
+ // View Control buttons\r
+ viewControlButtons(xiBoxes);\r
+ viewControlButtons(scBoxes);\r
+ }\r
+}\r
+\r
+/**\r
+ * Opens up a window displaying the documentation\r
+ * of a schema component in the XML Instance\r
+ * Representation table.\r
+ * \r
+ * @param compDesc Description of schema component \r
+ * @param compName Name of schema component \r
+ * @param docTextArray Array containing the paragraphs \r
+ * of the new document\r
+ */\r
+function viewDocumentation(compDesc, compName, docTextArray) {\r
+ var width = 400;\r
+ var height = 200;\r
+ var locX = 100;\r
+ var locY = 200;\r
+\r
+ /* Generate content */\r
+ var actualText = "<html>";\r
+ actualText += "<head><title>";\r
+ actualText += compDesc;\r
+ if (compName != '') {\r
+ actualText += ": " + compName;\r
+ }\r
+ actualText += "</title></head>";\r
+ actualText += "<body bgcolor=\"#FFFFEE\">";\r
+ // Title\r
+ actualText += "<p style=\"font-family: Arial, sans-serif; font-size: 12pt; font-weight: bold; letter-spacing:1px;\">";\r
+ actualText += compDesc;\r
+ if (compName != '') {\r
+ actualText += ": <span style=\"color:#006699\">" + compName + "</span>";\r
+ }\r
+ actualText += "</p>";\r
+ // Documentation\r
+ var idx;\r
+ for (idx = 0; idx < docTextArray.length; idx++) {\r
+ actualText += "<p style=\"font-family: Arial, sans-serif; font-size: 10pt;\">" + docTextArray[idx] + "</p>";\r
+ }\r
+ // Link to close window\r
+ actualText += "<a href=\"javascript:void(0)\" onclick=\"window.close();\" style=\"font-family: Arial, sans-serif; font-size: 8pt;\">Close</a>";\r
+ actualText += "</body></html>";\r
+\r
+ /* Display window */\r
+ windowCount++;\r
+ var docWindow = window.open("", "documentation"+windowCount, "toolbar=no,location=no,status=no,menubar=no,scrollbars=yes,resizable,alwaysRaised,dependent,titlebar=no,width="+width+",height="+height+",screenX="+locX+",left="+locX+",screenY="+locY+",top="+locY);\r
+ docWindow.document.write(actualText);\r
+}\r
+</xsl:text>\r
+ </xsl:template>\r
+\r
+ <!--\r
+ CSS properties for the entire HTML document.\r
+ -->\r
+ <xsl:template name="DocumentCSSStyles">\r
+ <xsl:text>\r
+/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */\r
+/* More-configurable styles */\r
+\r
+/******** General ********/\r
+\r
+/* Document body */\r
+body {\r
+ color: Black;\r
+ background-color: White;\r
+ font-family: Arial, sans-serif;\r
+ font-size: 10pt;\r
+}\r
+/* Horizontal rules */\r
+hr {\r
+ color: black;\r
+}\r
+/* Document title */\r
+h1 {\r
+ font-size: 18pt;\r
+ letter-spacing: 2px;\r
+ border-bottom: 1px #ccc solid;\r
+ padding-top: 5px;\r
+ padding-bottom: 5px;\r
+}\r
+/* Main section headers */\r
+h2 {\r
+ font-size: 14pt;\r
+ letter-spacing: 1px;\r
+}\r
+/* Sub-section headers */\r
+h3, h3 a, h3 span {\r
+ font-size: 12pt;\r
+ font-weight: bold;\r
+ color: black;\r
+}\r
+/* Table displaying the properties of the schema components or the\r
+ schema document itself */\r
+table.properties th, table.properties th a {\r
+ color: black;\r
+ background-color: #F99; /* Pink */\r
+}\r
+table.properties td {\r
+ background-color: #eee; /* Gray */\r
+}\r
+\r
+\r
+/******** Table of Contents Section ********/\r
+\r
+/* Controls for switching between printing and viewing modes */\r
+div#printerControls {\r
+ color: #963; /* Orange-brown */\r
+}\r
+/* Controls that can collapse or expand all XML Instance\r
+ Representation and Schema Component Representation boxes */\r
+div#globalControls {\r
+ border: 2px solid #999;\r
+}\r
+\r
+\r
+/******** Schema Document Properties Section ********/\r
+\r
+/* Table displaying the namespaces declared in the schema */\r
+table.namespaces th {\r
+ background-color: #ccc;\r
+}\r
+table.namespaces td {\r
+ background-color: #eee;\r
+}\r
+/* Target namespace of the schema */\r
+span.targetNS {\r
+ color: #06C;\r
+ font-weight: bold;\r
+}\r
+\r
+\r
+/******** Schema Components' Sections ********/\r
+\r
+/* Name of schema component */\r
+.name {\r
+ color: #F93; /* Orange */\r
+}\r
+\r
+/* Hierarchy table */\r
+table.hierarchy {\r
+ border: 2px solid #999; /* Gray */\r
+}\r
+\r
+/* XML Instance Representation table */\r
+div.sample div.contents {\r
+ border: 2px dashed black;\r
+}\r
+\r
+/* Schema Component Representation table */\r
+div.schemaComponent div.contents {\r
+ border: 2px black solid;\r
+}\r
+\r
+\r
+/******** Glossary Section ********/\r
+\r
+/* Glossary Terms */\r
+.glossaryTerm {\r
+ color: #036; /* Blue */\r
+}\r
+\r
+\r
+/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */\r
+/* Printer-version styles */\r
+\r
+@media print {\r
+\r
+/* Ensures that controls are hidden when printing */\r
+div#printerControls {\r
+ visibility: hidden;\r
+}\r
+div#globalControls {\r
+ visibility: hidden;\r
+}\r
+#legend {\r
+ display: none;\r
+}\r
+#legendTOC {\r
+ display: none;\r
+}\r
+#glossary {\r
+ display: none;\r
+}\r
+#glossaryTOC {\r
+ display: none;\r
+}\r
+\r
+}\r
+\r
+/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */\r
+/* Base styles */\r
+\r
+/******** General ********/\r
+\r
+/* Unordered lists */\r
+ul {\r
+ margin-left: 1.5em;\r
+ margin-bottom: 0em;\r
+}\r
+/* Tables */\r
+table {\r
+ margin-top: 10px;\r
+ margin-bottom: 10px;\r
+ margin-left: 2px;\r
+ margin-right: 2px;\r
+}\r
+table th, table td {\r
+ font-size: 10pt;\r
+ vertical-align: top;\r
+ padding-top: 3px;\r
+ padding-bottom: 3px;\r
+ padding-left: 10px;\r
+ padding-right: 10px;\r
+}\r
+table th {\r
+ font-weight: bold;\r
+ text-align: left;\r
+}\r
+/* Table displaying the properties of the schema components or the\r
+ schema document itself */\r
+table.properties {\r
+ width: 90%;\r
+}\r
+table.properties th {\r
+ width: 30%;\r
+}\r
+/* Boxes that can make its content appear and disappear*/\r
+div.box {\r
+ margin: 1em;\r
+}\r
+ /* Box caption */\r
+div.box span.caption {\r
+ font-weight: bold;\r
+}\r
+ /* Button to open and close the box */\r
+div.box input.control {\r
+ width: 1.4em;\r
+ height: 1.4em;\r
+ text-align: center;\r
+ vertical-align: middle;\r
+ font-size: 11pt;\r
+}\r
+ /* Box contents */\r
+div.box div.contents {\r
+ margin-top: 3px;\r
+}\r
+\r
+\r
+/******** Table of Contents Section ********/\r
+\r
+/* Controls for switching between printing and viewing modes */\r
+div#printerControls {\r
+ white-space: nowrap;\r
+ font-weight: bold;\r
+ padding: 5px;\r
+ margin: 5px;\r
+}\r
+/* Controls that can collapse or expand all XML Instance\r
+ Representation and Schema Component Representation boxes */\r
+div#globalControls {\r
+ padding: 10px;\r
+ margin: 5px;\r
+}\r
+\r
+\r
+/******** Schema Document Properties Section ********/\r
+\r
+/* Table displaying the namespaces declared in the schema */\r
+table.namespaces th {\r
+}\r
+table.namespaces td {\r
+}\r
+/* Target namespace of the schema */\r
+span.targetNS {\r
+}\r
+\r
+\r
+/******** Schema Components' Sections ********/\r
+\r
+/* Name of schema component */\r
+.name {\r
+}\r
+\r
+/* Hierarchy table */\r
+table.hierarchy {\r
+ width: 90%;\r
+}\r
+table.hierarchy th {\r
+ font-weight: normal;\r
+ font-style: italic;\r
+ width: 20%;\r
+}\r
+table.hierarchy th, table.hierarchy td {\r
+ padding: 5px;\r
+}\r
+\r
+/* XML Instance Representation table */\r
+div.sample {\r
+ width: 90%;\r
+}\r
+div.sample div.contents {\r
+ padding: 5px;\r
+ font-family: Courier New, sans-serif;\r
+ font-size: 10pt;\r
+}\r
+ /* Normal elements and attributes */\r
+div.sample div.contents, div.sample div.contents a {\r
+ color: black;\r
+}\r
+ /* Group Headers */\r
+div.sample div.contents .group, div.sample div.contents .group a {\r
+ color: #999; /* Light gray */\r
+}\r
+ /* Type Information */\r
+div.sample div.contents .type, div.sample div.contents .type a {\r
+ color: #999; /* Light gray */\r
+}\r
+ /* Occurrence Information */\r
+div.sample div.contents .occurs, div.sample div.contents .occurs a {\r
+ color: #999; /* Light gray */\r
+}\r
+ /* Fixed values */\r
+div.sample div.contents .fixed {\r
+ color: #063; /* Green */\r
+ font-weight: bold;\r
+}\r
+ /* Simple type constraints */\r
+div.sample div.contents .constraint, div.sample div.contents .constraint a {\r
+ color: #999; /* Light gray */\r
+}\r
+ /* Elements and attributes inherited from base type */\r
+div.sample div.contents .inherited, div.sample div.contents .inherited a {\r
+ color: #666; /* Dark gray */\r
+}\r
+ /* Elements and attributes added to or changed from base type */\r
+div.sample div.contents .newFields {\r
+ font-weight: bold;\r
+}\r
+ /* Other type of information */\r
+div.sample div.contents .other, div.sample div.contents .other a {\r
+ color: #369; /* Blue */\r
+ font-style: italic;\r
+}\r
+ /* Link to open up window displaying documentation */\r
+div.sample div.contents a.documentation {\r
+ text-decoration: none;\r
+ padding-left: 3px;\r
+ padding-right: 3px;\r
+ padding-top: 0px;\r
+ padding-bottom: 0px;\r
+ font-weight: bold;\r
+ font-size: 11pt;\r
+ background-color: #FFD;\r
+ color: #069;\r
+}\r
+ /* Invert colors when hovering over link to open up window \r
+ displaying documentation */\r
+div.sample div.contents a.documentation:hover {\r
+ color: #FFD;\r
+ background-color: #069;\r
+}\r
+\r
+/* Schema Component Representation table */\r
+div.schemaComponent {\r
+ width: 90%;\r
+}\r
+div.schemaComponent div.contents {\r
+ font-family: Courier New, sans-serif;\r
+ font-size: 10pt;\r
+ padding: 5px;\r
+}\r
+ /* Syntax characters */\r
+div.schemaComponent div.contents {\r
+ color: #00f; /* blue */\r
+}\r
+ /* Element and attribute tags */\r
+div.schemaComponent div.contents .scTag {\r
+ color: #933; /* maroon */\r
+}\r
+ /* Element and attribute content */\r
+div.schemaComponent div.contents .scContent, div.schemaComponent div.contents .scContent a {\r
+ color: black;\r
+ font-weight: bold;\r
+}\r
+ /* Comments */\r
+div.schemaComponent div.contents .comment {\r
+ color: #999; /* Light gray */\r
+}\r
+\r
+/******** Legend Section ********/\r
+\r
+div#legend table, div#legend div {\r
+ margin-bottom: 3px;\r
+}\r
+div#legend div.hint {\r
+ color: #999; /* Light gray */\r
+ width: 90%;\r
+ margin-left: 1em;\r
+ margin-bottom: 2em;\r
+}\r
+\r
+\r
+/******** Glossary Section ********/\r
+\r
+/* Glossary Terms */\r
+.glossaryTerm {\r
+ font-weight: bold;\r
+}\r
+\r
+\r
+/******** Footer ********/\r
+\r
+.footer {\r
+ font-size: 8pt;\r
+}\r
+</xsl:text>\r
+ </xsl:template>\r
+\r
+ <!--\r
+ Print outs a legend describing the meaning of colors, bold items,\r
+ etc. in the top-level sections.\r
+ -->\r
+ <xsl:template name="Legend">\r
+ <!-- Header -->\r
+ <div style="float: left; width: 15em;">\r
+ <h3 style="margin-bottom: 0px;">Complex Type:</h3>\r
+ <div class="hint" style="margin-left: 0em;">Schema Component Type</div>\r
+ </div>\r
+ <div style="float: left; width: 15em;">\r
+ <h3 style="margin-bottom: 0px;"><span class="name">AusAddress</span></h3>\r
+ <div class="hint" style="margin-left: 0em;">Schema Component Name</div>\r
+ </div>\r
+\r
+ <!-- Hierarchy Table -->\r
+ <table class="hierarchy" style="clear : both">\r
+ <tr>\r
+ <xsl:choose>\r
+ <xsl:when test="normalize-space(translate($printAllSuperTypes, 'TRUE', 'true'))='true'">\r
+ <th>Super-types:</th>\r
+ <td>\r
+ <span class="type" style="color: #0000FF; text-decoration:underline;">Address</span>\r
+ <xsl:text> < </xsl:text>\r
+ <span class="current">AusAddress</span>\r
+ <xsl:text> (by extension)</xsl:text>\r
+ </td>\r
+ </xsl:when>\r
+ <xsl:otherwise>\r
+ <th>Parent type:</th>\r
+ <td>\r
+ <span class="type" style="color: #0000FF; text-decoration:underline;">Address</span>\r
+ <xsl:text> (derivation method: extension)</xsl:text>\r
+ </td>\r
+ </xsl:otherwise>\r
+ </xsl:choose>\r
+ </tr>\r
+ <tr>\r
+ <xsl:choose>\r
+ <xsl:when test="normalize-space(translate($printAllSubTypes, 'TRUE', 'true'))='true'">\r
+ <th>Sub-types:</th>\r
+ <td>\r
+ <ul>\r
+ <li>\r
+ <span class="type" style="color: #0000FF; text-decoration:underline;">QLDAddress</span>\r
+ <xsl:text> (by restriction)</xsl:text>\r
+ </li>\r
+ </ul>\r
+ </td>\r
+ </xsl:when>\r
+ <xsl:otherwise>\r
+ <th>Direct sub-types:</th>\r
+ <td>\r
+ <ul>\r
+ <li>\r
+ <span class="type" style="color: #0000FF; text-decoration:underline;">QLDAddress</span>\r
+ <xsl:text> (by restriction)</xsl:text>\r
+ </li>\r
+ </ul>\r
+ </td>\r
+ </xsl:otherwise>\r
+ </xsl:choose>\r
+ </tr>\r
+ </table>\r
+ <div class="hint">If this schema component is a type definition, its type hierarchy is shown in a gray-bordered box.</div>\r
+\r
+ <!-- Properties Table -->\r
+ <table class="properties">\r
+ <tr>\r
+ <th>Name</th>\r
+ <td>AusAddress</td>\r
+ </tr>\r
+ <tr>\r
+ <th>\r
+ <a title="Look up 'Abstract' in glossary" href="#term_Abstract">Abstract</a>\r
+ </th>\r
+ <td>no</td>\r
+ </tr>\r
+ </table>\r
+ <div class="hint">The table above displays the properties of this schema component.</div>\r
+\r
+ <!-- XML Instance Representation Table -->\r
+ <div class="sample box">\r
+ <div>\r
+ <span class="caption">XML Instance Representation</span>\r
+ </div>\r
+ <div class="contents">\r
+ <span style="margin-left: 0em"><...</span>\r
+ <span class="newFields">\r
+ <span> country="<span class="fixed">Australia</span>"</span>\r
+ </span>\r
+ <xsl:text>> </xsl:text><br/>\r
+ <span style="margin-left: 1.5em" class="inherited"><unitNo> <span class="type">string</span> </unitNo> <span class="occurs">[0..1]</span></span><br/>\r
+ <span style="margin-left: 1.5em" class="inherited"><houseNo> <span class="type">string</span> </houseNo> <span class="occurs">[1]</span></span><br/>\r
+ <span style="margin-left: 1.5em" class="inherited"><street> <span class="type">string</span> </street> <span class="occurs">[1]</span></span><br/>\r
+ <span class="group" style="margin-left: 1.5em">Start <a title="Look up 'Choice' in glossary" href="#term_Choice">Choice</a> <span class="occurs">[1]</span></span><br/>\r
+ <span style="margin-left: 3em" class="inherited"><city> <span class="type">string</span> </city> <span class="occurs">[1]</span></span><br/>\r
+ <span style="margin-left: 3em" class="inherited"><town> <span class="type">string</span> </town> <span class="occurs">[1]</span></span><br/>\r
+ <span class="group" style="margin-left: 1.5em">End Choice</span><br/>\r
+ <span class="newFields">\r
+ <span style="margin-left: 1.5em"><state> <span class="type" style="text-decoration:underline;">AusStates</span> </state> <span class="occurs">[1]</span></span><br/>\r
+ <span style="margin-left: 1.5em"><postcode> <span class="constraint">string <<<em>pattern</em> = [1-9][0-9]{3}>></span> </postcode> <span class="occurs">[1]</span>\r
+ <xsl:if test="normalize-space(translate($useJavaScript,'TRUE','true'))='true'">\r
+ <a href="javascript:void(0)" title="View Documentation" class="documentation" onclick="docArray = new Array('Post code must be a four-digit number.'); viewDocumentation('Element', 'postcode', docArray);">?</a>\r
+ </xsl:if>\r
+ </span><br/>\r
+ </span>\r
+ <span style="margin-left: 0em"></...></span><br/>\r
+ </div>\r
+ </div>\r
+ <div class="hint">\r
+ <p>The XML Instance Representation table above shows the schema component's content as an XML instance.</p>\r
+ <ul>\r
+ <li>The minimum and maximum occurrence of elements and attributes are provided in square brackets, e.g. [0..1].</li>\r
+ <li>Model group information are shown in gray, e.g. Start Choice ... End Choice.</li>\r
+ <li>For type derivations, the elements and attributes that have been added to or changed from the base type's content are shown in <span style="font-weight: bold">bold</span>.</li>\r
+ <li>If an element/attribute has a fixed value, the fixed value is shown in green, e.g. country="Australia".</li>\r
+ <li>Otherwise, the type of the element/attribute is displayed.\r
+ <ul>\r
+ <li>If the element/attribute's type is in the schema, a link is provided to it.</li>\r
+ <!--<li>An <em>E</em> symbol is shown if the element/attribute's type is located in an external schema.</li>-->\r
+ <li>For local simple type definitions, the constraints are displayed in angle brackets, e.g. <<<em>pattern</em> = [1-9][0-9]{3}>>.</li>\r
+ </ul>\r
+ </li>\r
+ <xsl:if test="normalize-space(translate($useJavaScript,'TRUE','true'))='true'">\r
+ <li>If a local element/attribute has documentation, it will be displayed in a window that pops up when the question mark inside the attribute or next to the element is clicked, e.g. <postcode>.</li>\r
+ </xsl:if>\r
+ </ul>\r
+ </div>\r
+\r
+ <!-- Schema Component Representation Table -->\r
+ <div class="schemaComponent box">\r
+ <div>\r
+ <span class="caption">Schema Component Representation</span>\r
+ </div>\r
+ <div class="contents">\r
+ <span style="margin-left: 0em"><<span class="scTag">complexType</span> <span class="scTag">name</span>="<span class="scContent">AusAddress</span>"></span><br/>\r
+ <span style="margin-left: 1.5em"><<span class="scTag">complexContent</span>></span><br/>\r
+ <span style="margin-left: 3em"><<span class="scTag">extension</span> <span class="scTag">base</span>="<span class="scContent"><span class="type" style="text-decoration:underline;">Address</span></span>"></span><br/>\r
+ <span style="margin-left: 4.5em"><<span class="scTag">sequence</span>></span><br/>\r
+ <span style="margin-left: 6em"><<span class="scTag">element</span> <span class="scTag">name</span>="<span class="scContent">state</span>" <span class="scTag">type</span>="<span class="scContent"><span class="type" style="text-decoration:underline;">AusStates</span></span>"/></span><br/>\r
+ <span style="margin-left: 6em"><<span class="scTag">element</span> <span class="scTag">name</span>="<span class="scContent">postcode</span>"></span><br/>\r
+ <span style="margin-left: 7.5em"><<span class="scTag">simpleType</span>></span><br/>\r
+ <span style="margin-left: 9em"><<span class="scTag">restriction</span> <span class="scTag">base</span>="<span class="scContent"><span class="type">string</span></span>"></span><br/>\r
+ <span style="margin-left: 10.5em"><<span class="scTag">pattern</span> <span class="scTag">value</span>="<span class="scContent">[1-9][0-9]{3}</span>"/></span><br/>\r
+ <span style="margin-left: 9em"></<span class="scTag">restriction</span>></span><br/>\r
+ <span style="margin-left: 7.5em"></<span class="scTag">simpleType</span>></span><br/>\r
+ <span style="margin-left: 6em"></<span class="scTag">element</span>></span><br/>\r
+ <span style="margin-left: 4.5em"></<span class="scTag">sequence</span>></span><br/>\r
+ <span style="margin-left: 4.5em"><<span class="scTag">attribute</span> <span class="scTag">name</span>="<span class="scContent">country</span>" <span class="scTag">type</span>="<span class="scContent"><span class="type">string</span></span>" <span class="scTag">fixed</span>="<span class="scContent">Australia</span>"/></span><br/>\r
+ <span style="margin-left: 3em"></<span class="scTag">extension</span>></span><br/>\r
+ <span style="margin-left: 1.5em"></<span class="scTag">complexContent</span>></span><br/>\r
+ <span style="margin-left: 0em"></<span class="scTag">complexType</span>></span><br/>\r
+ </div>\r
+ </div>\r
+ <div class="hint">The Schema Component Representation table above displays the underlying XML representation of the schema component. (Annotations are not shown.)</div>\r
+ </xsl:template>\r
+\r
+ <!--\r
+ Print outs all terms for the glossary section.\r
+ -->\r
+ <xsl:template name="Glossary">\r
+ <xsl:call-template name="PrintGlossaryTerm">\r
+ <xsl:with-param name="code">Abstract</xsl:with-param>\r
+ <xsl:with-param name="term">Abstract</xsl:with-param>\r
+ <xsl:with-param name="description">\r
+ <xsl:text>(Applies to complex type definitions and element declarations).</xsl:text>\r
+ <xsl:text> An abstract element or complex type cannot used to validate an element instance.</xsl:text>\r
+ <xsl:text> If there is a reference to an abstract element, only element declarations that can substitute the abstract element can be used to validate the instance.</xsl:text>\r
+ <xsl:text> For references to abstract type definitions, only derived types can be used.</xsl:text>\r
+ </xsl:with-param>\r
+ </xsl:call-template>\r
+\r
+ <xsl:call-template name="PrintGlossaryTerm">\r
+ <xsl:with-param name="code">All</xsl:with-param>\r
+ <xsl:with-param name="term">All Model Group</xsl:with-param>\r
+ <xsl:with-param name="description">\r
+ <xsl:text>Child elements can be provided </xsl:text>\r
+ <em>\r
+ <xsl:text>in any order</xsl:text>\r
+ </em>\r
+ <xsl:text> in instances.</xsl:text>\r
+ </xsl:with-param>\r
+ <xsl:with-param name="link">http://www.w3.org/TR/xmlschema-1/#element-all</xsl:with-param>\r
+ </xsl:call-template>\r
+\r
+ <xsl:call-template name="PrintGlossaryTerm">\r
+ <xsl:with-param name="code">Choice</xsl:with-param>\r
+ <xsl:with-param name="term">Choice Model Group</xsl:with-param>\r
+ <xsl:with-param name="description">\r
+ <em>\r
+ <xsl:text>Only one</xsl:text>\r
+ </em>\r
+ <xsl:text> from the list of child elements and model groups can be provided in instances.</xsl:text>\r
+ </xsl:with-param>\r
+ <xsl:with-param name="link">http://www.w3.org/TR/xmlschema-1/#element-choice</xsl:with-param>\r
+ </xsl:call-template>\r
+\r
+ <xsl:call-template name="PrintGlossaryTerm">\r
+ <xsl:with-param name="code">CollapseWS</xsl:with-param>\r
+ <xsl:with-param name="term">Collapse Whitespace Policy</xsl:with-param>\r
+ <xsl:with-param name="description">Replace tab, line feed, and carriage return characters with space character (Unicode character 32). Then, collapse contiguous sequences of space characters into single space character, and remove leading and trailing space characters.</xsl:with-param>\r
+ </xsl:call-template>\r
+\r
+ <xsl:call-template name="PrintGlossaryTerm">\r
+ <xsl:with-param name="code">ElemBlock</xsl:with-param>\r
+ <xsl:with-param name="term">Disallowed Substitutions</xsl:with-param>\r
+ <xsl:with-param name="description">\r
+ <xsl:text>(Applies to element declarations).</xsl:text>\r
+ <xsl:text> If </xsl:text>\r
+ <em>substitution</em>\r
+ <xsl:text> is specified, then </xsl:text>\r
+ <xsl:call-template name="PrintGlossaryTermRef">\r
+ <xsl:with-param name="code">SubGroup</xsl:with-param>\r
+ <xsl:with-param name="term">substitution group</xsl:with-param>\r
+ </xsl:call-template>\r
+ <xsl:text> members cannot be used in place of the given element declaration to validate element instances.</xsl:text>\r
+\r
+ <xsl:text> If </xsl:text>\r
+ <em>derivation methods</em>\r
+ <xsl:text>, e.g. extension, restriction, are specified, then the given element declaration will not validate element instances that have types derived from the element declaration's type using the specified derivation methods.</xsl:text>\r
+ <xsl:text> Normally, element instances can override their declaration's type by specifying an </xsl:text>\r
+ <code>xsi:type</code>\r
+ <xsl:text> attribute.</xsl:text>\r
+ </xsl:with-param>\r
+ </xsl:call-template>\r
+\r
+ <xsl:call-template name="PrintGlossaryTerm">\r
+ <xsl:with-param name="code">Key</xsl:with-param>\r
+ <xsl:with-param name="term">Key Constraint</xsl:with-param>\r
+ <xsl:with-param name="description">\r
+ <xsl:text>Like </xsl:text>\r
+ <xsl:call-template name="PrintGlossaryTermRef">\r
+ <xsl:with-param name="code">Unique</xsl:with-param>\r
+ <xsl:with-param name="term">Uniqueness Constraint</xsl:with-param>\r
+ </xsl:call-template>\r
+ <xsl:text>, but additionally requires that the specified value(s) must be provided.</xsl:text>\r
+ </xsl:with-param>\r
+ <xsl:with-param name="link">http://www.w3.org/TR/xmlschema-1/#cIdentity-constraint_Definitions</xsl:with-param>\r
+ </xsl:call-template>\r
+\r
+ <xsl:call-template name="PrintGlossaryTerm">\r
+ <xsl:with-param name="code">KeyRef</xsl:with-param>\r
+ <xsl:with-param name="term">Key Reference Constraint</xsl:with-param>\r
+ <xsl:with-param name="description">\r
+ <xsl:text>Ensures that the specified value(s) must match value(s) from a </xsl:text>\r
+ <xsl:call-template name="PrintGlossaryTermRef">\r
+ <xsl:with-param name="code">Key</xsl:with-param>\r
+ <xsl:with-param name="term">Key Constraint</xsl:with-param>\r
+ </xsl:call-template>\r
+ <xsl:text> or </xsl:text>\r
+ <xsl:call-template name="PrintGlossaryTermRef">\r
+ <xsl:with-param name="code">Unique</xsl:with-param>\r
+ <xsl:with-param name="term">Uniqueness Constraint</xsl:with-param>\r
+ </xsl:call-template>\r
+ <xsl:text>.</xsl:text>\r
+ </xsl:with-param>\r
+ <xsl:with-param name="link">http://www.w3.org/TR/xmlschema-1/#cIdentity-constraint_Definitions</xsl:with-param>\r
+ </xsl:call-template>\r
+\r
+ <xsl:call-template name="PrintGlossaryTerm">\r
+ <xsl:with-param name="code">ModelGroup</xsl:with-param>\r
+ <xsl:with-param name="term">Model Group</xsl:with-param>\r
+ <xsl:with-param name="description">\r
+ <xsl:text>Groups together element content, specifying the order in which the element content can occur and the number of times the group of element content may be repeated.</xsl:text>\r
+ </xsl:with-param>\r
+ <xsl:with-param name="link">http://www.w3.org/TR/xmlschema-1/#Model_Groups</xsl:with-param>\r
+ </xsl:call-template>\r
+\r
+ <xsl:call-template name="PrintGlossaryTerm">\r
+ <xsl:with-param name="code">Nillable</xsl:with-param>\r
+ <xsl:with-param name="term">Nillable</xsl:with-param>\r
+ <xsl:with-param name="description">\r
+ <xsl:text>(Applies to element declarations). </xsl:text>\r
+ <xsl:text>If an element declaration is nillable, instances can use the </xsl:text>\r
+ <code>xsi:nil</code>\r
+ <xsl:text> attribute.</xsl:text>\r
+ <xsl:text> The </xsl:text>\r
+ <code>xsi:nil</code>\r
+ <xsl:text> attribute is the boolean attribute, </xsl:text>\r
+ <em>nil</em>\r
+ <xsl:text>, from the </xsl:text>\r
+ <em>http://www.w3.org/2001/XMLSchema-instance</em>\r
+ <xsl:text> namespace.</xsl:text>\r
+ <xsl:text> If an element instance has an </xsl:text>\r
+ <code>xsi:nil</code>\r
+ <xsl:text> attribute set to true, it can be left empty, even though its element declaration may have required content.</xsl:text>\r
+ </xsl:with-param>\r
+ </xsl:call-template>\r
+\r
+ <xsl:call-template name="PrintGlossaryTerm">\r
+ <xsl:with-param name="code">Notation</xsl:with-param>\r
+ <xsl:with-param name="term">Notation</xsl:with-param>\r
+ <xsl:with-param name="description">A notation is used to identify the format of a piece of data. Values of elements and attributes that are of type, NOTATION, must come from the names of declared notations.</xsl:with-param>\r
+ <xsl:with-param name="link">http://www.w3.org/TR/xmlschema-1/#cNotation_Declarations</xsl:with-param>\r
+ </xsl:call-template>\r
+\r
+ <xsl:call-template name="PrintGlossaryTerm">\r
+ <xsl:with-param name="code">PreserveWS</xsl:with-param>\r
+ <xsl:with-param name="term">Preserve Whitespace Policy</xsl:with-param>\r
+ <xsl:with-param name="description">Preserve whitespaces exactly as they appear in instances.</xsl:with-param>\r
+ </xsl:call-template>\r
+\r
+ <xsl:call-template name="PrintGlossaryTerm">\r
+ <xsl:with-param name="code">TypeFinal</xsl:with-param>\r
+ <xsl:with-param name="term">Prohibited Derivations</xsl:with-param>\r
+ <xsl:with-param name="description">\r
+ <xsl:text>(Applies to type definitions). </xsl:text>\r
+ <xsl:text>Derivation methods that cannot be used to create sub-types from a given type definition.</xsl:text>\r
+ </xsl:with-param>\r
+ </xsl:call-template>\r
+\r
+ <xsl:call-template name="PrintGlossaryTerm">\r
+ <xsl:with-param name="code">TypeBlock</xsl:with-param>\r
+ <xsl:with-param name="term">Prohibited Substitutions</xsl:with-param>\r
+ <xsl:with-param name="description">\r
+ <xsl:text>(Applies to complex type definitions). </xsl:text>\r
+ <xsl:text>Prevents sub-types that have been derived using the specified derivation methods from validating element instances in place of the given type definition.</xsl:text>\r
+ </xsl:with-param>\r
+ </xsl:call-template>\r
+\r
+ <xsl:call-template name="PrintGlossaryTerm">\r
+ <xsl:with-param name="code">ReplaceWS</xsl:with-param>\r
+ <xsl:with-param name="term">Replace Whitespace Policy</xsl:with-param>\r
+ <xsl:with-param name="description">Replace tab, line feed, and carriage return characters with space character (Unicode character 32).</xsl:with-param>\r
+ </xsl:call-template>\r
+\r
+ <xsl:call-template name="PrintGlossaryTerm">\r
+ <xsl:with-param name="code">Sequence</xsl:with-param>\r
+ <xsl:with-param name="term">Sequence Model Group</xsl:with-param>\r
+ <xsl:with-param name="description">\r
+ <xsl:text>Child elements and model groups must be provided </xsl:text>\r
+ <em>\r
+ <xsl:text>in the specified order</xsl:text>\r
+ </em>\r
+ <xsl:text> in instances.</xsl:text>\r
+ </xsl:with-param>\r
+ <xsl:with-param name="link">http://www.w3.org/TR/xmlschema-1/#element-sequence</xsl:with-param>\r
+ </xsl:call-template>\r
+\r
+ <xsl:call-template name="PrintGlossaryTerm">\r
+ <xsl:with-param name="code">SubGroup</xsl:with-param>\r
+ <xsl:with-param name="term">Substitution Group</xsl:with-param>\r
+ <xsl:with-param name="description">\r
+ <xsl:text>Elements that are </xsl:text>\r
+ <em>\r
+ <xsl:text>members</xsl:text>\r
+ </em>\r
+ <xsl:text> of a substitution group can be used wherever the </xsl:text>\r
+ <em>\r
+ <xsl:text>head</xsl:text>\r
+ </em>\r
+ <xsl:text> element of the substitution group is referenced.</xsl:text>\r
+ </xsl:with-param>\r
+ </xsl:call-template>\r
+\r
+ <xsl:call-template name="PrintGlossaryTerm">\r
+ <xsl:with-param name="code">ElemFinal</xsl:with-param>\r
+ <xsl:with-param name="term">Substitution Group Exclusions</xsl:with-param>\r
+ <xsl:with-param name="description">\r
+ <xsl:text>(Applies to element declarations). </xsl:text>\r
+ <xsl:text>Prohibits element declarations from nominating themselves as being able to substitute a given element declaration, if they have types that are derived from the original element's type using the specified derivation methods.</xsl:text>\r
+ </xsl:with-param>\r
+ </xsl:call-template>\r
+\r
+ <xsl:call-template name="PrintGlossaryTerm">\r
+ <xsl:with-param name="code">TargetNS</xsl:with-param>\r
+ <xsl:with-param name="term">Target Namespace</xsl:with-param>\r
+ <xsl:with-param name="description">The target namespace identifies the namespace that components in this schema belongs to. If no target namespace is provided, then the schema components do not belong to any namespace.</xsl:with-param>\r
+ </xsl:call-template>\r
+\r
+ <xsl:call-template name="PrintGlossaryTerm">\r
+ <xsl:with-param name="code">Unique</xsl:with-param>\r
+ <xsl:with-param name="term">Uniqueness Constraint</xsl:with-param>\r
+ <xsl:with-param name="description">Ensures uniqueness of an element/attribute value, or a combination of values, within a specified scope.</xsl:with-param>\r
+ <xsl:with-param name="link">http://www.w3.org/TR/xmlschema-1/#cIdentity-constraint_Definitions</xsl:with-param>\r
+ </xsl:call-template>\r
+ </xsl:template>\r
+\r
+ <!--\r
+ Prints out a term in the glossary section.\r
+ Param(s):\r
+ code (String) required\r
+ Unique ID of glossary term\r
+ term (String) required\r
+ Glossary term\r
+ description (Result Tree Fragment) required\r
+ Meaning of term; may contain HTML tags and links\r
+ link (String) optional\r
+ URI containing more info about term\r
+ -->\r
+ <xsl:template name="PrintGlossaryTerm">\r
+ <xsl:param name="code"/>\r
+ <xsl:param name="term"/>\r
+ <xsl:param name="description"/>\r
+ <xsl:param name="link"/>\r
+\r
+ <p>\r
+ <span class="glossaryTerm">\r
+ <a name="{concat($TERM_PREFIX, $code)}"><xsl:value-of select="$term"/></a>\r
+ <xsl:text> </xsl:text>\r
+ </span>\r
+ <xsl:copy-of select="$description"/>\r
+ <xsl:if test="$link != ''">\r
+ <xsl:text> See: </xsl:text>\r
+ <xsl:call-template name="PrintURI">\r
+ <xsl:with-param name="uri" select="$link"/>\r
+ </xsl:call-template>\r
+ <xsl:text>.</xsl:text>\r
+ </xsl:if>\r
+ </p>\r
+ </xsl:template>\r
+\r
+\r
+ <!-- ******** Hierarchy table ******** -->\r
+\r
+ <!-- \r
+ Prints out substitution group hierarchy for\r
+ element declarations.\r
+ -->\r
+ <xsl:template match="xsd:element" mode="hierarchy">\r
+ <!--\r
+ Find out members of substitution group that this element \r
+ heads.\r
+ -->\r
+ <xsl:variable name="members">\r
+ <ul>\r
+ <xsl:call-template name="PrintSGroupMembers">\r
+ <xsl:with-param name="element" select="."/>\r
+ </xsl:call-template>\r
+ </ul>\r
+ </xsl:variable>\r
+ <xsl:variable name="hasMembers">\r
+ <xsl:if test="normalize-space($members)!=''">\r
+ <xsl:text>true</xsl:text>\r
+ </xsl:if>\r
+ </xsl:variable>\r
+ <!-- Print hierarchy table -->\r
+ <xsl:if test="@substitutionGroup or normalize-space($hasMembers)='true'">\r
+ <table class="hierarchy">\r
+ <tr>\r
+ <td>\r
+ <ul>\r
+ <!-- Print substitution group that this element belongs to -->\r
+ <xsl:if test="@substitutionGroup">\r
+ <li>\r
+ <em>This element can be used wherever the following element is referenced:</em>\r
+ <ul>\r
+ <li>\r
+ <xsl:call-template name="PrintElementRef">\r
+ <xsl:with-param name="ref" select="@substitutionGroup"/>\r
+ </xsl:call-template>\r
+ </li>\r
+ </ul>\r
+ </li>\r
+ </xsl:if>\r
+ <!-- Print substitution group that this element heads -->\r
+ <xsl:if test="normalize-space($hasMembers)='true'">\r
+ <li>\r
+ <em>The following elements can be used wherever this element is referenced:</em>\r
+ <xsl:copy-of select="$members"/>\r
+ </li>\r
+ </xsl:if>\r
+ </ul>\r
+ </td>\r
+ </tr>\r
+ </table>\r
+ </xsl:if>\r
+ </xsl:template>\r
+\r
+ <!-- \r
+ Prints out Hierarchy table for complex type definitions.\r
+ -->\r
+ <xsl:template match="xsd:complexType" mode="hierarchy">\r
+ <table class="hierarchy">\r
+ <!-- Print super types -->\r
+ <tr>\r
+ <th>\r
+ <xsl:choose>\r
+ <xsl:when test="normalize-space(translate($printAllSuperTypes, 'TRUE', 'true'))='true'">\r
+ <xsl:text>Super-types:</xsl:text>\r
+ </xsl:when>\r
+ <xsl:otherwise>\r
+ <xsl:text>Parent type:</xsl:text>\r
+ </xsl:otherwise>\r
+ </xsl:choose>\r
+ </th>\r
+ <td>\r
+ <xsl:choose>\r
+ <xsl:when test="xsd:simpleContent or xsd:complexContent">\r
+ <xsl:call-template name="PrintSupertypes">\r
+ <xsl:with-param name="type" select="."/>\r
+ </xsl:call-template>\r
+ </xsl:when>\r
+ <xsl:otherwise>\r
+ <xsl:text>None</xsl:text>\r
+ </xsl:otherwise>\r
+ </xsl:choose>\r
+ </td>\r
+ </tr>\r
+ <!-- Print sub types -->\r
+ <tr>\r
+ <th>\r
+ <xsl:choose>\r
+ <xsl:when test="normalize-space(translate($printAllSubTypes, 'TRUE', 'true'))='true'">\r
+ <xsl:text>Sub-types:</xsl:text>\r
+ </xsl:when>\r
+ <xsl:otherwise>\r
+ <xsl:text>Direct sub-types:</xsl:text>\r
+ </xsl:otherwise>\r
+ </xsl:choose>\r
+ </th>\r
+ <td>\r
+ <xsl:call-template name="PrintComplexSubtypes">\r
+ <xsl:with-param name="type" select="."/>\r
+ </xsl:call-template>\r
+ </td>\r
+ </tr>\r
+ </table>\r
+ </xsl:template>\r
+\r
+ <!-- \r
+ Prints out Hierarchy table for simple type definitions.\r
+ -->\r
+ <xsl:template match="xsd:simpleType" mode="hierarchy">\r
+ <table class="hierarchy">\r
+ <!-- Print super types -->\r
+ <tr>\r
+ <th>\r
+ <xsl:choose>\r
+ <xsl:when test="normalize-space(translate($printAllSuperTypes, 'TRUE', 'true'))='true'">\r
+ <xsl:text>Super-types:</xsl:text>\r
+ </xsl:when>\r
+ <xsl:otherwise>\r
+ <xsl:text>Parent type:</xsl:text>\r
+ </xsl:otherwise>\r
+ </xsl:choose>\r
+ </th>\r
+ <td>\r
+ <xsl:choose>\r
+ <xsl:when test="xsd:restriction">\r
+ <xsl:call-template name="PrintSupertypes">\r
+ <xsl:with-param name="type" select="."/>\r
+ </xsl:call-template>\r
+ </xsl:when>\r
+ <xsl:otherwise>\r
+ <xsl:text>None</xsl:text>\r
+ </xsl:otherwise>\r
+ </xsl:choose>\r
+ </td>\r
+ </tr>\r
+ <!-- Print sub types -->\r
+ <tr>\r
+ <th>\r
+ <xsl:choose>\r
+ <xsl:when test="normalize-space(translate($printAllSubTypes, 'TRUE', 'true'))='true'">\r
+ <xsl:text>Sub-types:</xsl:text>\r
+ </xsl:when>\r
+ <xsl:otherwise>\r
+ <xsl:text>Direct sub-types:</xsl:text>\r
+ </xsl:otherwise>\r
+ </xsl:choose>\r
+ </th>\r
+ <td>\r
+ <xsl:call-template name="PrintSimpleSubtypes">\r
+ <xsl:with-param name="type" select="."/>\r
+ </xsl:call-template>\r
+ </td>\r
+ </tr>\r
+ </table>\r
+ </xsl:template>\r
+\r
+ <!--\r
+ Unmatched template for 'hierarchy' mode\r
+ -->\r
+ <xsl:template match="*" mode="hierarchy"/>\r
+\r
+ <!-- \r
+ Prints out members, if any, of the substitution group that a \r
+ given element declaration heads.\r
+ Assumes it will be called within XHTML <ul> tags.\r
+ Param(s):\r
+ element (Node) required\r
+ Top-level element declaration\r
+ elementList (String) optional\r
+ List of elements in this call chain. Name of element starts\r
+ with '*', and ends with '+'. (Used to prevent infinite\r
+ recursive loop.)\r
+ -->\r
+ <xsl:template name="PrintSGroupMembers">\r
+ <xsl:param name="element"/>\r
+ <xsl:param name="elementList"/>\r
+\r
+ <xsl:variable name="elemName" select="normalize-space($element/@name)"/>\r
+ <xsl:choose>\r
+ <xsl:when test="contains($elementList, concat('*', $elemName, '+'))">\r
+ <!-- Circular element substitution group hierarchy -->\r
+ <li>\r
+ <xsl:call-template name="HandleError">\r
+ <xsl:with-param name="isTerminating">false</xsl:with-param>\r
+ <xsl:with-param name="errorMsg">\r
+ <xsl:text>Circular element reference to: </xsl:text>\r
+ <xsl:value-of select="$elemName"/>\r
+ </xsl:with-param>\r
+ </xsl:call-template>\r
+ </li>\r
+ </xsl:when>\r
+ <xsl:otherwise>\r
+ <!-- Get 'block' attribute. -->\r
+ <xsl:variable name="block">\r
+ <xsl:call-template name="PrintBlockSet">\r
+ <xsl:with-param name="EBV">\r
+ <xsl:choose>\r
+ <xsl:when test="$element/@block">\r
+ <xsl:value-of select="$element/@block"/>\r
+ </xsl:when>\r
+ <xsl:otherwise>\r
+ <xsl:value-of select="/xsd:schema/@blockDefault"/>\r
+ </xsl:otherwise>\r
+ </xsl:choose>\r
+ </xsl:with-param>\r
+ </xsl:call-template>\r
+ </xsl:variable>\r
+\r
+ <xsl:for-each select="/xsd:schema/xsd:element[normalize-space(@substitutionGroup)=$elemName or normalize-space(substring-after(@substitutionGroup, ':'))=$elemName]">\r
+ <li>\r
+ <xsl:call-template name="PrintElementRef">\r
+ <xsl:with-param name="name" select="@name"/>\r
+ </xsl:call-template>\r
+ </li>\r
+ <!-- Recursively find members of a substitution group that \r
+ current element in list might head, since substitution \r
+ groups are transitive (unless 'substitution' is \r
+ blocked). \r
+ -->\r
+ <xsl:if test="not(contains($block, 'substitution'))">\r
+ <xsl:call-template name="PrintSGroupMembers">\r
+ <xsl:with-param name="element" select="."/>\r
+ <xsl:with-param name="elementList" select="concat($elementList, '*', $elemName, '+')"/>\r
+ </xsl:call-template>\r
+ </xsl:if>\r
+ </xsl:for-each>\r
+ </xsl:otherwise>\r
+ </xsl:choose>\r
+ </xsl:template>\r
+\r
+ <!--\r
+ Prints out the super types of a given type definition.\r
+ Param(s):\r
+ type (Node) required\r
+ Type definition\r
+ isCallingType (boolean) optional\r
+ If true, 'type' is the type definition that starts \r
+ this call. Otherwise, this is a recursive call from \r
+ 'PrintSupertypes' itself.\r
+ typeList (String) optional\r
+ List of types in this call chain. Name of type starts\r
+ with '*', and ends with '+'. (Used to prevent infinite\r
+ recursive loop.)\r
+ -->\r
+ <xsl:template name="PrintSupertypes">\r
+ <xsl:param name="type"/>\r
+ <xsl:param name="isCallingType">true</xsl:param>\r
+ <xsl:param name="typeList"/>\r
+\r
+ <xsl:variable name="typeName" select="$type/@name"/>\r
+ <xsl:choose>\r
+ <!-- Circular type hierarchy -->\r
+ <xsl:when test="contains($typeList, concat('*', $typeName, '+'))">\r
+ <!-- Note: Error message will be written out in the Sample Instance table. -->\r
+ <xsl:value-of select="$typeName"/>\r
+ </xsl:when>\r
+ <xsl:otherwise>\r
+ <!-- Get base type reference -->\r
+ <xsl:variable name="baseTypeRef">\r
+ <xsl:choose>\r
+ <!-- Complex type definition -->\r
+ <xsl:when test="local-name($type)='complexType'">\r
+ <xsl:choose>\r
+ <xsl:when test="$type/xsd:simpleContent/xsd:extension">\r
+ <xsl:value-of select="$type/xsd:simpleContent/xsd:extension/@base"/>\r
+ </xsl:when>\r
+ <xsl:when test="$type/xsd:simpleContent/xsd:restriction">\r
+ <xsl:value-of select="$type/xsd:simpleContent/xsd:restriction/@base"/>\r
+ </xsl:when>\r
+ <xsl:when test="$type/xsd:complexContent/xsd:extension">\r
+ <xsl:value-of select="$type/xsd:complexContent/xsd:extension/@base"/>\r
+ </xsl:when>\r
+ <xsl:when test="$type/xsd:complexContent/xsd:restriction">\r
+ <xsl:value-of select="$type/xsd:complexContent/xsd:restriction/@base"/>\r
+ </xsl:when>\r
+ </xsl:choose>\r
+ </xsl:when>\r
+ <!-- Simple type definition -->\r
+ <xsl:when test="local-name($type)='simpleType'">\r
+ <xsl:choose>\r
+ <xsl:when test="$type/xsd:restriction/@base">\r
+ <xsl:value-of select="$type/xsd:restriction/@base"/>\r
+ </xsl:when>\r
+ <xsl:when test="$type/xsd:restriction/xsd:simpleType">\r
+ <xsl:text>Local type definition</xsl:text>\r
+ </xsl:when>\r
+ </xsl:choose>\r
+ </xsl:when>\r
+ </xsl:choose>\r
+ </xsl:variable>\r
+\r
+ <!-- Get derivation method -->\r
+ <xsl:variable name="derive">\r
+ <!-- Complex type definition -->\r
+ <xsl:choose>\r
+ <xsl:when test="local-name($type)='complexType'">\r
+ <xsl:choose>\r
+ <xsl:when test="$type/xsd:simpleContent/xsd:extension or $type/xsd:complexContent/xsd:extension">\r
+ <xsl:text>extension</xsl:text>\r
+ </xsl:when>\r
+ <xsl:when test="$type/xsd:simpleContent/xsd:restriction or $type/xsd:complexContent/xsd:restriction">\r
+ <xsl:text>restriction</xsl:text>\r
+ </xsl:when>\r
+ </xsl:choose>\r
+ </xsl:when>\r
+ <!-- Simple type definition -->\r
+ <xsl:when test="local-name($type)='simpleType'">\r
+ <xsl:text>restriction</xsl:text>\r
+ </xsl:when>\r
+ </xsl:choose>\r
+ </xsl:variable>\r
+\r
+ <xsl:choose>\r
+ <!-- Print out entire hierarchy -->\r
+ <xsl:when test="normalize-space(translate($printAllSuperTypes, 'TRUE', 'true'))='true'">\r
+ <xsl:choose>\r
+ <xsl:when test="normalize-space($baseTypeRef)='Local type definition'">\r
+ <xsl:value-of select="$baseTypeRef"/>\r
+ <!-- Symbol to indicate type derivation-->\r
+ <xsl:text> < </xsl:text>\r
+ </xsl:when>\r
+ <xsl:when test="normalize-space($baseTypeRef)!=''">\r
+ <!-- Get base type name from reference -->\r
+ <xsl:variable name="baseTypeName">\r
+ <xsl:call-template name="GetRefName">\r
+ <xsl:with-param name="ref" select="$baseTypeRef"/>\r
+ </xsl:call-template>\r
+ </xsl:variable>\r
+ <!-- Get base type definition from schema -->\r
+ <xsl:variable name="baseType" select="key('type', $baseTypeName)"/>\r
+ <xsl:choose>\r
+ <!-- Base type was found in this schema -->\r
+ <xsl:when test="$baseType">\r
+ <!-- Make recursive call to print out base type and itself -->\r
+ <xsl:call-template name="PrintSupertypes">\r
+ <xsl:with-param name="type" select="$baseType"/>\r
+ <xsl:with-param name="isCallingType">false</xsl:with-param>\r
+ <xsl:with-param name="typeList" select="concat($typeList, '*', $typeName, '+')"/>\r
+ </xsl:call-template>\r
+ </xsl:when>\r
+ <!-- Base type was not found in this schema -->\r
+ <xsl:otherwise>\r
+ <xsl:call-template name="PrintTypeRef">\r
+ <xsl:with-param name="ref" select="$baseTypeRef"/>\r
+ </xsl:call-template>\r
+ </xsl:otherwise>\r
+ </xsl:choose>\r
+ <!-- Symbol to indicate type derivation -->\r
+ <xsl:text> < </xsl:text>\r
+ </xsl:when>\r
+ <xsl:otherwise>\r
+ <!-- IGNORE: Base type may not be exist probably because \r
+ current type does not be derived from another type.\r
+ -->\r
+ </xsl:otherwise>\r
+ </xsl:choose>\r
+ <!-- Print out current type's name -->\r
+ <xsl:choose>\r
+ <xsl:when test="$isCallingType='true'">\r
+ <strong><xsl:value-of select="$typeName"/></strong>\r
+ </xsl:when>\r
+ <xsl:otherwise>\r
+ <xsl:call-template name="PrintTypeRef">\r
+ <xsl:with-param name="name" select="$typeName"/>\r
+ </xsl:call-template>\r
+ </xsl:otherwise>\r
+ </xsl:choose>\r
+ <!-- Print out derivation method -->\r
+ <xsl:if test="$derive != ''">\r
+ <xsl:text> (by </xsl:text>\r
+ <xsl:value-of select="$derive"/>\r
+ <xsl:text>)</xsl:text>\r
+ </xsl:if>\r
+ </xsl:when>\r
+ <!-- Print out parent type only -->\r
+ <xsl:otherwise>\r
+ <!-- Print out base type reference -->\r
+ <xsl:choose>\r
+ <xsl:when test="normalize-space($baseTypeRef)='Local type definition'">\r
+ <xsl:value-of select="$baseTypeRef"/>\r
+ </xsl:when>\r
+ <xsl:when test="$baseTypeRef!=''">\r
+ <xsl:call-template name="PrintTypeRef">\r
+ <xsl:with-param name="ref" select="$baseTypeRef"/>\r
+ </xsl:call-template>\r
+ </xsl:when>\r
+ <xsl:otherwise>\r
+ <!-- IGNORE: Base type may not be exist probably because \r
+ current type does not be derived from another type.\r
+ -->\r
+ </xsl:otherwise>\r
+ </xsl:choose>\r
+ <!-- Print out derivation method -->\r
+ <xsl:if test="$derive != ''">\r
+ <xsl:text> (derivation method: </xsl:text>\r
+ <xsl:value-of select="$derive"/>\r
+ <xsl:text>)</xsl:text>\r
+ </xsl:if>\r
+ </xsl:otherwise>\r
+ </xsl:choose>\r
+ </xsl:otherwise>\r
+ </xsl:choose>\r
+ </xsl:template>\r
+\r
+ <!--\r
+ Prints out the sub types of a given complex type definition.\r
+ Param(s):\r
+ type (Node) required\r
+ Complex type definition\r
+ isCallingType (boolean) optional\r
+ If true, 'type' is the type definition that starts this \r
+ call. Otherwise, this is a recursive call from \r
+ 'PrintComplexSubtypes' itself.\r
+ typeList (String) optional\r
+ List of types in this call chain. Name of type starts\r
+ with '*', and ends with '+'. (Used to prevent infinite\r
+ recursive loop.)\r
+ -->\r
+ <xsl:template name="PrintComplexSubtypes">\r
+ <xsl:param name="type"/>\r
+ <xsl:param name="isCallingType">true</xsl:param>\r
+ <xsl:param name="typeList"/>\r
+\r
+ <xsl:variable name="typeName" select="normalize-space($type/@name)"/>\r
+ <xsl:choose>\r
+ <!-- Circular type hierarchy -->\r
+ <xsl:when test="contains($typeList, concat('*', $typeName, '+'))">\r
+ <!-- Do nothing. Note: Error message will be written out in the Sample Instance table. -->\r
+ </xsl:when>\r
+ <xsl:otherwise>\r
+ <!-- Find sub types -->\r
+ <xsl:variable name="subTypes">\r
+ <ul>\r
+ <xsl:for-each select="/xsd:schema/xsd:complexType/xsd:complexContent/xsd:restriction[normalize-space(@base)=$typeName or normalize-space(substring-after(@base, ':'))=$typeName] | /xsd:schema/xsd:complexType/xsd:complexContent/xsd:extension[normalize-space(@base)=$typeName or normalize-space(substring-after(@base, ':'))=$typeName]">\r
+ <li>\r
+ <xsl:variable name="subType" select="../.."/>\r
+ <!-- Write out type name -->\r
+ <xsl:call-template name="PrintTypeRef">\r
+ <xsl:with-param name="name" select="$subType/@name"/>\r
+ </xsl:call-template>\r
+ <!-- Write derivation method -->\r
+ <xsl:text> (by </xsl:text>\r
+ <xsl:value-of select="local-name(.)"/>\r
+ <xsl:text>)</xsl:text>\r
+ <!-- Make recursive call to write sub-types of this sub-type -->\r
+ <xsl:if test="normalize-space(translate($printAllSubTypes, 'TRUE', 'true'))='true'">\r
+ <xsl:call-template name="PrintComplexSubtypes">\r
+ <xsl:with-param name="type" select="$subType"/>\r
+ <xsl:with-param name="isCallingType">false</xsl:with-param>\r
+ <xsl:with-param name="typeList" select="concat($typeList, '*', $typeName, '+')"/>\r
+ </xsl:call-template>\r
+ </xsl:if>\r
+ </li>\r
+ </xsl:for-each>\r
+ </ul>\r
+ </xsl:variable>\r
+ <!-- Print out sub types -->\r
+ <xsl:choose>\r
+ <xsl:when test="normalize-space($subTypes)!=''">\r
+ <xsl:copy-of select="$subTypes"/>\r
+ </xsl:when>\r
+ <xsl:when test="$isCallingType='true'">\r
+ <xsl:text>None</xsl:text>\r
+ </xsl:when>\r
+ </xsl:choose>\r
+ </xsl:otherwise>\r
+ </xsl:choose>\r
+ </xsl:template>\r
+\r
+ <!--\r
+ Prints out the sub types of a given simple type definition.\r
+ Param(s):\r
+ type (Node) required\r
+ Simple type definition\r
+ isCallingType (boolean) optional\r
+ If true, 'type' is the type definition that starts this \r
+ call. Otherwise, this is a recursive call from \r
+ 'PrintSimpleSubtypes'\r
+ typeList (String) optional\r
+ List of types in this call chain. Name of type starts\r
+ with '*', and ends with '+'. (Used to prevent infinite\r
+ recursive loop.)\r
+ -->\r
+ <xsl:template name="PrintSimpleSubtypes">\r
+ <xsl:param name="type"/>\r
+ <xsl:param name="isCallingType">true</xsl:param>\r
+ <xsl:param name="typeList"/>\r
+\r
+ <xsl:variable name="typeName" select="normalize-space($type/@name)"/>\r
+ <xsl:choose>\r
+ <!-- Circular type hierarchy -->\r
+ <xsl:when test="contains($typeList, concat('*', $typeName, '+'))">\r
+ <!-- Do nothing. Note: Error message will be written out in the Sample Instance table. -->\r
+ </xsl:when>\r
+ <xsl:otherwise>\r
+ <!-- Find sub-types that are simple type definitions -->\r
+ <xsl:variable name="simpleSubTypes">\r
+ <ul>\r
+ <xsl:for-each select="/xsd:schema/xsd:simpleType/xsd:restriction[normalize-space(@base)=$typeName or normalize-space(substring-after(@base, ':'))=$typeName]">\r
+ <li>\r
+ <xsl:variable name="subType" select=".."/>\r
+ <!-- Write out type name -->\r
+ <xsl:call-template name="PrintTypeRef">\r
+ <xsl:with-param name="name" select="$subType/@name"/>\r
+ </xsl:call-template>\r
+ <!-- Write derivation method -->\r
+ <xsl:text> (by restriction)</xsl:text>\r
+ <!-- Make recursive call to write sub-types of this sub-type -->\r
+ <xsl:if test="normalize-space(translate($printAllSubTypes, 'TRUE', 'true'))='true'">\r
+ <xsl:call-template name="PrintSimpleSubtypes">\r
+ <xsl:with-param name="type" select="$subType"/>\r
+ <xsl:with-param name="isCallingType">false</xsl:with-param>\r
+ <xsl:with-param name="typeList" select="concat($typeList, '*', $typeName, '+')"/>\r
+ </xsl:call-template>\r
+ </xsl:if>\r
+ </li>\r
+ </xsl:for-each>\r
+ </ul>\r
+ </xsl:variable>\r
+ <!-- Find sub-types that are complex type definitions -->\r
+ <xsl:variable name="complexSubTypes">\r
+ <ul>\r
+ <xsl:for-each select="/xsd:schema/xsd:complexType/xsd:simpleContent/xsd:restriction[normalize-space(@base)=$typeName or normalize-space(substring-after(@base, ':'))=$typeName] | /xsd:schema/xsd:complexType/xsd:simpleContent/xsd:extension[normalize-space(@base)=$typeName or normalize-space(substring-after(@base, ':'))=$typeName]">\r
+ <li>\r
+ <xsl:variable name="subType" select="../.."/>\r
+ <!-- Write out type name -->\r
+ <xsl:call-template name="PrintTypeRef">\r
+ <xsl:with-param name="name" select="$subType/@name"/>\r
+ </xsl:call-template>\r
+ <!-- Write derivation method -->\r
+ <xsl:text> (by </xsl:text>\r
+ <xsl:value-of select="local-name(.)"/>\r
+ <xsl:text>)</xsl:text>\r
+ <!-- Make recursive call to write sub-types of this sub-type -->\r
+ <xsl:if test="normalize-space(translate($printAllSubTypes, 'TRUE', 'true'))='true'">\r
+ <xsl:call-template name="PrintComplexSubtypes">\r
+ <xsl:with-param name="type" select="$subType"/>\r
+ <xsl:with-param name="isCallingType">false</xsl:with-param>\r
+ <xsl:with-param name="typeList" select="concat($typeList, '*', $typeName, '+')"/>\r
+ </xsl:call-template>\r
+ </xsl:if>\r
+ </li>\r
+ </xsl:for-each>\r
+ </ul>\r
+ </xsl:variable>\r
+\r
+ <xsl:variable name="hasSimpleSubTypes">\r
+ <xsl:if test="normalize-space($simpleSubTypes)!=''">\r
+ <xsl:text>true</xsl:text>\r
+ </xsl:if>\r
+ </xsl:variable>\r
+ <xsl:variable name="hasComplexSubTypes">\r
+ <xsl:if test="normalize-space($complexSubTypes)!=''">\r
+ <xsl:text>true</xsl:text>\r
+ </xsl:if>\r
+ </xsl:variable>\r
+ <!-- Print out sub types -->\r
+ <xsl:choose>\r
+ <xsl:when test="$hasSimpleSubTypes='true' or $hasComplexSubTypes='true'">\r
+ <xsl:if test="$hasSimpleSubTypes='true'">\r
+ <xsl:copy-of select="$simpleSubTypes"/>\r
+ </xsl:if>\r
+ <xsl:if test="$hasComplexSubTypes='true'">\r
+ <xsl:copy-of select="$complexSubTypes"/>\r
+ </xsl:if>\r
+ </xsl:when>\r
+ <xsl:when test="$isCallingType='true'">\r
+ <xsl:text>None</xsl:text>\r
+ </xsl:when>\r
+ </xsl:choose>\r
+ </xsl:otherwise>\r
+ </xsl:choose>\r
+ </xsl:template>\r
+\r
+\r
+ <!-- ******** Properties table ******** -->\r
+\r
+ <!--\r
+ Prints out the contents of an 'appinfo' or a 'documentation'\r
+ element in the Properties table.\r
+ -->\r
+ <xsl:template match="xsd:appinfo | xsd:documentation" mode="properties">\r
+ <!-- Print out children using XML pretty printer templates -->\r
+ <xsl:choose>\r
+ <xsl:when test="local-name(.)='appinfo'">\r
+ <xsl:apply-templates select="* | text()" mode="xpp"/>\r
+ </xsl:when>\r
+ <xsl:otherwise>\r
+ <xsl:apply-templates select="* | text()" mode="html"/>\r
+ </xsl:otherwise>\r
+ </xsl:choose>\r
+\r
+ <!-- Print out URL in the source attribute. -->\r
+ <xsl:if test="@source">\r
+ <xsl:if test="* | text()"><br/></xsl:if>\r
+ <xsl:text> More information at: </xsl:text>\r
+ <xsl:call-template name="PrintURI">\r
+ <xsl:with-param name="uri" select="@source"/>\r
+ </xsl:call-template>\r
+ <xsl:text>.</xsl:text>\r
+ </xsl:if>\r
+ </xsl:template>\r
+\r
+ <!--\r
+ Prints out the Properties table for a top-level\r
+ attribute declaration.\r
+ -->\r
+ <xsl:template match="xsd:attribute" mode="properties">\r
+ <table class="properties">\r
+ <!-- Name -->\r
+ <tr>\r
+ <th>Name</th>\r
+ <td><xsl:value-of select="@name"/></td>\r
+ </tr>\r
+ <!-- Type -->\r
+ <tr>\r
+ <th>Type</th>\r
+ <td>\r
+ <xsl:choose>\r
+ <xsl:when test="xsd:simpleType">\r
+ <xsl:text>Locally-defined simple type</xsl:text>\r
+ </xsl:when>\r
+ <xsl:when test="@type">\r
+ <xsl:call-template name="PrintTypeRef">\r
+ <xsl:with-param name="ref" select="@type"/>\r
+ </xsl:call-template>\r
+ </xsl:when>\r
+ <xsl:otherwise>\r
+ <xsl:text>anySimpleType</xsl:text>\r
+ </xsl:otherwise>\r
+ </xsl:choose>\r
+ </td>\r
+ </tr>\r
+ <!-- Default Value -->\r
+ <xsl:if test="@default">\r
+ <tr>\r
+ <th>Default Value</th>\r
+ <td><xsl:value-of select="@default"/></td>\r
+ </tr>\r
+ </xsl:if>\r
+ <!-- Fixed Value -->\r
+ <xsl:if test="@fixed">\r
+ <tr>\r
+ <th>Fixed Value</th>\r
+ <td><xsl:value-of select="@fixed"/></td>\r
+ </tr>\r
+ </xsl:if>\r
+ <!-- Annotation -->\r
+ <xsl:call-template name="PrintAnnotation">\r
+ <xsl:with-param name="component" select="."/>\r
+ </xsl:call-template>\r
+ </table>\r
+ </xsl:template>\r
+\r
+ <!--\r
+ Prints out Properties table for a top-level\r
+ attribute group or model group definition.\r
+ -->\r
+ <xsl:template match="xsd:attributeGroup | xsd:group" mode="properties">\r
+ <table class="properties">\r
+ <!-- Name -->\r
+ <tr>\r
+ <th>Name</th>\r
+ <td><xsl:value-of select="@name"/></td>\r
+ </tr>\r
+ <!-- Annotation -->\r
+ <xsl:call-template name="PrintAnnotation">\r
+ <xsl:with-param name="component" select="."/>\r
+ </xsl:call-template>\r
+ </table>\r
+ </xsl:template>\r
+\r
+ <!--\r
+ Prints out the Properties table for a top-level\r
+ complex type definition.\r
+ -->\r
+ <xsl:template match="xsd:complexType" mode="properties">\r
+ <table class="properties">\r
+ <!-- Name -->\r
+ <tr>\r
+ <th>Name</th>\r
+ <td><xsl:value-of select="@name"/></td>\r
+ </tr>\r
+ <!-- Abstract -->\r
+ <tr>\r
+ <th>\r
+ <xsl:call-template name="PrintGlossaryTermRef">\r
+ <xsl:with-param name="code">Abstract</xsl:with-param>\r
+ <xsl:with-param name="term">Abstract</xsl:with-param>\r
+ </xsl:call-template>\r
+ </th>\r
+ <td>\r
+ <xsl:call-template name="PrintBoolean">\r
+ <xsl:with-param name="boolean" select="@abstract"/>\r
+ </xsl:call-template>\r
+ </td>\r
+ </tr>\r
+ <!-- Final -->\r
+ <xsl:variable name="final">\r
+ <xsl:call-template name="PrintDerivationSet">\r
+ <xsl:with-param name="EBV">\r
+ <xsl:choose>\r
+ <xsl:when test="@final">\r
+ <xsl:value-of select="@final"/>\r
+ </xsl:when>\r
+ <xsl:otherwise>\r
+ <xsl:value-of select="/xsd:schema/@finalDefault"/>\r
+ </xsl:otherwise>\r
+ </xsl:choose>\r
+ </xsl:with-param>\r
+ </xsl:call-template>\r
+ </xsl:variable>\r
+ <xsl:if test="normalize-space($final)!=''">\r
+ <tr>\r
+ <th>\r
+ <xsl:call-template name="PrintGlossaryTermRef">\r
+ <xsl:with-param name="code">TypeFinal</xsl:with-param>\r
+ <xsl:with-param name="term">Prohibited Derivations</xsl:with-param>\r
+ </xsl:call-template>\r
+ </th>\r
+ <td><xsl:value-of select="$final"/></td>\r
+ </tr>\r
+ </xsl:if>\r
+ <!-- Block -->\r
+ <xsl:variable name="block">\r
+ <xsl:call-template name="PrintDerivationSet">\r
+ <xsl:with-param name="EBV">\r
+ <xsl:choose>\r
+ <xsl:when test="@block">\r
+ <xsl:value-of select="@block"/>\r
+ </xsl:when>\r
+ <xsl:otherwise>\r
+ <xsl:value-of select="/xsd:schema/@blockDefault"/>\r
+ </xsl:otherwise>\r
+ </xsl:choose>\r
+ </xsl:with-param>\r
+ </xsl:call-template>\r
+ </xsl:variable>\r
+ <xsl:if test="normalize-space($block)!=''">\r
+ <tr>\r
+ <th>\r
+ <xsl:call-template name="PrintGlossaryTermRef">\r
+ <xsl:with-param name="code">TypeBlock</xsl:with-param>\r
+ <xsl:with-param name="term">Prohibited Substitutions</xsl:with-param>\r
+ </xsl:call-template>\r
+ </th>\r
+ <td><xsl:value-of select="$block"/></td>\r
+ </tr>\r
+ </xsl:if>\r
+ <!-- Annotation -->\r
+ <xsl:call-template name="PrintAnnotation">\r
+ <xsl:with-param name="component" select="."/>\r
+ </xsl:call-template>\r
+ </table>\r
+ </xsl:template>\r
+\r
+ <!--\r
+ Prints out the Properties table for a top-level\r
+ element declaration.\r
+ -->\r
+ <xsl:template match="xsd:element" mode="properties">\r
+ <table class="properties">\r
+ <!-- Name -->\r
+ <tr>\r
+ <th>Name</th>\r
+ <td><xsl:value-of select="@name"/></td>\r
+ </tr>\r
+ <!-- Type -->\r
+ <tr>\r
+ <th>Type</th>\r
+ <td>\r
+ <xsl:choose>\r
+ <xsl:when test="xsd:simpleType">\r
+ <xsl:text>Locally-defined simple type</xsl:text>\r
+ </xsl:when>\r
+ <xsl:when test="xsd:complexType">\r
+ <xsl:text>Locally-defined complex type</xsl:text>\r
+ </xsl:when>\r
+ <xsl:when test="@type">\r
+ <xsl:call-template name="PrintTypeRef">\r
+ <xsl:with-param name="ref" select="@type"/>\r
+ </xsl:call-template>\r
+ </xsl:when>\r
+ <xsl:otherwise>\r
+ <xsl:text>anyType</xsl:text>\r
+ </xsl:otherwise>\r
+ </xsl:choose>\r
+ </td>\r
+ </tr>\r
+ <!-- Nillable -->\r
+ <tr>\r
+ <th>\r
+ <xsl:call-template name="PrintGlossaryTermRef">\r
+ <xsl:with-param name="code">Nillable</xsl:with-param>\r
+ <xsl:with-param name="term">Nillable</xsl:with-param>\r
+ </xsl:call-template>\r
+ </th>\r
+ <td>\r
+ <xsl:call-template name="PrintBoolean">\r
+ <xsl:with-param name="boolean" select="@nillable"/>\r
+ </xsl:call-template>\r
+ </td>\r
+ </tr>\r
+ <!-- Abstract -->\r
+ <tr>\r
+ <th>\r
+ <xsl:call-template name="PrintGlossaryTermRef">\r
+ <xsl:with-param name="code">Abstract</xsl:with-param>\r
+ <xsl:with-param name="term">Abstract</xsl:with-param>\r
+ </xsl:call-template>\r
+ </th>\r
+ <td>\r
+ <xsl:call-template name="PrintBoolean">\r
+ <xsl:with-param name="boolean" select="@abstract"/>\r
+ </xsl:call-template>\r
+ </td>\r
+ </tr>\r
+ <!-- Default Value -->\r
+ <xsl:if test="@default">\r
+ <tr>\r
+ <th>Default Value</th>\r
+ <td><xsl:value-of select="@default"/></td>\r
+ </tr>\r
+ </xsl:if>\r
+ <!-- Fixed Value -->\r
+ <xsl:if test="@fixed">\r
+ <tr>\r
+ <th>Fixed Value</th>\r
+ <td><xsl:value-of select="@fixed"/></td>\r
+ </tr>\r
+ </xsl:if>\r
+ <!-- Final -->\r
+ <xsl:variable name="final">\r
+ <xsl:call-template name="PrintDerivationSet">\r
+ <xsl:with-param name="EBV">\r
+ <xsl:choose>\r
+ <xsl:when test="@final">\r
+ <xsl:value-of select="@final"/>\r
+ </xsl:when>\r
+ <xsl:otherwise>\r
+ <xsl:value-of select="/xsd:schema/@finalDefault"/>\r
+ </xsl:otherwise>\r
+ </xsl:choose>\r
+ </xsl:with-param>\r
+ </xsl:call-template>\r
+ </xsl:variable>\r
+ <xsl:if test="normalize-space($final)!=''">\r
+ <tr>\r
+ <th>\r
+ <xsl:call-template name="PrintGlossaryTermRef">\r
+ <xsl:with-param name="code">ElemFinal</xsl:with-param>\r
+ <xsl:with-param name="term">Substitution Group Exclusions</xsl:with-param>\r
+ </xsl:call-template>\r
+ </th>\r
+ <td><xsl:value-of select="$final"/></td>\r
+ </tr>\r
+ </xsl:if>\r
+ <!-- Block -->\r
+ <xsl:variable name="block">\r
+ <xsl:call-template name="PrintBlockSet">\r
+ <xsl:with-param name="EBV">\r
+ <xsl:choose>\r
+ <xsl:when test="@block">\r
+ <xsl:value-of select="@block"/>\r
+ </xsl:when>\r
+ <xsl:otherwise>\r
+ <xsl:value-of select="/xsd:schema/@blockDefault"/>\r
+ </xsl:otherwise>\r
+ </xsl:choose>\r
+ </xsl:with-param>\r
+ </xsl:call-template>\r
+ </xsl:variable>\r
+ <xsl:if test="normalize-space($block)!=''">\r
+ <tr>\r
+ <th>\r
+ <xsl:call-template name="PrintGlossaryTermRef">\r
+ <xsl:with-param name="code">ElemBlock</xsl:with-param>\r
+ <xsl:with-param name="term">Disallowed Substitutions</xsl:with-param>\r
+ </xsl:call-template>\r
+ </th>\r
+ <td><xsl:value-of select="$block"/></td>\r
+ </tr>\r
+ </xsl:if>\r
+ <!-- Annotation -->\r
+ <xsl:call-template name="PrintAnnotation">\r
+ <xsl:with-param name="component" select="."/>\r
+ </xsl:call-template>\r
+ </table>\r
+ </xsl:template>\r
+\r
+ <!--\r
+ Prints out the Properties table for a top-level\r
+ notation declaration.\r
+ -->\r
+ <xsl:template match="xsd:notation" mode="properties">\r
+ <table class="properties">\r
+ <!-- Name -->\r
+ <tr>\r
+ <th>Name</th>\r
+ <td><xsl:value-of select="@name"/></td>\r
+ </tr>\r
+ <!-- Public Identifier -->\r
+ <tr>\r
+ <th>Public Identifier</th>\r
+ <td><xsl:value-of select="@public"/></td>\r
+ </tr>\r
+ <!-- System Identifier -->\r
+ <xsl:if test="@system">\r
+ <tr>\r
+ <th>System Identifier</th>\r
+ <td><xsl:value-of select="@system"/></td>\r
+ </tr>\r
+ </xsl:if>\r
+ <!-- Annotation -->\r
+ <xsl:call-template name="PrintAnnotation">\r
+ <xsl:with-param name="component" select="."/>\r
+ </xsl:call-template>\r
+ </table>\r
+ </xsl:template>\r
+\r
+ <!--\r
+ Prints out the Properties table for the root\r
+ schema element.\r
+ -->\r
+ <xsl:template match="xsd:schema" mode="properties">\r
+ <table class="properties">\r
+ <!-- Target Namespace -->\r
+ <tr>\r
+ <th>\r
+ <xsl:call-template name="PrintGlossaryTermRef">\r
+ <xsl:with-param name="code">TargetNS</xsl:with-param>\r
+ <xsl:with-param name="term">Target Namespace</xsl:with-param>\r
+ </xsl:call-template>\r
+ </th>\r
+ <td>\r
+ <xsl:choose>\r
+ <xsl:when test="@targetNamespace">\r
+ <span class="targetNS">\r
+ <xsl:value-of select="@targetNamespace"/>\r
+ </span>\r
+ </xsl:when>\r
+ <xsl:otherwise>\r
+ <xsl:text>None</xsl:text>\r
+ </xsl:otherwise>\r
+ </xsl:choose>\r
+ </td>\r
+ </tr>\r
+ <!-- Version -->\r
+ <xsl:if test="@version">\r
+ <tr>\r
+ <th>Version</th>\r
+ <td><xsl:value-of select="@version"/></td>\r
+ </tr>\r
+ </xsl:if>\r
+ <!-- Language -->\r
+ <xsl:if test="@xml:lang">\r
+ <tr>\r
+ <th>Language</th>\r
+ <td><xsl:value-of select="@xml:lang"/></td>\r
+ </tr>\r
+ </xsl:if>\r
+ <!-- Element/Attribute Form Defaults -->\r
+ <tr>\r
+ <th>Element and Attribute Namespaces</th>\r
+ <td>\r
+ <ul>\r
+ <li>Global element and attribute declarations belong to this schema's target namespace.</li>\r
+ <li>\r
+ <xsl:choose>\r
+ <xsl:when test="normalize-space(@elementFormDefault)='qualified'">\r
+ <xsl:text>By default, local element declarations belong to this schema's target namespace.</xsl:text>\r
+ </xsl:when>\r
+ <xsl:otherwise>\r
+ <xsl:text>By default, local element declarations have no namespace.</xsl:text>\r
+ </xsl:otherwise>\r
+ </xsl:choose>\r
+ </li>\r
+ <li>\r
+ <xsl:choose>\r
+ <xsl:when test="normalize-space(@attributeFormDefault)='qualified'">\r
+ <xsl:text>By default, local attribute declarations belong to this schema's target namespace.</xsl:text>\r
+ </xsl:when>\r
+ <xsl:otherwise>\r
+ <xsl:text>By default, local attribute declarations have no namespace.</xsl:text>\r
+ </xsl:otherwise>\r
+ </xsl:choose>\r
+ </li>\r
+ </ul>\r
+ </td>\r
+ </tr>\r
+ <!-- Schema Composition, e.g. include, import, redefine -->\r
+ <xsl:if test="xsd:include or xsd:import or xsd:redefine">\r
+ <tr>\r
+ <th>Schema Composition</th>\r
+ <td>\r
+ <ul>\r
+ <!-- Import -->\r
+ <xsl:if test="xsd:import">\r
+ <li>\r
+ <xsl:text>This schema imports schema(s) from the following namespace(s):</xsl:text>\r
+ <ul>\r
+ <xsl:for-each select="xsd:import">\r
+ <li>\r
+ <em><xsl:value-of select="@namespace"/></em>\r
+ <xsl:if test="@schemaLocation">\r
+ <xsl:text> (at </xsl:text>\r
+ <xsl:call-template name="PrintSchemaLink">\r
+ <xsl:with-param name="uri" select="@schemaLocation"/>\r
+ </xsl:call-template>\r
+ <xsl:text>)</xsl:text>\r
+ </xsl:if>\r
+ </li>\r
+ </xsl:for-each>\r
+ </ul>\r
+ </li>\r
+ </xsl:if>\r
+ <!-- Include -->\r
+ <xsl:if test="xsd:include">\r
+ <li>\r
+ <xsl:text>This schema includes components from the following schema document(s):</xsl:text>\r
+ <ul>\r
+ <xsl:for-each select="xsd:include">\r
+ <li>\r
+ <xsl:call-template name="PrintSchemaLink">\r
+ <xsl:with-param name="uri" select="@schemaLocation"/>\r
+ </xsl:call-template>\r
+ </li>\r
+ </xsl:for-each>\r
+ </ul>\r
+ </li>\r
+ </xsl:if>\r
+ <!-- Redefine -->\r
+ <xsl:if test="xsd:redefine">\r
+ <li>\r
+ <xsl:text>This schema includes components from the following schema document(s), where some of the components have been redefined:</xsl:text>\r
+ <ul>\r
+ <xsl:for-each select="xsd:redefine">\r
+ <li>\r
+ <xsl:call-template name="PrintSchemaLink">\r
+ <xsl:with-param name="uri" select="@schemaLocation"/>\r
+ </xsl:call-template>\r
+ </li>\r
+ </xsl:for-each>\r
+ </ul>\r
+ <xsl:text>See </xsl:text><a href="#Redefinitions">Redefined Schema Components</a><xsl:text> section.</xsl:text>\r
+ </li>\r
+ </xsl:if>\r
+ </ul>\r
+ </td>\r
+ </tr>\r
+ </xsl:if>\r
+ <!-- Annotation -->\r
+ <xsl:call-template name="PrintAnnotation">\r
+ <xsl:with-param name="component" select="."/>\r
+ </xsl:call-template>\r
+ </table>\r
+ </xsl:template>\r
+\r
+ <!--\r
+ Prints out the Properties table for a top-level\r
+ simple type definition.\r
+ -->\r
+ <xsl:template match="xsd:simpleType" mode="properties">\r
+ <table class="properties">\r
+ <!-- Name -->\r
+ <tr>\r
+ <th>Name</th>\r
+ <td><xsl:value-of select="@name"/></td>\r
+ </tr>\r
+ <!-- Constraints -->\r
+ <tr>\r
+ <th>Content</th>\r
+ <td>\r
+ <xsl:call-template name="PrintSimpleConstraints">\r
+ <xsl:with-param name="simpleContent" select="."/>\r
+ </xsl:call-template>\r
+ </td>\r
+ </tr>\r
+ <!-- Final -->\r
+ <xsl:variable name="final">\r
+ <xsl:call-template name="PrintSimpleDerivationSet">\r
+ <xsl:with-param name="EBV">\r
+ <xsl:choose>\r
+ <xsl:when test="@final">\r
+ <xsl:value-of select="@final"/>\r
+ </xsl:when>\r
+ <xsl:otherwise>\r
+ <xsl:value-of select="/xsd:schema/@finalDefault"/>\r
+ </xsl:otherwise>\r
+ </xsl:choose>\r
+ </xsl:with-param>\r
+ </xsl:call-template>\r
+ </xsl:variable>\r
+ <xsl:if test="normalize-space($final)!=''">\r
+ <tr>\r
+ <th>\r
+ <xsl:call-template name="PrintGlossaryTermRef">\r
+ <xsl:with-param name="code">TypeFinal</xsl:with-param>\r
+ <xsl:with-param name="term">Prohibited Derivations</xsl:with-param>\r
+ </xsl:call-template>\r
+ </th>\r
+ <td><xsl:value-of select="$final"/></td>\r
+ </tr>\r
+ </xsl:if>\r
+ <!-- Annotation -->\r
+ <xsl:call-template name="PrintAnnotation">\r
+ <xsl:with-param name="component" select="."/>\r
+ </xsl:call-template>\r
+ </table>\r
+ </xsl:template>\r
+\r
+ <!--\r
+ Unmatched template for 'properties' mode\r
+ -->\r
+ <xsl:template match="*" mode="properties"/>\r
+\r
+ <!--\r
+ Prints out the rows to display 'annotation' elements of an \r
+ component in the Properties table. This template assumes it \r
+ will be called within an HTML 'table' element.\r
+ Param(s):\r
+ component (Node) required\r
+ Schema component\r
+ -->\r
+ <xsl:template name="PrintAnnotation">\r
+ <xsl:param name="component"/>\r
+\r
+ <xsl:if test="$component/xsd:annotation/xsd:documentation">\r
+ <tr>\r
+ <th>Documentation</th>\r
+ <td>\r
+ <xsl:for-each select="$component/xsd:annotation/xsd:documentation">\r
+ <xsl:if test="position()!=1"><br/><br/></xsl:if>\r
+ <xsl:apply-templates select="." mode="properties"/>\r
+ </xsl:for-each>\r
+ </td>\r
+ </tr>\r
+ </xsl:if>\r
+ <xsl:if test="$component/xsd:annotation/xsd:appinfo">\r
+ <tr>\r
+ <th>Application Data</th>\r
+ <td>\r
+ <xsl:for-each select="$component/xsd:annotation/xsd:appinfo">\r
+ <xsl:if test="position()!=1"><br/><br/></xsl:if>\r
+ <xsl:apply-templates select="." mode="properties"/>\r
+ </xsl:for-each>\r
+ </td>\r
+ </tr>\r
+ </xsl:if>\r
+ </xsl:template>\r
+\r
+ <!--\r
+ Prints out the constraints of simple content\r
+ to be displayed within a Properties table.\r
+ Param(s):\r
+ simpleContent (Node) required\r
+ Node containing the simple content\r
+ typeList (String) optional\r
+ List of types in this call chain. Name of type starts\r
+ with '*', and ends with '+'. (Used to prevent infinite\r
+ recursive loop.)\r
+ -->\r
+ <xsl:template name="PrintSimpleConstraints">\r
+ <xsl:param name="simpleContent"/>\r
+ <xsl:param name="typeList"/>\r
+\r
+ <xsl:choose>\r
+ <!-- Derivation by restriction -->\r
+ <xsl:when test="$simpleContent/xsd:restriction">\r
+ <xsl:call-template name="PrintSimpleRestriction">\r
+ <xsl:with-param name="restriction" select="$simpleContent/xsd:restriction"/>\r
+ <xsl:with-param name="typeList" select="$typeList"/>\r
+ </xsl:call-template>\r
+ </xsl:when>\r
+ <!-- Derivation by list -->\r
+ <xsl:when test="$simpleContent/xsd:list">\r
+ <ul><li>\r
+ <xsl:text>List of: </xsl:text>\r
+ <xsl:choose>\r
+ <!-- Globally-defined item type -->\r
+ <xsl:when test="$simpleContent/xsd:list/@itemType">\r
+ <xsl:call-template name="PrintTypeRef">\r
+ <xsl:with-param name="ref" select="$simpleContent/xsd:list/@itemType"/>\r
+ </xsl:call-template>\r
+ </xsl:when>\r
+ <!-- Locally-defined item type -->\r
+ <xsl:otherwise>\r
+ <ul>\r
+ <li>\r
+ <xsl:text>Locally defined type:</xsl:text>\r
+ <xsl:call-template name="PrintSimpleConstraints">\r
+ <xsl:with-param name="simpleContent" select="$simpleContent/xsd:list/xsd:simpleType"/>\r
+ <xsl:with-param name="typeList" select="$typeList"/>\r
+ </xsl:call-template>\r
+ </li>\r
+ </ul>\r
+ </xsl:otherwise>\r
+ </xsl:choose>\r
+ </li></ul>\r
+ </xsl:when>\r
+ <!-- Derivation by union -->\r
+ <xsl:when test="$simpleContent/xsd:union">\r
+ <ul><li>\r
+ <xsl:text>Union of following types: </xsl:text>\r
+ <ul>\r
+ <!-- Globally-defined member types -->\r
+ <xsl:if test="$simpleContent/xsd:union/@memberTypes">\r
+ <xsl:call-template name="PrintWhitespaceList">\r
+ <xsl:with-param name="value" select="$simpleContent/xsd:union/@memberTypes"/>\r
+ <xsl:with-param name="compType">type</xsl:with-param>\r
+ <xsl:with-param name="isInList">true</xsl:with-param>\r
+ </xsl:call-template>\r
+ </xsl:if>\r
+ <!-- Locally-defined member types -->\r
+ <xsl:for-each select="$simpleContent/xsd:union/xsd:simpleType">\r
+ <li>\r
+ <xsl:text>Locally defined type:</xsl:text>\r
+ <xsl:call-template name="PrintSimpleConstraints">\r
+ <xsl:with-param name="simpleContent" select="."/>\r
+ <xsl:with-param name="typeList" select="$typeList"/>\r
+ </xsl:call-template>\r
+ </li>\r
+ </xsl:for-each>\r
+ </ul>\r
+ </li></ul>\r
+ </xsl:when>\r
+ </xsl:choose>\r
+ </xsl:template>\r
+\r
+ <!--\r
+ Prints out the constraints of simple content derived by \r
+ restriction, which is to be displayed in a Properties table.\r
+ Param(s):\r
+ restriction (Node) required\r
+ Node containing the restriction\r
+ typeList (String) optional\r
+ List of types in this call chain. Name of type starts\r
+ with '*', and ends with '+'. (Used to prevent infinite\r
+ recursive loop.)\r
+ -->\r
+ <xsl:template name="PrintSimpleRestriction">\r
+ <xsl:param name="restriction"/>\r
+ <xsl:param name="typeList"/>\r
+\r
+ <xsl:variable name="typeName" select="$restriction/parent::xsd:simpleType/@name"/>\r
+\r
+ <!-- Print out base type info -->\r
+ <xsl:choose>\r
+ <!-- Circular type hierarchy -->\r
+ <xsl:when test="$typeName != '' and contains($typeList, concat('*', $typeName, '+'))">\r
+ <li>\r
+ <xsl:call-template name="HandleError">\r
+ <xsl:with-param name="isTerminating">false</xsl:with-param>\r
+ <xsl:with-param name="errorMsg">\r
+ <xsl:text>Circular type reference to '</xsl:text>\r
+ <xsl:value-of select="$typeName"/>\r
+ <xsl:text>' in type hierarchy.</xsl:text>\r
+ </xsl:with-param>\r
+ </xsl:call-template>\r
+ </li>\r
+ </xsl:when>\r
+ <!-- Locally-defined base type -->\r
+ <xsl:when test="$restriction/xsd:simpleType">\r
+ <xsl:call-template name="PrintSimpleConstraints">\r
+ <xsl:with-param name="simpleContent" select="$restriction/xsd:simpleType"/>\r
+ <xsl:with-param name="typeList" select="$typeList"/>\r
+ </xsl:call-template>\r
+ </xsl:when>\r
+ <!-- Base type reference -->\r
+ <xsl:when test="$restriction">\r
+ <xsl:variable name="baseTypeRef" select="$restriction/@base"/>\r
+ <xsl:variable name="baseTypeName">\r
+ <xsl:call-template name="GetRefName">\r
+ <xsl:with-param name="ref" select="$baseTypeRef"/>\r
+ </xsl:call-template>\r
+ </xsl:variable>\r
+ <xsl:variable name="baseTypeNS">\r
+ <xsl:call-template name="GetRefNS">\r
+ <xsl:with-param name="ref" select="$baseTypeRef"/>\r
+ </xsl:call-template>\r
+ </xsl:variable>\r
+\r
+ <xsl:choose>\r
+ <!-- Base type is built-in XSD type -->\r
+ <xsl:when test="$baseTypeNS=$XSD_NS">\r
+ <ul><li>\r
+ <xsl:text>Base XSD Type: </xsl:text>\r
+ <xsl:choose>\r
+ <!-- Current schema is the schema for XSDL -->\r
+ <xsl:when test="normalize-space(/xsd:schema/@targetNamespace)=$XSD_NS">\r
+ <xsl:call-template name="PrintTypeRef">\r
+ <xsl:with-param name="ref" select="$baseTypeRef"/>\r
+ </xsl:call-template>\r
+ </xsl:when>\r
+ <!-- Current schema is not XSD namespace -->\r
+ <xsl:otherwise>\r
+ <xsl:value-of select="$baseTypeName"/>\r
+ </xsl:otherwise>\r
+ </xsl:choose>\r
+ </li></ul>\r
+ </xsl:when>\r
+ <!-- Other types -->\r
+ <xsl:otherwise>\r
+ <xsl:variable name="baseType" select="key('simpleType', $baseTypeName)"/>\r
+ <xsl:choose>\r
+ <!-- Base type found -->\r
+ <xsl:when test="$baseType">\r
+ <xsl:call-template name="PrintSimpleConstraints">\r
+ <xsl:with-param name="simpleContent" select="$baseType"/>\r
+ <xsl:with-param name="typeList" select="concat($typeList, '*', $typeName, '+')"/>\r
+ </xsl:call-template>\r
+ </xsl:when>\r
+ <!-- Base type not found -->\r
+ <xsl:otherwise>\r
+ <ul><li><strong>\r
+ <xsl:text>'</xsl:text>\r
+ <xsl:value-of select="$baseTypeName"/>\r
+ <xsl:text>' super type was not found in this schema. </xsl:text>\r
+ <xsl:text>Its facets could not be printed out.</xsl:text>\r
+ </strong></li></ul>\r
+ </xsl:otherwise>\r
+ </xsl:choose>\r
+ </xsl:otherwise>\r
+ </xsl:choose>\r
+ </xsl:when>\r
+ </xsl:choose>\r
+\r
+ <!-- Find constraints in current restriction -->\r
+ <xsl:variable name="enumeration">\r
+ <xsl:call-template name="PrintEnumFacets">\r
+ <xsl:with-param name="simpleRestrict" select="$restriction"/>\r
+ </xsl:call-template>\r
+ </xsl:variable>\r
+ <xsl:variable name="pattern">\r
+ <xsl:call-template name="PrintPatternFacet">\r
+ <xsl:with-param name="simpleRestrict" select="$restriction"/>\r
+ </xsl:call-template>\r
+ </xsl:variable>\r
+ <xsl:variable name="range">\r
+ <xsl:call-template name="PrintRangeFacets">\r
+ <xsl:with-param name="simpleRestrict" select="$restriction"/>\r
+ </xsl:call-template>\r
+ </xsl:variable>\r
+ <xsl:variable name="totalDigits">\r
+ <xsl:call-template name="PrintTotalDigitsFacet">\r
+ <xsl:with-param name="simpleRestrict" select="$restriction"/>\r
+ </xsl:call-template>\r
+ </xsl:variable>\r
+ <xsl:variable name="fractionDigits">\r
+ <xsl:call-template name="PrintFractionDigitsFacet">\r
+ <xsl:with-param name="simpleRestrict" select="$restriction"/>\r
+ </xsl:call-template>\r
+ </xsl:variable>\r
+ <xsl:variable name="length">\r
+ <xsl:call-template name="PrintLengthFacets">\r
+ <xsl:with-param name="simpleRestrict" select="$restriction"/>\r
+ </xsl:call-template>\r
+ </xsl:variable>\r
+ <xsl:variable name="whitespace">\r
+ <xsl:call-template name="PrintWhitespaceFacet">\r
+ <xsl:with-param name="simpleRestrict" select="$restriction"/>\r
+ </xsl:call-template>\r
+ </xsl:variable>\r
+\r
+ <!-- Print out facets -->\r
+ <xsl:if test="$enumeration!='' or $pattern!='' or $range!='' or $totalDigits!='' or $fractionDigits!='' or $length!='' or $whitespace!=''">\r
+ <ul>\r
+ <xsl:if test="$enumeration!=''">\r
+ <li>\r
+ <xsl:copy-of select="$enumeration"/>\r
+ </li>\r
+ </xsl:if>\r
+ <xsl:if test="$pattern!=''">\r
+ <li>\r
+ <xsl:copy-of select="$pattern"/>\r
+ </li>\r
+ </xsl:if>\r
+ <xsl:if test="$range!=''">\r
+ <li>\r
+ <xsl:copy-of select="$range"/>\r
+ </li>\r
+ </xsl:if>\r
+ <xsl:if test="$totalDigits!=''">\r
+ <li>\r
+ <xsl:copy-of select="$totalDigits"/>\r
+ </li>\r
+ </xsl:if>\r
+ <xsl:if test="$fractionDigits!=''">\r
+ <li>\r
+ <xsl:copy-of select="$fractionDigits"/>\r
+ </li>\r
+ </xsl:if>\r
+ <xsl:if test="$length!=''">\r
+ <li>\r
+ <xsl:copy-of select="$length"/>\r
+ </li>\r
+ </xsl:if>\r
+ <xsl:if test="$whitespace!=''">\r
+ <li>\r
+ <xsl:copy-of select="$whitespace"/>\r
+ </li>\r
+ </xsl:if>\r
+ </ul>\r
+ </xsl:if>\r
+ </xsl:template>\r
+\r
+\r
+ <!-- ******** XML Instance Representation table ******** -->\r
+\r
+ <!-- \r
+ Prints out the XML Instance Representation table for a top-level \r
+ schema component. \r
+ Param(s):\r
+ component (Node) required\r
+ Top-level schema component\r
+ -->\r
+ <xsl:template name="SampleInstanceTable">\r
+ <xsl:param name="component"/>\r
+\r
+ <!-- Not applicable for simple type definitions and notation \r
+ declarations -->\r
+ <xsl:if test="local-name($component)!='simpleType' and local-name($component)!='notation'">\r
+ <xsl:variable name="componentID">\r
+ <xsl:call-template name="GetComponentID">\r
+ <xsl:with-param name="component" select="$component"/>\r
+ </xsl:call-template>\r
+ </xsl:variable>\r
+\r
+ <xsl:call-template name="CollapseableBox">\r
+ <xsl:with-param name="id" select="concat($componentID, '_xibox')"/>\r
+ <xsl:with-param name="styleClass">sample</xsl:with-param>\r
+ <xsl:with-param name="caption">XML Instance Representation</xsl:with-param>\r
+ <xsl:with-param name="contents">\r
+ <xsl:apply-templates select="$component" mode="sample"/>\r
+ </xsl:with-param>\r
+ <xsl:with-param name="isOpened">true</xsl:with-param>\r
+ </xsl:call-template>\r
+ </xsl:if>\r
+ </xsl:template>\r
+\r
+ <!--\r
+ Prints out a sample XML instance representation of an 'all' \r
+ model group.\r
+ Param(s):\r
+ margin (nonNegativeInteger) optional\r
+ Number of 'em' to indent from left\r
+ isInherited (boolean) optional\r
+ If true, display elements using 'inherited' CSS class.\r
+ isNewField (boolean) optional\r
+ If true, display elements using 'newFields' CSS class.\r
+ schemaLoc (String) optional\r
+ Schema file containing this all model group;\r
+ if in current schema, 'schemaLoc' is set to 'this'\r
+ typeList (String) optional\r
+ List of types in this call chain. Name of type starts\r
+ with '*', and ends with '+'. (Used to prevent infinite\r
+ recursive loop.)\r
+ -->\r
+ <xsl:template match="xsd:all" mode="sample">\r
+ <xsl:param name="margin">0</xsl:param>\r
+ <xsl:param name="isInherited">false</xsl:param>\r
+ <xsl:param name="isNewField">false</xsl:param>\r
+ <xsl:param name="schemaLoc">this</xsl:param>\r
+ <xsl:param name="typeList"/>\r
+\r
+ <xsl:if test="normalize-space(@maxOccurs)!='0'">\r
+ <!-- Header -->\r
+ <span class="group" style="margin-left: {$margin}em">\r
+ <xsl:text>Start </xsl:text>\r
+ <xsl:call-template name="PrintGlossaryTermRef">\r
+ <xsl:with-param name="code">All</xsl:with-param>\r
+ <xsl:with-param name="term">All</xsl:with-param>\r
+ </xsl:call-template>\r
+ <!-- Min/max occurs information-->\r
+ <xsl:text> </xsl:text>\r
+ <xsl:call-template name="PrintOccurs">\r
+ <xsl:with-param name="component" select="."/>\r
+ </xsl:call-template>\r
+ <!-- Documentation -->\r
+ <xsl:call-template name="PrintSampleDocumentation">\r
+ <xsl:with-param name="component" select="."/>\r
+ </xsl:call-template>\r
+ </span><br/>\r
+\r
+ <!-- Content -->\r
+ <xsl:apply-templates select="xsd:*" mode="sample">\r
+ <xsl:with-param name="margin" select="number($margin) + number($ELEM_INDENT)"/>\r
+ <xsl:with-param name="isInherited" select="$isInherited"/>\r
+ <xsl:with-param name="isNewField" select="$isNewField"/>\r
+ <xsl:with-param name="schemaLoc" select="$schemaLoc"/>\r
+ <xsl:with-param name="typeList" select="$typeList"/>\r
+ </xsl:apply-templates>\r
+\r
+ <!-- Footer -->\r
+ <span class="group" style="margin-left: {$margin}em">\r
+ <xsl:text>End All</xsl:text>\r
+ </span><br/>\r
+ </xsl:if>\r
+ </xsl:template>\r
+\r
+ <!--\r
+ Prints out a sample XML instance representation of an element \r
+ content wild card.\r
+ Param(s):\r
+ margin (nonNegativeInteger) optional\r
+ Number of 'em' to indent from left\r
+ -->\r
+ <xsl:template match="xsd:any | xsd:anyAttribute" mode="sample">\r
+ <xsl:param name="margin">0</xsl:param>\r
+\r
+ <div class="other" style="margin-left: {$margin}em">\r
+ <xsl:call-template name="PrintWildcard">\r
+ <xsl:with-param name="componentType">\r
+ <xsl:choose>\r
+ <xsl:when test="local-name(.)='anyAttribute'">attribute</xsl:when>\r
+ <xsl:otherwise>element</xsl:otherwise>\r
+ </xsl:choose>\r
+ </xsl:with-param>\r
+ <xsl:with-param name="namespace" select="@namespace"/>\r
+ <xsl:with-param name="processContents" select="@processContents"/>\r
+ <xsl:with-param name="minOccurs" select="@minOccurs"/>\r
+ <xsl:with-param name="maxOccurs" select="@maxOccurs"/>\r
+ </xsl:call-template>\r
+ </div>\r
+ </xsl:template>\r
+\r
+ <!--\r
+ Prints out a sample XML instance representation \r
+ of an attribute declaration.\r
+ Param(s):\r
+ subTypeAttrs (String) optional\r
+ List of attributes in sub-types of the type that \r
+ contains this attribute\r
+ isInherited (boolean) optional\r
+ If true, display attribute using 'inherited' CSS \r
+ class.\r
+ isNewField (boolean) optional\r
+ If true, display attribute using 'newFields' CSS \r
+ class.\r
+ margin (nonNegativeInteger) optional\r
+ Number of 'em' to indent from left\r
+ addBR (boolean) optional\r
+ If true, add <br/> before attribute.\r
+ schemaLoc (String) optional\r
+ Schema file containing this attribute declaration;\r
+ if in current schema, 'schemaLoc' is set to 'this'.\r
+ -->\r
+ <xsl:template match="xsd:attribute[@name]" mode="sample">\r
+ <xsl:param name="subTypeAttrs"/>\r
+ <xsl:param name="isInherited">false</xsl:param>\r
+ <xsl:param name="isNewField">false</xsl:param>\r
+ <xsl:param name="margin">0</xsl:param>\r
+ <xsl:param name="addBR">false</xsl:param>\r
+ <xsl:param name="schemaLoc">this</xsl:param>\r
+\r
+ <!-- Get attribute namespace -->\r
+ <xsl:variable name="attrNS">\r
+ <xsl:call-template name="GetAttributeNS">\r
+ <xsl:with-param name="attribute" select="."/>\r
+ </xsl:call-template>\r
+ </xsl:variable>\r
+\r
+ <xsl:choose>\r
+ <xsl:when test="contains($subTypeAttrs, concat('*', normalize-space($attrNS), '+', normalize-space(@name), '+'))">\r
+ <!-- IGNORE: Sub type has attribute with same name; \r
+ Sub-type's attribute declaration will override this \r
+ one. -->\r
+ </xsl:when>\r
+ <xsl:when test="@use and normalize-space(@use)='prohibited'">\r
+ <!-- IGNORE: Attribute is prohibited. -->\r
+ </xsl:when>\r
+ <xsl:otherwise>\r
+ <xsl:if test="$addBR!='false'"><br/></xsl:if>\r
+\r
+ <span style="margin-left: {$margin}em">\r
+ <xsl:choose>\r
+ <xsl:when test="$isNewField!='false'">\r
+ <xsl:attribute name="class">newFields</xsl:attribute>\r
+ </xsl:when>\r
+ <xsl:when test="$isInherited!='false'">\r
+ <xsl:attribute name="class">inherited</xsl:attribute>\r
+ </xsl:when>\r
+ </xsl:choose>\r
+\r
+ <xsl:text> </xsl:text>\r
+ <xsl:variable name="prefix">\r
+ <xsl:call-template name="GetAttributePrefix">\r
+ <xsl:with-param name="attribute" select="."/>\r
+ </xsl:call-template>\r
+ </xsl:variable>\r
+ <xsl:call-template name="PrintNSPrefix">\r
+ <xsl:with-param name="prefix" select="$prefix"/>\r
+ <xsl:with-param name="schemaLoc" select="$schemaLoc"/> \r
+ </xsl:call-template>\r
+ <xsl:value-of select="@name"/>\r
+ <xsl:text>="</xsl:text>\r
+\r
+ <xsl:choose>\r
+ <!-- Fixed value is provided -->\r
+ <xsl:when test="@fixed">\r
+ <span class="fixed">\r
+ <xsl:value-of select="@fixed"/>\r
+ </span>\r
+ </xsl:when>\r
+ <!-- Type reference is provided -->\r
+ <xsl:when test="@type">\r
+ <xsl:call-template name="PrintTypeRef">\r
+ <xsl:with-param name="ref" select="@type"/>\r
+ <xsl:with-param name="schemaLoc" select="$schemaLoc"/>\r
+ </xsl:call-template>\r
+ </xsl:when>\r
+ <!-- Local type definition is provided -->\r
+ <xsl:when test="xsd:simpleType">\r
+ <xsl:apply-templates select="xsd:simpleType" mode="sample">\r
+ <xsl:with-param name="schemaLoc" select="$schemaLoc"/>\r
+ </xsl:apply-templates>\r
+ </xsl:when>\r
+ <xsl:otherwise>\r
+ <span class="type">anySimpleType</span>\r
+ </xsl:otherwise>\r
+ </xsl:choose>\r
+\r
+ <!-- Don't print occurrence info and documentation\r
+ for global attributes. -->\r
+ <xsl:if test="local-name(..)!='schema'">\r
+ <!-- Occurrence info-->\r
+ <xsl:text> </xsl:text>\r
+ <xsl:call-template name="PrintOccurs">\r
+ <xsl:with-param name="component" select="."/>\r
+ </xsl:call-template>\r
+ <!-- Documentation -->\r
+ <xsl:call-template name="PrintSampleDocumentation">\r
+ <xsl:with-param name="component" select="."/>\r
+ </xsl:call-template>\r
+ </xsl:if>\r
+\r
+ <xsl:text>"</xsl:text>\r
+ </span>\r
+ </xsl:otherwise>\r
+ </xsl:choose>\r
+ </xsl:template>\r
+\r
+ <!--\r
+ Prints out a sample XML instance representation \r
+ of an attribute reference.\r
+ Param(s):\r
+ subTypeAttrs (String) optional\r
+ List of attribute in sub-types of the type that \r
+ contains this attribute\r
+ isInherited (boolean) optional\r
+ If true, display attributes using 'inherited' CSS \r
+ class.\r
+ isNewField (boolean) optional\r
+ If true, display attributes using 'newFields' CSS \r
+ class.\r
+ margin (nonNegativeInteger) optional\r
+ Number of 'em' to indent from left\r
+ addBR (boolean) optional\r
+ If true, add <br/> before attribute.\r
+ schemaLoc (String) optional\r
+ Schema file containing this attribute reference;\r
+ if in current schema, 'schemaLoc' is set to 'this'\r
+ -->\r
+ <xsl:template match="xsd:attribute[@ref]" mode="sample">\r
+ <xsl:param name="subTypeAttrs"/>\r
+ <xsl:param name="isInherited">false</xsl:param>\r
+ <xsl:param name="isNewField">false</xsl:param>\r
+ <xsl:param name="margin">0</xsl:param>\r
+ <xsl:param name="addBR">false</xsl:param>\r
+ <xsl:param name="schemaLoc">this</xsl:param>\r
+\r
+ <!-- Get attribute name -->\r
+ <xsl:variable name="attrName">\r
+ <xsl:call-template name="GetRefName">\r
+ <xsl:with-param name="ref" select="@ref"/>\r
+ </xsl:call-template>\r
+ </xsl:variable>\r
+\r
+ <!-- Get attribute namespace -->\r
+ <xsl:variable name="attrNS">\r
+ <xsl:call-template name="GetAttributeNS">\r
+ <xsl:with-param name="attribute" select="."/>\r
+ </xsl:call-template>\r
+ </xsl:variable>\r
+\r
+ <xsl:choose>\r
+ <xsl:when test="contains($subTypeAttrs, concat('*', normalize-space($attrNS), '+', normalize-space($attrName), '+'))">\r
+ <!-- IGNORE: Sub type has attribute with same name; \r
+ Sub-type's attribute declaration will override this \r
+ one. -->\r
+ </xsl:when>\r
+ <xsl:when test="@use and normalize-space(@use)='prohibited'">\r
+ <!-- IGNORE: Attribute is prohibited. -->\r
+ </xsl:when>\r
+ <xsl:otherwise>\r
+ <xsl:if test="$addBR!='false'"><br/></xsl:if>\r
+\r
+ <span style="margin-left: {$margin}em">\r
+ <xsl:choose>\r
+ <xsl:when test="$isNewField!='false'">\r
+ <xsl:attribute name="class">newFields</xsl:attribute>\r
+ </xsl:when>\r
+ <xsl:when test="$isInherited!='false'">\r
+ <xsl:attribute name="class">inherited</xsl:attribute>\r
+ </xsl:when>\r
+ </xsl:choose>\r
+\r
+ <xsl:text> </xsl:text>\r
+ <xsl:call-template name="PrintAttributeRef">\r
+ <xsl:with-param name="ref" select="@ref"/>\r
+ <xsl:with-param name="schemaLoc" select="$schemaLoc"/>\r
+ </xsl:call-template>\r
+ <xsl:text>="</xsl:text>\r
+ <!-- Fixed value is provided -->\r
+ <xsl:if test="@fixed">\r
+ <span class="fixed">\r
+ <xsl:value-of select="@fixed"/>\r
+ </span>\r
+ <xsl:text> </xsl:text>\r
+ </xsl:if>\r
+ <!-- Print occurs info-->\r
+ <xsl:call-template name="PrintOccurs">\r
+ <xsl:with-param name="component" select="."/>\r
+ </xsl:call-template>\r
+ <!-- Documentation -->\r
+ <xsl:call-template name="PrintSampleDocumentation">\r
+ <xsl:with-param name="component" select="."/>\r
+ </xsl:call-template>\r
+\r
+ <xsl:text>"</xsl:text>\r
+ </span>\r
+ </xsl:otherwise>\r
+ </xsl:choose>\r
+ </xsl:template>\r
+\r
+ <!--\r
+ Prints out a sample XML instance representation of an attribute \r
+ group definition.\r
+ Param(s):\r
+ schemaLoc (String) optional\r
+ Schema file containing this attribute group \r
+ definition; if in current schema, 'schemaLoc' is \r
+ set to 'this'.\r
+ -->\r
+ <xsl:template match="xsd:attributeGroup[@name]" mode="sample">\r
+ <xsl:param name="schemaLoc">this</xsl:param>\r
+\r
+ <xsl:for-each select="xsd:attribute | xsd:attributeGroup | xsd:anyAttribute">\r
+ <xsl:variable name="addBR">\r
+ <xsl:choose>\r
+ <xsl:when test="position()!=1">\r
+ <xsl:text>true</xsl:text>\r
+ </xsl:when>\r
+ <xsl:otherwise>\r
+ <xsl:text>false</xsl:text>\r
+ </xsl:otherwise>\r
+ </xsl:choose>\r
+ </xsl:variable>\r
+\r
+ <xsl:apply-templates select="." mode="sample">\r
+ <xsl:with-param name="addBR" select="$addBR"/>\r
+ <xsl:with-param name="schemaLoc" select="$schemaLoc"/>\r
+ </xsl:apply-templates>\r
+ </xsl:for-each>\r
+ </xsl:template>\r
+\r
+ <!--\r
+ Prints out a sample XML instance representation of an attribute \r
+ group reference.\r
+ Param(s):\r
+ subTypeAttrs (String) optional\r
+ List of attributes in sub-types of the type that \r
+ contains this attribute group\r
+ isInherited (boolean) optional\r
+ If true, display attributes using 'inherited' CSS \r
+ class.\r
+ isNewField (boolean) optional\r
+ If true, display attributes using 'newFields' CSS \r
+ class.\r
+ margin (nonNegativeInteger) optional\r
+ Number of 'em' to indent from left\r
+ parentGroups (String) optional\r
+ List of parent attribute group definitions that \r
+ contain this attribute group. Used to prevent \r
+ infinite loops when displaying attribute group \r
+ definitions. In such a case, writes out an error \r
+ message and stops processing.\r
+ schemaLoc (String) optional\r
+ Schema file containing this attribute group \r
+ reference if in current schema, 'schemaLoc' is \r
+ set to 'this'.\r
+ -->\r
+ <xsl:template match="xsd:attributeGroup[@ref]" mode="sample">\r
+ <xsl:param name="subTypeAttrs"/>\r
+ <xsl:param name="isInherited">false</xsl:param>\r
+ <xsl:param name="isNewField">false</xsl:param>\r
+ <xsl:param name="margin">0</xsl:param>\r
+ <xsl:param name="parentGroups"/>\r
+ <xsl:param name="schemaLoc">this</xsl:param>\r
+\r
+ <!-- Get attribute group name -->\r
+ <xsl:variable name="attrGrpName">\r
+ <xsl:call-template name="GetRefName">\r
+ <xsl:with-param name="ref" select="@ref"/>\r
+ </xsl:call-template>\r
+ </xsl:variable>\r
+\r
+ <xsl:choose>\r
+ <xsl:when test="contains($parentGroups, concat('*', normalize-space($attrGrpName), '+'))">\r
+ <!-- Circular attribute group definition -->\r
+ <xsl:call-template name="HandleError">\r
+ <xsl:with-param name="isTerminating">false</xsl:with-param>\r
+ <xsl:with-param name="errorMsg">\r
+ <xsl:text>Circular attribute group reference: </xsl:text>\r
+ <xsl:value-of select="$attrGrpName"/>\r
+ </xsl:with-param>\r
+ </xsl:call-template>\r
+ </xsl:when>\r
+ <xsl:otherwise>\r
+ <!-- Look for attribute group definition -->\r
+ <xsl:variable name="defLoc">\r
+ <xsl:call-template name="FindComponent">\r
+ <xsl:with-param name="ref" select="@ref"/>\r
+ <xsl:with-param name="compType">attribute group</xsl:with-param>\r
+ </xsl:call-template>\r
+ </xsl:variable>\r
+\r
+ <xsl:choose>\r
+ <!-- Not found -->\r
+ <xsl:when test="normalize-space($defLoc)='' or normalize-space($defLoc)='none' or normalize-space($defLoc)='xml' or normalize-space($defLoc)='xsd'">\r
+ <div class="other" style="margin-left: {$margin}em">\r
+ <xsl:text>Attribute group reference (not shown): </xsl:text>\r
+ <xsl:call-template name="PrintAttributeGroupRef">\r
+ <xsl:with-param name="ref" select="@ref"/>\r
+ <xsl:with-param name="schemaLoc" select="$schemaLoc"/>\r
+ </xsl:call-template>\r
+ <!-- Documentation -->\r
+ <xsl:call-template name="PrintSampleDocumentation">\r
+ <xsl:with-param name="component" select="."/>\r
+ </xsl:call-template>\r
+ </div>\r
+ </xsl:when>\r
+ <!-- Found in current schema -->\r
+ <xsl:when test="normalize-space($defLoc)='this'">\r
+ <xsl:variable name="attrGrpDef" select="key('attributeGroup', $attrGrpName)"/>\r
+ <xsl:apply-templates select="$attrGrpDef/xsd:attribute | $attrGrpDef/xsd:attributeGroup" mode="sample">\r
+ <xsl:with-param name="subTypeAttrs" select="$subTypeAttrs"/>\r
+ <xsl:with-param name="isInherited" select="$isInherited"/>\r
+ <xsl:with-param name="isNewField" select="$isNewField"/>\r
+ <xsl:with-param name="parentGroups" select="concat($parentGroups, concat('*', normalize-space($attrGrpName), '+'))"/>\r
+ <xsl:with-param name="margin" select="$margin"/>\r
+ <xsl:with-param name="addBR">true</xsl:with-param>\r
+ <xsl:with-param name="schemaLoc" select="$schemaLoc"/>\r
+ </xsl:apply-templates>\r
+ </xsl:when>\r
+ <!-- Found in external schema -->\r
+ <xsl:otherwise>\r
+ <xsl:variable name="attrGrpDef" select="document($defLoc)/xsd:schema/xsd:attributeGroup[@name=$attrGrpName]"/>\r
+ <xsl:apply-templates select="$attrGrpDef/xsd:attribute | $attrGrpDef/xsd:attributeGroup" mode="sample">\r
+ <xsl:with-param name="subTypeAttrs" select="$subTypeAttrs"/>\r
+ <xsl:with-param name="isInherited" select="$isInherited"/>\r
+ <xsl:with-param name="isNewField" select="$isNewField"/>\r
+ <xsl:with-param name="parentGroups" select="concat($parentGroups, concat('*', normalize-space($attrGrpName), '+'))"/>\r
+ <xsl:with-param name="margin" select="$margin"/>\r
+ <xsl:with-param name="addBR">true</xsl:with-param>\r
+ <xsl:with-param name="schemaLoc" select="$defLoc"/>\r
+ </xsl:apply-templates>\r
+ </xsl:otherwise>\r
+ </xsl:choose>\r
+ </xsl:otherwise>\r
+ </xsl:choose>\r
+ </xsl:template>\r
+\r
+ <!--\r
+ Prints out a sample XML instance representation of a 'choice' \r
+ model group.\r
+ Param(s):\r
+ margin (nonNegativeInteger) optional\r
+ Number of 'em' to indent from left\r
+ isInherited (boolean) optional\r
+ If true, display elements using'inherited' CSS class.\r
+ isNewField (boolean) optional\r
+ If true, display elements using 'newFields' CSS class.\r
+ parentGroups (String) optional\r
+ List of parent model group definitions that contain this \r
+ model group. Used to prevent infinite loops when \r
+ displaying model group definitions.\r
+ schemaLoc (String) optional\r
+ Schema file containing this choice model group;\r
+ if in current schema, 'schemaLoc' is set to 'this'\r
+ typeList (String) optional\r
+ List of types in this call chain. Name of type starts\r
+ with '*', and ends with '+'. (Used to prevent infinite\r
+ recursive loop.)\r
+ -->\r
+ <xsl:template match="xsd:choice" mode="sample">\r
+ <xsl:param name="margin">0</xsl:param>\r
+ <xsl:param name="isInherited">false</xsl:param>\r
+ <xsl:param name="isNewField">false</xsl:param>\r
+ <xsl:param name="parentGroups"/>\r
+ <xsl:param name="schemaLoc">this</xsl:param>\r
+ <xsl:param name="typeList"/>\r
+\r
+ <xsl:if test="normalize-space(@maxOccurs)!='0'">\r
+ <!-- Header -->\r
+ <span class="group" style="margin-left: {$margin}em">\r
+ <xsl:text>Start </xsl:text>\r
+ <xsl:call-template name="PrintGlossaryTermRef">\r
+ <xsl:with-param name="code">Choice</xsl:with-param>\r
+ <xsl:with-param name="term">Choice</xsl:with-param>\r
+ </xsl:call-template>\r
+ <!-- Min/max occurrence -->\r
+ <xsl:text> </xsl:text>\r
+ <xsl:call-template name="PrintOccurs">\r
+ <xsl:with-param name="component" select="."/>\r
+ </xsl:call-template>\r
+ <!-- Documentation -->\r
+ <xsl:call-template name="PrintSampleDocumentation">\r
+ <xsl:with-param name="component" select="."/>\r
+ </xsl:call-template>\r
+ </span><br/>\r
+\r
+ <!-- Content -->\r
+ <xsl:apply-templates select="xsd:*" mode="sample">\r
+ <xsl:with-param name="margin" select="number($margin)+number($ELEM_INDENT)"/>\r
+ <xsl:with-param name="isInherited" select="$isInherited"/>\r
+ <xsl:with-param name="isNewField" select="$isNewField"/>\r
+ <xsl:with-param name="parentGroups" select="$parentGroups"/>\r
+ <xsl:with-param name="schemaLoc" select="$schemaLoc"/>\r
+ <xsl:with-param name="typeList" select="$typeList"/>\r
+ </xsl:apply-templates>\r
+\r
+ <!-- Footer -->\r
+ <span class="group" style="margin-left: {$margin}em">\r
+ <xsl:text>End Choice</xsl:text>\r
+ </span><br/>\r
+ </xsl:if>\r
+ </xsl:template>\r
+\r
+ <!--\r
+ Prints out a sample XML instance from a complex type definition.\r
+ Param(s):\r
+ schemaLoc (String) optional\r
+ Schema file containing this complex type definition; \r
+ if in current schema, 'schemaLoc' is set to 'this'.\r
+ -->\r
+ <xsl:template match="xsd:complexType" mode="sample">\r
+ <xsl:param name="schemaLoc">this</xsl:param>\r
+ <xsl:param name="parentGroups"/>\r
+\r
+ <xsl:call-template name="PrintSampleComplexElement">\r
+ <xsl:with-param name="type" select="."/>\r
+ <xsl:with-param name="schemaLoc" select="$schemaLoc"/>\r
+ <xsl:with-param name="parentGroups" select="$parentGroups"/>\r
+ </xsl:call-template>\r
+ </xsl:template>\r
+\r
+ <!--\r
+ Prints out a sample XML instance from an element declaration.\r
+ Param(s):\r
+ margin (nonNegativeInteger) optional\r
+ Number of 'em' to indent from left\r
+ isInherited (boolean) optional\r
+ If true, display elements using 'inherited' CSS class.\r
+ isNewField (boolean) optional\r
+ If true, display elements using 'newFields' CSS class.\r
+ schemaLoc (String) optional\r
+ Schema file containing this element declaration; \r
+ if in current schema, 'schemaLoc' is set to 'this'.\r
+ typeList (String) optional\r
+ List of types in this call chain. Name of type starts\r
+ with '*', and ends with '+'. (Used to prevent infinite\r
+ recursive loop.)\r
+ -->\r
+ <xsl:template match="xsd:element[@name]" mode="sample">\r
+ <xsl:param name="margin">0</xsl:param>\r
+ <xsl:param name="isInherited">false</xsl:param>\r
+ <xsl:param name="isNewField">false</xsl:param>\r
+ <xsl:param name="schemaLoc">this</xsl:param>\r
+ <xsl:param name="typeList"/>\r
+ <xsl:param name="parentGroups"/>\r
+\r
+ <xsl:choose>\r
+ <!-- Prohibited element declaration -->\r
+ <xsl:when test="normalize-space(@maxOccurs)='0'">\r
+ <!-- IGNORE if max occurs is zero -->\r
+ </xsl:when>\r
+ <!-- Global element declaration -->\r
+ <xsl:when test="local-name(..)='schema'">\r
+ <xsl:choose>\r
+ <!-- With type reference -->\r
+ <xsl:when test="@type">\r
+ <xsl:variable name="elemTypeName">\r
+ <xsl:call-template name="GetRefName">\r
+ <xsl:with-param name="ref" select="@type"/>\r
+ </xsl:call-template>\r
+ </xsl:variable>\r
+\r
+ <!-- Look for complex type definition -->\r
+ <xsl:variable name="defLoc">\r
+ <xsl:call-template name="FindComponent">\r
+ <xsl:with-param name="ref" select="@type"/>\r
+ <xsl:with-param name="compType">complex type</xsl:with-param>\r
+ </xsl:call-template>\r
+ </xsl:variable>\r
+\r
+ <xsl:choose>\r
+ <!-- Complex type was found in current \r
+ schema. -->\r
+ <xsl:when test="normalize-space($defLoc)='this'">\r
+ <xsl:variable name="ctype" select="key('complexType', $elemTypeName)"/>\r
+ <xsl:call-template name="PrintSampleComplexElement">\r
+ <xsl:with-param name="element" select="."/>\r
+ <xsl:with-param name="type" select="$ctype"/>\r
+ <xsl:with-param name="parentGroups" select="$parentGroups"/>\r
+ </xsl:call-template>\r
+ </xsl:when>\r
+ <!-- Complex type was not found. -->\r
+ <xsl:when test="normalize-space($defLoc)='' or normalize-space($defLoc)='none' or normalize-space($defLoc)='xml' or normalize-space($defLoc)='xsd'">\r
+ <xsl:call-template name="PrintSampleSimpleElement">\r
+ <xsl:with-param name="element" select="."/>\r
+ <xsl:with-param name="schemaLoc" select="$schemaLoc"/>\r
+ </xsl:call-template>\r
+ </xsl:when>\r
+ <!-- Complex type was found in external\r
+ schema. -->\r
+ <xsl:otherwise>\r
+ <xsl:variable name="ctype" select="document($defLoc)/xsd:schema/xsd:complexType[@name=$elemTypeName]"/>\r
+ <xsl:call-template name="PrintSampleComplexElement">\r
+ <xsl:with-param name="element" select="."/>\r
+ <xsl:with-param name="type" select="$ctype"/>\r
+ <xsl:with-param name="parentGroups" select="$parentGroups"/>\r
+ </xsl:call-template>\r
+ </xsl:otherwise>\r
+ </xsl:choose>\r
+ </xsl:when>\r
+ <!-- With local complex type definition -->\r
+ <xsl:when test="xsd:complexType">\r
+ <xsl:call-template name="PrintSampleComplexElement">\r
+ <xsl:with-param name="element" select="."/>\r
+ <xsl:with-param name="type" select="xsd:complexType"/>\r
+ <xsl:with-param name="schemaLoc" select="$schemaLoc"/>\r
+ <xsl:with-param name="parentGroups" select="$parentGroups"/>\r
+ </xsl:call-template>\r
+ </xsl:when>\r
+ <xsl:otherwise>\r
+ <xsl:call-template name="PrintSampleSimpleElement">\r
+ <xsl:with-param name="element" select="."/>\r
+ <xsl:with-param name="schemaLoc" select="$schemaLoc"/>\r
+ </xsl:call-template>\r
+ </xsl:otherwise>\r
+ </xsl:choose>\r
+ </xsl:when>\r
+ <!-- Local element declaration -->\r
+ <xsl:otherwise>\r
+ <xsl:choose>\r
+ <!-- With local complex type definition -->\r
+ <xsl:when test="xsd:complexType">\r
+ <xsl:call-template name="PrintSampleComplexElement">\r
+ <xsl:with-param name="element" select="."/>\r
+ <xsl:with-param name="type" select="xsd:complexType"/>\r
+ <xsl:with-param name="margin" select="$margin"/>\r
+ <xsl:with-param name="isInherited" select="$isInherited"/>\r
+ <xsl:with-param name="isNewField" select="$isNewField"/>\r
+ <xsl:with-param name="schemaLoc" select="$schemaLoc"/>\r
+ <xsl:with-param name="typeList" select="$typeList"/>\r
+ <xsl:with-param name="parentGroups" select="$parentGroups"/>\r
+ </xsl:call-template>\r
+ </xsl:when>\r
+ <xsl:otherwise>\r
+ <xsl:call-template name="PrintSampleSimpleElement">\r
+ <xsl:with-param name="element" select="."/>\r
+ <xsl:with-param name="margin" select="$margin"/>\r
+ <xsl:with-param name="isInherited" select="$isInherited"/>\r
+ <xsl:with-param name="isNewField" select="$isNewField"/>\r
+ <xsl:with-param name="schemaLoc" select="$schemaLoc"/>\r
+ <xsl:with-param name="typeList" select="$typeList"/>\r
+ </xsl:call-template>\r
+ </xsl:otherwise>\r
+ </xsl:choose>\r
+ </xsl:otherwise>\r
+ </xsl:choose>\r
+ </xsl:template>\r
+\r
+ <!--\r
+ Prints out a sample XML instance from an element\r
+ reference.\r
+ Param(s):\r
+ margin (nonNegativeInteger) optional\r
+ Number of 'em' to indent from left\r
+ isInherited (boolean) optional\r
+ If true, display elements using 'inherited' CSS class.\r
+ isNewField (boolean) optional\r
+ If true, display elements using 'newFields' CSS class.\r
+ schemaLoc (String) optional\r
+ Schema file containing this element reference; \r
+ if in current schema, 'schemaLoc' is set to 'this'.\r
+ -->\r
+ <xsl:template match="xsd:element[@ref]" mode="sample">\r
+ <xsl:param name="margin">0</xsl:param>\r
+ <xsl:param name="isInherited">false</xsl:param>\r
+ <xsl:param name="isNewField">false</xsl:param>\r
+ <xsl:param name="schemaLoc">this</xsl:param>\r
+\r
+ <xsl:if test="normalize-space(@maxOccurs)!='0'">\r
+ <xsl:call-template name="PrintSampleSimpleElement">\r
+ <xsl:with-param name="element" select="."/>\r
+ <xsl:with-param name="margin" select="$margin"/>\r
+ <xsl:with-param name="isInherited" select="$isInherited"/>\r
+ <xsl:with-param name="isNewField" select="$isNewField"/>\r
+ <xsl:with-param name="schemaLoc" select="$schemaLoc"/>\r
+ </xsl:call-template>\r
+ </xsl:if>\r
+ </xsl:template>\r
+\r
+ <!--\r
+ Prints out a sample XML instance from a group definition.\r
+ Param(s):\r
+ schemaLoc (String) optional\r
+ Schema file containing this model group definition;\r
+ if in current schema, 'schemaLoc' is set to 'this'\r
+ typeList (String) optional\r
+ List of types in this call chain. Name of type starts\r
+ with '*', and ends with '+'. (Used to prevent infinite\r
+ recursive loop.)\r
+ -->\r
+ <xsl:template match="xsd:group[@name]" mode="sample">\r
+ <xsl:param name="schemaLoc">this</xsl:param>\r
+ <xsl:param name="typeList"/>\r
+\r
+ <xsl:apply-templates select="xsd:*" mode="sample">\r
+ <xsl:with-param name="parentGroups" select="concat('*', normalize-space(@name), '+')"/>\r
+ <xsl:with-param name="schemaLoc" select="$schemaLoc"/>\r
+ <xsl:with-param name="typeList" select="$typeList"/>\r
+ </xsl:apply-templates>\r
+ </xsl:template>\r
+\r
+ <!--\r
+ Prints out a sample XML instance from a group reference.\r
+ Param(s):\r
+ margin (nonNegativeInteger) optional\r
+ Number of 'em' to indent from left\r
+ isInherited (boolean) optional\r
+ If true, display elements using 'inherited' CSS \r
+ class.\r
+ isNewField (boolean) optional\r
+ If true, display elements using 'newFields' CSS \r
+ class.\r
+ parentGroups (String) optional\r
+ List of parent model group definitions that contain \r
+ this model group. Used to prevent infinite loops \r
+ when displaying model group definitions.\r
+ schemaLoc (String) optional\r
+ Schema file containing this model group reference;\r
+ if in current schema, 'schemaLoc' is set to 'this'\r
+ typeList (String) optional\r
+ List of types in this call chain. Name of type starts\r
+ with '*', and ends with '+'. (Used to prevent infinite\r
+ recursive loop.)\r
+ -->\r
+ <xsl:template match="xsd:group[@ref]" mode="sample">\r
+ <xsl:param name="margin">0</xsl:param>\r
+ <xsl:param name="isInherited">false</xsl:param>\r
+ <xsl:param name="isNewField">false</xsl:param>\r
+ <xsl:param name="parentGroups"/>\r
+ <xsl:param name="schemaLoc">this</xsl:param>\r
+ <xsl:param name="typeList"/>\r
+\r
+ <!-- Get group name -->\r
+ <xsl:variable name="grpName">\r
+ <xsl:call-template name="GetRefName">\r
+ <xsl:with-param name="ref" select="@ref"/>\r
+ </xsl:call-template>\r
+ </xsl:variable>\r
+\r
+ <!-- Create link to the group definition -->\r
+ <xsl:variable name="grpLink">\r
+ <xsl:call-template name="PrintGroupRef">\r
+ <xsl:with-param name="ref" select="@ref"/>\r
+ <xsl:with-param name="schemaLoc" select="$schemaLoc"/>\r
+ </xsl:call-template>\r
+ </xsl:variable>\r
+\r
+ <!-- Get occurrence info -->\r
+ <xsl:variable name="occursInfo">\r
+ <xsl:call-template name="PrintOccurs">\r
+ <xsl:with-param name="component" select="."/>\r
+ </xsl:call-template>\r
+ </xsl:variable>\r
+\r
+ <xsl:choose>\r
+ <!-- Circular group definition -->\r
+ <xsl:when test="contains($parentGroups, concat('*', normalize-space($grpName), '+'))">\r
+ <!-- Don't show contents -->\r
+ <div class="other" style="margin-left: {$margin}em">\r
+ <xsl:text>Circular model group reference: </xsl:text>\r
+ <xsl:copy-of select="$grpLink"/>\r
+ <!-- Occurrence info -->\r
+ <xsl:text> </xsl:text>\r
+ <xsl:copy-of select="$occursInfo"/>\r
+ <!-- Documentation -->\r
+ <xsl:call-template name="PrintSampleDocumentation">\r
+ <xsl:with-param name="component" select="."/>\r
+ </xsl:call-template>\r
+ </div>\r
+ </xsl:when>\r
+ <xsl:otherwise>\r
+ <!-- Look for group definition -->\r
+ <xsl:variable name="grpDefLoc">\r
+ <xsl:call-template name="FindComponent">\r
+ <xsl:with-param name="ref" select="@ref"/>\r
+ <xsl:with-param name="compType">group</xsl:with-param>\r
+ </xsl:call-template>\r
+ </xsl:variable>\r
+\r
+ <xsl:choose>\r
+ <!-- Not found -->\r
+ <xsl:when test="normalize-space($grpDefLoc)='' or normalize-space($grpDefLoc)='none' or normalize-space($grpDefLoc)='xml' or normalize-space($grpDefLoc)='xsd'">\r
+ <div class="other" style="margin-left: {$margin}em">\r
+ <xsl:text>Model group reference (not shown): </xsl:text>\r
+ <xsl:copy-of select="$grpLink"/>\r
+ <!-- Occurrence info -->\r
+ <xsl:text> </xsl:text>\r
+ <xsl:copy-of select="$occursInfo"/>\r
+ <!-- Documentation -->\r
+ <xsl:call-template name="PrintSampleDocumentation">\r
+ <xsl:with-param name="component" select="."/>\r
+ </xsl:call-template>\r
+ </div>\r
+ </xsl:when>\r
+ <!-- Found in current schema -->\r
+ <xsl:when test="normalize-space($grpDefLoc)='this'">\r
+ <xsl:variable name="grpDef" select="key('group', $grpName)"/>\r
+ <xsl:call-template name="PrintSampleGroup">\r
+ <xsl:with-param name="margin" select="$margin"/>\r
+ <xsl:with-param name="isInherited" select="$isInherited"/>\r
+ <xsl:with-param name="isNewField" select="$isNewField"/>\r
+ <xsl:with-param name="parentGroups" select="concat($parentGroups, concat('*', normalize-space($grpName), '+'))"/>\r
+ <xsl:with-param name="occursInfo" select="$occursInfo"/>\r
+ <xsl:with-param name="grpLink" select="$grpLink"/>\r
+ <xsl:with-param name="grpRef" select="."/>\r
+ <xsl:with-param name="grpDef" select="$grpDef"/>\r
+ <xsl:with-param name="grpDefLoc" select="$grpDefLoc"/>\r
+ <xsl:with-param name="typeList" select="$typeList"/>\r
+ </xsl:call-template>\r
+ </xsl:when>\r
+ <!-- Found in external schema -->\r
+ <xsl:otherwise>\r
+ <xsl:variable name="grpDef" select="document($grpDefLoc)/xsd:schema/xsd:group[@name=$grpName]"/>\r
+ <xsl:call-template name="PrintSampleGroup">\r
+ <xsl:with-param name="margin" select="$margin"/>\r
+ <xsl:with-param name="isInherited" select="$isInherited"/>\r
+ <xsl:with-param name="isNewField" select="$isNewField"/>\r
+ <xsl:with-param name="parentGroups" select="concat($parentGroups, concat('*', normalize-space($grpName), '+'))"/>\r
+ <xsl:with-param name="occursInfo" select="$occursInfo"/>\r
+ <xsl:with-param name="grpLink" select="$grpLink"/>\r
+ <xsl:with-param name="grpRef" select="."/>\r
+ <xsl:with-param name="grpDef" select="$grpDef"/>\r
+ <xsl:with-param name="grpDefLoc" select="$grpDefLoc"/>\r
+ <xsl:with-param name="typeList" select="$typeList"/>\r
+ </xsl:call-template>\r
+ </xsl:otherwise>\r
+ </xsl:choose>\r
+ </xsl:otherwise>\r
+ </xsl:choose>\r
+ </xsl:template>\r
+\r
+ <!--\r
+ Prints out a sample XML instance from a 'sequence' model group.\r
+ Param(s):\r
+ margin (nonNegativeInteger) optional\r
+ Number of 'em' to indent from left\r
+ isInherited (boolean) optional\r
+ If true, display elements using 'inherited' CSS class.\r
+ isNewField (boolean) optional\r
+ If true, display elements using 'newFields' CSS class.\r
+ parentGroups (String) optional\r
+ List of parent model group definitions that contain \r
+ this model group. Used to prevent infinite loops when \r
+ displaying model group definitions.\r
+ schemaLoc (String) optional\r
+ Schema file containing this sequence model group;\r
+ if in current schema, 'schemaLoc' is set to 'this'\r
+ typeList (String) optional\r
+ List of types in this call chain. Name of type starts\r
+ with '*', and ends with '+'. (Used to prevent infinite\r
+ recursive loop.)\r
+ -->\r
+ <xsl:template match="xsd:sequence" mode="sample">\r
+ <xsl:param name="margin">0</xsl:param>\r
+ <xsl:param name="isInherited">false</xsl:param>\r
+ <xsl:param name="isNewField">false</xsl:param>\r
+ <xsl:param name="parentGroups"/>\r
+ <xsl:param name="schemaLoc">this</xsl:param>\r
+ <xsl:param name="typeList"/>\r
+\r
+ <xsl:if test="normalize-space(@maxOccurs)!='0'">\r
+ <!-- Get occurrence info -->\r
+ <xsl:variable name="occursInfo">\r
+ <xsl:call-template name="PrintOccurs">\r
+ <xsl:with-param name="component" select="."/>\r
+ </xsl:call-template>\r
+ </xsl:variable>\r
+\r
+ <!-- Header -->\r
+ <xsl:if test="normalize-space($occursInfo)!='[1]'">\r
+ <!-- Don't display header if min/max occurs is one. -->\r
+ <span class="group" style="margin-left: {$margin}em">\r
+ <xsl:text>Start </xsl:text>\r
+ <xsl:call-template name="PrintGlossaryTermRef">\r
+ <xsl:with-param name="code">Sequence</xsl:with-param>\r
+ <xsl:with-param name="term">Sequence</xsl:with-param>\r
+ </xsl:call-template>\r
+\r
+ <xsl:text> </xsl:text>\r
+ <xsl:copy-of select="$occursInfo"/>\r
+ <!-- Documentation -->\r
+ <xsl:call-template name="PrintSampleDocumentation">\r
+ <xsl:with-param name="component" select="."/>\r
+ </xsl:call-template>\r
+ </span><br/>\r
+ </xsl:if>\r
+\r
+ <xsl:apply-templates select="xsd:*" mode="sample">\r
+ <xsl:with-param name="margin">\r
+ <xsl:choose>\r
+ <xsl:when test="normalize-space($occursInfo)='[1]'">\r
+ <xsl:value-of select="$margin"/>\r
+ </xsl:when>\r
+ <xsl:otherwise>\r
+ <xsl:value-of select="number($margin)+number($ELEM_INDENT)"/>\r
+ </xsl:otherwise>\r
+ </xsl:choose>\r
+ </xsl:with-param>\r
+ <xsl:with-param name="isInherited" select="$isInherited"/>\r
+ <xsl:with-param name="isNewField" select="$isNewField"/>\r
+ <xsl:with-param name="parentGroups" select="$parentGroups"/>\r
+ <xsl:with-param name="schemaLoc" select="$schemaLoc"/>\r
+ <xsl:with-param name="typeList" select="$typeList"/>\r
+ </xsl:apply-templates>\r
+\r
+ <!-- Footer -->\r
+ <xsl:if test="normalize-space($occursInfo)!='[1]'">\r
+ <!-- Don't display footer if min/max occurs is one. -->\r
+ <span class="group" style="margin-left: {$margin}em">\r
+ <xsl:text>End Sequence</xsl:text>\r
+ </span><br/>\r
+ </xsl:if>\r
+ </xsl:if>\r
+ </xsl:template>\r
+\r
+ <!--\r
+ Prints out the constraints of a complex type with simple content \r
+ to be displayed within a sample XML instance.\r
+ Param(s):\r
+ schemaLoc (String) optional\r
+ Schema file containing this simple content \r
+ restriction; if in current schema, 'schemaLoc' is \r
+ set to 'this'\r
+ -->\r
+ <xsl:template match="xsd:simpleContent[xsd:restriction]" mode="sample">\r
+ <xsl:param name="schemaLoc">this</xsl:param>\r
+\r
+ <span class="constraint">\r
+ <xsl:call-template name="PrintSampleSimpleRestriction">\r
+ <xsl:with-param name="restriction" select="./xsd:restriction"/>\r
+ <xsl:with-param name="schemaLoc" select="$schemaLoc"/>\r
+ </xsl:call-template>\r
+ </span>\r
+ </xsl:template>\r
+\r
+ <!--\r
+ Prints out the constraints of a simple type definition to be \r
+ displayed within a sample XML instance.\r
+ Param(s):\r
+ schemaLoc (String) optional\r
+ Schema file containing this simple type definition; \r
+ if in current schema, 'schemaLoc' is set to 'this'\r
+ -->\r
+ <xsl:template match="xsd:simpleType" mode="sample">\r
+ <xsl:param name="schemaLoc">this</xsl:param>\r
+\r
+ <span class="constraint">\r
+ <xsl:call-template name="PrintSampleSimpleConstraints">\r
+ <xsl:with-param name="simpleContent" select="."/>\r
+ <xsl:with-param name="schemaLoc" select="$schemaLoc"/>\r
+ </xsl:call-template>\r
+ </span>\r
+ </xsl:template>\r
+\r
+ <!--\r
+ Prints out the identity constraints of an element to be displayed \r
+ within a sample XML instance.\r
+ Param(s):\r
+ margin (nonNegativeInteger) optional\r
+ Number of 'em' to indent from left\r
+ schemaLoc (String) optional\r
+ Schema file containing this simple type definition; \r
+ if in current schema, 'schemaLoc' is set to 'this'\r
+ -->\r
+ <xsl:template match="xsd:unique | xsd:key | xsd:keyref" mode="sample">\r
+ <xsl:param name="margin">0</xsl:param>\r
+ <xsl:param name="schemaLoc">this</xsl:param>\r
+\r
+ <div class="other" style="margin-left: {$margin}em">\r
+ <xsl:text><!-- </xsl:text><br/>\r
+\r
+ <xsl:choose>\r
+ <xsl:when test="local-name(.)='unique'">\r
+ <xsl:call-template name="PrintGlossaryTermRef">\r
+ <xsl:with-param name="code">Unique</xsl:with-param>\r
+ <xsl:with-param name="term">Uniqueness</xsl:with-param>\r
+ </xsl:call-template>\r
+ </xsl:when>\r
+ <xsl:when test="local-name(.)='key'">\r
+ <xsl:call-template name="PrintGlossaryTermRef">\r
+ <xsl:with-param name="code">Key</xsl:with-param>\r
+ <xsl:with-param name="term">Key</xsl:with-param>\r
+ </xsl:call-template>\r
+ </xsl:when>\r
+ <xsl:otherwise>\r
+ <xsl:call-template name="PrintGlossaryTermRef">\r
+ <xsl:with-param name="code">KeyRef</xsl:with-param>\r
+ <xsl:with-param name="term">Key Reference</xsl:with-param>\r
+ </xsl:call-template>\r
+ </xsl:otherwise>\r
+ </xsl:choose>\r
+ <xsl:text> Constraint - </xsl:text>\r
+ <strong>\r
+ <xsl:choose>\r
+ <xsl:when test="local-name(.)='keyref'">\r
+ <xsl:value-of select="@name"/>\r
+ </xsl:when>\r
+ <xsl:otherwise>\r
+ <xsl:variable name="componentID">\r
+ <xsl:call-template name="GetComponentID">\r
+ <xsl:with-param name="component" select="."/>\r
+ </xsl:call-template>\r
+ </xsl:variable>\r
+ <a name="{$componentID}"><xsl:value-of select="@name"/></a>\r
+ </xsl:otherwise>\r
+ </xsl:choose>\r
+ </strong><br/>\r
+\r
+ <xsl:text>Selector - </xsl:text>\r
+ <strong>\r
+ <xsl:value-of select="xsd:selector/@xpath"/>\r
+ </strong><br/>\r
+\r
+ <xsl:text>Field(s) - </xsl:text>\r
+ <xsl:for-each select="xsd:field">\r
+ <xsl:if test="position()!=1">\r
+ <xsl:text>, </xsl:text>\r
+ </xsl:if>\r
+ <strong>\r
+ <xsl:value-of select="@xpath"/>\r
+ </strong>\r
+ </xsl:for-each>\r
+ <br/>\r
+\r
+ <xsl:if test="local-name(.)='keyref'">\r
+ <xsl:text>Refers to - </xsl:text>\r
+ <xsl:call-template name="PrintKeyRef">\r
+ <xsl:with-param name="ref" select="@refer"/>\r
+ <xsl:with-param name="schemaLoc" select="$schemaLoc"/>\r
+ </xsl:call-template>\r
+ <br/>\r
+ </xsl:if>\r
+\r
+ <xsl:text>--></xsl:text>\r
+ </div>\r
+ </xsl:template>\r
+\r
+ <!--\r
+ Unmatched template for 'sample' mode\r
+ -->\r
+ <xsl:template match="*" mode="sample"/>\r
+\r
+ <!--\r
+ Prints out a link which will open up a window, displaying a \r
+ schema component's documentation.\r
+ Param(s):\r
+ component (Node) required\r
+ Schema component\r
+ -->\r
+ <xsl:template name="PrintSampleDocumentation">\r
+ <xsl:param name="component"/>\r
+\r
+ <xsl:if test="normalize-space(translate($useJavaScript,'TRUE','true'))='true' and $component and $component/xsd:annotation/xsd:documentation">\r
+ <xsl:variable name="documentation">\r
+ <xsl:for-each select="$component/xsd:annotation/xsd:documentation">\r
+ <!-- Check for two dashes, which will break the JavaScript \r
+ code -->\r
+ <xsl:if test="contains(., '--') or contains(@source, '--')">\r
+ <xsl:call-template name="HandleError">\r
+ <xsl:with-param name="isTerminating">true</xsl:with-param>\r
+ <xsl:with-param name="errorMsg">\r
+A local schema component contains two dashes in \r
+'documentation' elements within its 'annotation' element.\r
+ </xsl:with-param>\r
+ </xsl:call-template>\r
+ </xsl:if>\r
+\r
+ <xsl:if test="position()!=1">\r
+ <xsl:text>,</xsl:text>\r
+ </xsl:if>\r
+ <xsl:text>'</xsl:text>\r
+ <xsl:choose>\r
+ <xsl:when test="@source">\r
+ <xsl:text>More information at: </xsl:text>\r
+ <xsl:call-template name="EscapeQuotes">\r
+ <xsl:with-param name="value" select="@source"/>\r
+ </xsl:call-template>\r
+ <xsl:text>.</xsl:text>\r
+ </xsl:when>\r
+ <xsl:when test="normalize-space(.)!=''">\r
+ <xsl:call-template name="EscapeQuotes">\r
+ <xsl:with-param name="value" select="normalize-space(.)"/>\r
+ </xsl:call-template>\r
+ </xsl:when>\r
+ </xsl:choose>\r
+ <xsl:text>'</xsl:text>\r
+ </xsl:for-each>\r
+ </xsl:variable>\r
+\r
+ <xsl:text> </xsl:text>\r
+ <a href="javascript:void(0)" title="View Documentation" class="documentation">\r
+ <!-- onclick attribute -->\r
+ <xsl:attribute name="onclick">\r
+ <xsl:text>docArray = new Array(</xsl:text>\r
+ <xsl:value-of select="$documentation"/>\r
+ <xsl:text>); viewDocumentation('</xsl:text>\r
+ <xsl:call-template name="GetComponentDescription">\r
+ <xsl:with-param name="component" select="$component"/>\r
+ </xsl:call-template>\r
+ <xsl:text>', '</xsl:text>\r
+ <xsl:choose>\r
+ <xsl:when test="$component/@name">\r
+ <xsl:value-of select="$component/@name"/>\r
+ </xsl:when>\r
+ <xsl:when test="$component/@ref">\r
+ <xsl:call-template name="GetRefName">\r
+ <xsl:with-param name="ref" select="$component/@ref"/>\r
+ </xsl:call-template>\r
+ </xsl:when>\r
+ </xsl:choose>\r
+ <xsl:text>', docArray);</xsl:text>\r
+ </xsl:attribute>\r
+ <xsl:text>?</xsl:text>\r
+ </a>\r
+ </xsl:if>\r
+ </xsl:template>\r
+\r
+ <!--\r
+ Translates occurrences of single and double quotes\r
+ in a piece of text with single and double quote\r
+ escape characters.\r
+ Param(s):\r
+ value (String) required\r
+ Text to translate\r
+ -->\r
+ <xsl:template name="EscapeQuotes">\r
+ <xsl:param name="value"/>\r
+\r
+ <xsl:variable name="noSingleQuotes">\r
+ <xsl:call-template name="TranslateStr">\r
+ <xsl:with-param name="value" select="$value"/>\r
+ <xsl:with-param name="strToReplace">'</xsl:with-param>\r
+ <xsl:with-param name="replacementStr">\'</xsl:with-param>\r
+ </xsl:call-template>\r
+ </xsl:variable>\r
+ <xsl:variable name="noDoubleQuotes">\r
+ <xsl:call-template name="TranslateStr">\r
+ <xsl:with-param name="value" select="$noSingleQuotes"/>\r
+ <xsl:with-param name="strToReplace">"</xsl:with-param>\r
+ <xsl:with-param name="replacementStr">\"</xsl:with-param>\r
+ </xsl:call-template>\r
+ </xsl:variable>\r
+ <xsl:value-of select="$noDoubleQuotes"/>\r
+ </xsl:template>\r
+\r
+ <!--\r
+ Helper template for template, match="xsd:group[@ref]" \r
+ mode="sample". Basically prints out a group reference, for \r
+ which we are able to look up the group definition that it\r
+ is referring to. This template is a work-around because XSLT\r
+ doesn't have variables (in the traditional sense of \r
+ programming languages) and it doesn't allow you to query\r
+ result tree fragments. \r
+ Param(s):\r
+ margin (nonNegativeInteger) optional\r
+ Number of 'em' to indent from left\r
+ isInherited (boolean) optional\r
+ If true, display elements using 'inherited' CSS class.\r
+ isNewField (boolean) optional\r
+ If true, display elements using 'newFields' CSS class.\r
+ parentGroups (String) optional\r
+ List of parent model group definitions that contain this \r
+ model group. Used to prevent infinite loops when \r
+ displaying model group definitions.\r
+ occursInfo (Result tree fragment) required\r
+ Pre-formatted occurrence info of group reference\r
+ grpLink (Result tree fragment) required\r
+ Pre-formatted <a> link representing group reference\r
+ grpRef (Node) required\r
+ Group reference\r
+ grpDef (Node) required\r
+ Group definition that the reference is pointing to\r
+ grpDefLoc (String) optional\r
+ Schema file containing 'grpDef' group definition;\r
+ if current schema, 'schemaLoc' is set to 'this'\r
+ typeList (String) optional\r
+ List of types in this call chain. Name of type starts\r
+ with '*', and ends with '+'. (Used to prevent infinite\r
+ recursive loop.)\r
+ -->\r
+ <xsl:template name="PrintSampleGroup">\r
+ <xsl:param name="margin">0</xsl:param>\r
+ <xsl:param name="isInherited">false</xsl:param>\r
+ <xsl:param name="isNewField">false</xsl:param>\r
+ <xsl:param name="parentGroups"/>\r
+ <xsl:param name="occursInfo"/>\r
+ <xsl:param name="grpLink"/>\r
+ <xsl:param name="grpRef"/>\r
+ <xsl:param name="grpDef"/>\r
+ <xsl:param name="grpDefLoc">this</xsl:param>\r
+ <xsl:param name="typeList"/>\r
+\r
+ <!-- Header -->\r
+ <xsl:if test="normalize-space($occursInfo)!='[1]'">\r
+ <!-- Don't print out header if min/max occurs is one. -->\r
+ <span class="group" style="margin-left: {$margin}em">\r
+ <xsl:text>Start Group: </xsl:text>\r
+ <xsl:copy-of select="$grpLink"/>\r
+ <!-- Occurrence info -->\r
+ <xsl:text> </xsl:text>\r
+ <xsl:copy-of select="$occursInfo"/>\r
+ <!-- Documentation -->\r
+ <xsl:call-template name="PrintSampleDocumentation">\r
+ <xsl:with-param name="component" select="$grpRef"/>\r
+ </xsl:call-template>\r
+ </span><br/>\r
+ </xsl:if>\r
+\r
+ <!-- Content -->\r
+ <xsl:apply-templates select="$grpDef/xsd:*" mode="sample">\r
+ <xsl:with-param name="margin">\r
+ <xsl:choose>\r
+ <xsl:when test="normalize-space($occursInfo)!='[1]'">\r
+ <xsl:value-of select="number($margin)+number($ELEM_INDENT)"/>\r
+ </xsl:when>\r
+ <xsl:otherwise>\r
+ <xsl:value-of select="$margin"/>\r
+ </xsl:otherwise>\r
+ </xsl:choose>\r
+ </xsl:with-param>\r
+ <xsl:with-param name="isInherited" select="$isInherited"/>\r
+ <xsl:with-param name="isNewField" select="$isNewField"/>\r
+ <xsl:with-param name="parentGroups" select="$parentGroups"/>\r
+ <xsl:with-param name="schemaLoc" select="$grpDefLoc"/>\r
+ <xsl:with-param name="typeList" select="$typeList"/>\r
+ </xsl:apply-templates>\r
+\r
+ <!-- Footer -->\r
+ <xsl:if test="normalize-space($occursInfo)!='[1]'">\r
+ <!-- Don't print out footer if min/max occurs is one. -->\r
+ <span class="group" style="margin-left: {$margin}em">\r
+ <xsl:text>End Group: </xsl:text>\r
+ <xsl:copy-of select="$grpLink"/>\r
+ </span><br/>\r
+ </xsl:if>\r
+ </xsl:template>\r
+\r
+ <!--\r
+ Prints out a sample element instance in one line.\r
+ Param(s):\r
+ element (Node) required\r
+ Element declaration or reference\r
+ margin (nonNegativeInteger) optional\r
+ Number of 'em' to indent from left\r
+ isInherited (boolean) optional\r
+ If true, display element using 'inherited' CSS class.\r
+ isNewField (boolean) optional\r
+ If true, display element using 'newFields' CSS class.\r
+ schemaLoc (String) optional\r
+ Schema file containing this element declaration\r
+ or reference; if in current schema, 'schemaLoc' is \r
+ set to 'this'.\r
+ -->\r
+ <xsl:template name="PrintSampleSimpleElement">\r
+ <xsl:param name="element"/>\r
+ <xsl:param name="margin">0</xsl:param>\r
+ <xsl:param name="isInherited">false</xsl:param>\r
+ <xsl:param name="isNewField">false</xsl:param>\r
+ <xsl:param name="schemaLoc">this</xsl:param>\r
+\r
+ <!-- Element Tag -->\r
+ <xsl:variable name="elemTag">\r
+ <!-- Local Name -->\r
+ <xsl:choose>\r
+ <!-- Element reference -->\r
+ <xsl:when test="$element/@ref">\r
+ <!-- Note: Prefix will be automatically written out\r
+ in call to 'PrintElementRef'. -->\r
+ <xsl:call-template name="PrintElementRef">\r
+ <xsl:with-param name="ref" select="@ref"/>\r
+ <xsl:with-param name="schemaLoc" select="$schemaLoc"/>\r
+ </xsl:call-template>\r
+ </xsl:when>\r
+ <!-- Element declaration -->\r
+ <xsl:otherwise>\r
+ <!-- Prefix -->\r
+ <xsl:variable name="prefix">\r
+ <xsl:call-template name="GetElementPrefix">\r
+ <xsl:with-param name="element" select="$element"/>\r
+ </xsl:call-template>\r
+ </xsl:variable>\r
+ <xsl:call-template name="PrintNSPrefix">\r
+ <xsl:with-param name="prefix" select="$prefix"/>\r
+ <xsl:with-param name="schemaLoc" select="$schemaLoc"/>\r
+ </xsl:call-template>\r
+ <xsl:value-of select="$element/@name"/>\r
+ </xsl:otherwise>\r
+ </xsl:choose>\r
+ </xsl:variable>\r
+\r
+ <div style="margin-left: {$margin}em">\r
+ <xsl:choose>\r
+ <xsl:when test="$isNewField!='false'">\r
+ <xsl:attribute name="class">newFields</xsl:attribute>\r
+ </xsl:when>\r
+ <xsl:when test="$isInherited!='false'">\r
+ <xsl:attribute name="class">inherited</xsl:attribute>\r
+ </xsl:when>\r
+ </xsl:choose>\r
+\r
+ <!-- Start Tag -->\r
+ <xsl:text><</xsl:text>\r
+ <xsl:copy-of select="$elemTag"/>\r
+ <xsl:text>></xsl:text>\r
+\r
+ <!-- Contents -->\r
+ <xsl:text> </xsl:text>\r
+ <xsl:choose>\r
+ <!-- Fixed value is provided -->\r
+ <xsl:when test="$element/@fixed">\r
+ <span class="fixed">\r
+ <xsl:value-of select="$element/@fixed"/>\r
+ </span>\r
+ </xsl:when>\r
+ <!-- Type reference is provided -->\r
+ <xsl:when test="$element/@name and $element/@type">\r
+ <xsl:call-template name="PrintTypeRef">\r
+ <xsl:with-param name="ref" select="$element/@type"/>\r
+ <xsl:with-param name="schemaLoc" select="$schemaLoc"/>\r
+ </xsl:call-template>\r
+ </xsl:when>\r
+ <!-- Local simple type definition is provided -->\r
+ <xsl:when test="$element/@name and $element/xsd:simpleType">\r
+ <xsl:apply-templates select="$element/xsd:simpleType" mode="sample">\r
+ <xsl:with-param name="schemaLoc" select="$schemaLoc"/>\r
+ </xsl:apply-templates>\r
+ </xsl:when>\r
+ <xsl:otherwise>\r
+ <xsl:text>...</xsl:text>\r
+ </xsl:otherwise>\r
+ </xsl:choose>\r
+ <xsl:text> </xsl:text>\r
+\r
+ <!-- Identity Constraints -->\r
+ <xsl:if test="$element/xsd:unique or $element/xsd:key or $element/xsd:keyref">\r
+ <xsl:apply-templates select="$element/xsd:unique | $element/xsd:key | $element/xsd:keyref" mode="sample">\r
+ <xsl:with-param name="margin" select="$ELEM_INDENT"/>\r
+ <xsl:with-param name="schemaLoc" select="$schemaLoc"/>\r
+ </xsl:apply-templates>\r
+ </xsl:if>\r
+\r
+ <!-- End Tag -->\r
+ <xsl:text></</xsl:text>\r
+ <xsl:copy-of select="$elemTag"/>\r
+ <xsl:text>></xsl:text>\r
+\r
+ <xsl:if test="local-name($element/..)!='schema'">\r
+ <!-- Min/max occurs information -->\r
+ <xsl:text> </xsl:text>\r
+ <xsl:call-template name="PrintOccurs">\r
+ <xsl:with-param name="component" select="$element"/>\r
+ </xsl:call-template>\r
+ <!-- Documentation -->\r
+ <xsl:call-template name="PrintSampleDocumentation">\r
+ <xsl:with-param name="component" select="$element"/>\r
+ </xsl:call-template>\r
+ </xsl:if>\r
+ </div>\r
+ </xsl:template>\r
+\r
+ <!--\r
+ Prints out a sample element instance that has complex content.\r
+ Param(s):\r
+ type (Node) required\r
+ Complex type definition\r
+ element (Node) optional\r
+ Element declaration\r
+ margin (nonNegativeInteger) optional\r
+ Number of 'em' to indent from left\r
+ isInherited (boolean) optional\r
+ If true, display element using 'inherited' CSS class.\r
+ isNewField (boolean) optional\r
+ If true, display element using 'newFields' CSS class.\r
+ schemaLoc (String) optional\r
+ Schema file containing this element declaration\r
+ or type definition; if in current schema, 'schemaLoc' \r
+ is set to 'this'.\r
+ typeList (String) optional\r
+ List of types in this call chain. Name of type starts\r
+ with '*', and ends with '+'. (Used to prevent infinite\r
+ recursive loop.)\r
+ -->\r
+ <xsl:template name="PrintSampleComplexElement">\r
+ <xsl:param name="type"/>\r
+ <xsl:param name="element"/>\r
+ <xsl:param name="margin">0</xsl:param>\r
+ <xsl:param name="isInherited">false</xsl:param>\r
+ <xsl:param name="isNewField">false</xsl:param>\r
+ <xsl:param name="schemaLoc">this</xsl:param>\r
+ <xsl:param name="typeList"/>\r
+ <xsl:param name="parentGroups"/>\r
+\r
+ <xsl:choose>\r
+ <!-- Circular type hierarchy -->\r
+ <xsl:when test="$type/@name and contains($typeList, concat('*', $type/@name, '+'))"/>\r
+ <xsl:otherwise>\r
+ <xsl:variable name="tag">\r
+ <xsl:choose>\r
+ <xsl:when test="$element">\r
+ <!-- Prefix -->\r
+ <xsl:variable name="prefix">\r
+ <xsl:call-template name="GetElementPrefix">\r
+ <xsl:with-param name="element" select="$element"/>\r
+ </xsl:call-template>\r
+ </xsl:variable>\r
+ <xsl:call-template name="PrintNSPrefix">\r
+ <xsl:with-param name="prefix" select="$prefix"/>\r
+ <xsl:with-param name="schemaLoc" select="$schemaLoc"/>\r
+ </xsl:call-template>\r
+ <xsl:value-of select="$element/@name"/>\r
+ </xsl:when>\r
+ <xsl:otherwise>\r
+ <xsl:text>...</xsl:text>\r
+ </xsl:otherwise>\r
+ </xsl:choose>\r
+ </xsl:variable>\r
+\r
+ <xsl:variable name="fromTopCType">\r
+ <xsl:choose>\r
+ <xsl:when test="not($element) and local-name($type/..)='schema'">\r
+ <xsl:text>true</xsl:text>\r
+ </xsl:when>\r
+ <xsl:otherwise>\r
+ <xsl:text>false</xsl:text>\r
+ </xsl:otherwise>\r
+ </xsl:choose>\r
+ </xsl:variable>\r
+\r
+ <div style="margin-left: {$margin}em">\r
+ <xsl:choose>\r
+ <xsl:when test="$isNewField!='false'">\r
+ <xsl:attribute name="class">newFields</xsl:attribute>\r
+ </xsl:when>\r
+ <xsl:when test="$isInherited!='false'">\r
+ <xsl:attribute name="class">inherited</xsl:attribute>\r
+ </xsl:when>\r
+ </xsl:choose>\r
+ \r
+ <!-- Start Tag -->\r
+ <xsl:text><</xsl:text>\r
+ <xsl:copy-of select="$tag"/>\r
+\r
+ <!-- Print attributes -->\r
+ <xsl:call-template name="PrintSampleTypeAttrs">\r
+ <xsl:with-param name="type" select="$type"/>\r
+ <xsl:with-param name="isInherited" select="$isInherited"/>\r
+ <xsl:with-param name="isNewField" select="$isNewField"/>\r
+ <xsl:with-param name="margin" select="$ATTR_INDENT"/>\r
+ <xsl:with-param name="fromTopCType" select="$fromTopCType"/>\r
+ <xsl:with-param name="schemaLoc" select="$schemaLoc"/>\r
+ <xsl:with-param name="typeList" select="$typeList"/>\r
+ </xsl:call-template>\r
+\r
+ <!-- Get content -->\r
+ <xsl:variable name="content">\r
+ <xsl:call-template name="PrintSampleTypeContent">\r
+ <xsl:with-param name="type" select="$type"/>\r
+ <xsl:with-param name="margin" select="$ELEM_INDENT"/>\r
+ <xsl:with-param name="isInherited" select="$isInherited"/>\r
+ <xsl:with-param name="isNewField" select="$isNewField"/>\r
+ <xsl:with-param name="fromTopCType" select="$fromTopCType"/>\r
+ <xsl:with-param name="schemaLoc" select="$schemaLoc"/>\r
+ <xsl:with-param name="typeList" select="$typeList"/>\r
+ <xsl:with-param name="parentGroups" select="$parentGroups"/>\r
+ </xsl:call-template>\r
+ </xsl:variable>\r
+\r
+ <!-- Find out if content type is mixed -->\r
+ <xsl:variable name="mixed">\r
+ <xsl:choose>\r
+ <xsl:when test="normalize-space(translate($type/xsd:complexContent/@mixed, 'TRUE', 'true'))='true' or normalize-space($type/xsd:complexContent/@mixed)='1'">\r
+ <xsl:text>true</xsl:text>\r
+ </xsl:when>\r
+ <xsl:when test="normalize-space(translate($type/@mixed, 'TRUE', 'true'))='true' or normalize-space($type/@mixed)='1'">\r
+ <xsl:text>true</xsl:text>\r
+ </xsl:when>\r
+ <xsl:otherwise>\r
+ <xsl:text>false</xsl:text>\r
+ </xsl:otherwise>\r
+ </xsl:choose>\r
+ </xsl:variable>\r
+\r
+ <!-- Find out if there are identity constraints -->\r
+ <xsl:variable name="hasIdConstraints">\r
+ <xsl:if test="$element and ($element/xsd:unique or $element/xsd:key or $element/xsd:keyref)">\r
+ <xsl:text>true</xsl:text>\r
+ </xsl:if>\r
+ </xsl:variable>\r
+\r
+ <!-- Print content -->\r
+ <xsl:choose>\r
+ <!-- Empty content -->\r
+ <xsl:when test="$hasIdConstraints!='true' and normalize-space($content)=''">\r
+ <!-- Close start tag -->\r
+ <xsl:text>/> </xsl:text>\r
+\r
+ <xsl:if test="$element and local-name($element/..)!='schema'">\r
+ <!-- Occurrence info -->\r
+ <xsl:text> </xsl:text>\r
+ <xsl:call-template name="PrintOccurs">\r
+ <xsl:with-param name="component" select="$element"/>\r
+ </xsl:call-template>\r
+\r
+ <!-- Documentation -->\r
+ <xsl:call-template name="PrintSampleDocumentation">\r
+ <xsl:with-param name="component" select="$element"/>\r
+ </xsl:call-template>\r
+ </xsl:if>\r
+ </xsl:when>\r
+ <xsl:otherwise>\r
+ <!-- Close start tag -->\r
+ <xsl:text>> </xsl:text>\r
+\r
+ <xsl:if test="$element and local-name($element/..)!='schema'">\r
+ <!-- Occurrence info -->\r
+ <xsl:text> </xsl:text>\r
+ <xsl:call-template name="PrintOccurs">\r
+ <xsl:with-param name="component" select="$element"/>\r
+ </xsl:call-template>\r
+\r
+ <!-- Documentation -->\r
+ <xsl:text> </xsl:text>\r
+ <xsl:call-template name="PrintSampleDocumentation">\r
+ <xsl:with-param name="component" select="$element"/>\r
+ </xsl:call-template>\r
+ </xsl:if>\r
+\r
+ <!-- Identity Constraints -->\r
+ <xsl:if test="$element">\r
+ <xsl:apply-templates select="$element/xsd:unique | $element/xsd:key | $element/xsd:keyref" mode="sample">\r
+ <xsl:with-param name="margin" select="$ELEM_INDENT"/>\r
+ </xsl:apply-templates>\r
+ </xsl:if>\r
+\r
+ <!-- Print out restriction/extension information -->\r
+ <xsl:choose>\r
+ <xsl:when test="false()">\r
+ <!--<xsl:when test="$type/xsd:complexContent/xsd:restriction/@base">-->\r
+ <br/><span class="other" style="margin-left: {$ELEM_INDENT}em">\r
+ <xsl:text><!-- Restricts : </xsl:text>\r
+ <xsl:call-template name="PrintTypeRef">\r
+ <xsl:with-param name="ref" select="$type/xsd:complexContent/xsd:restriction/@base"/>\r
+ <xsl:with-param name="schemaLoc" select="$schemaLoc"/>\r
+ </xsl:call-template>\r
+ <xsl:text> --></xsl:text>\r
+ </span>\r
+ </xsl:when>\r
+ <xsl:when test="false()">\r
+ <!--<xsl:when test="$type/xsd:complexContent/xsd:extension/@base">-->\r
+ <br/><span class="other" style="margin-left: {$ELEM_INDENT}em">\r
+ <xsl:text><!-- Extends : </xsl:text>\r
+ <xsl:call-template name="PrintTypeRef">\r
+ <xsl:with-param name="ref" select="$type/xsd:complexContent/xsd:extension/@base"/>\r
+ <xsl:with-param name="schemaLoc" select="$schemaLoc"/>\r
+ </xsl:call-template>\r
+ <xsl:text> --></xsl:text>\r
+ </span>\r
+ </xsl:when>\r
+ </xsl:choose>\r
+\r
+ <!-- Print out message if has mixed content -->\r
+ <xsl:if test="$mixed='true'">\r
+ <br/><span class="other" style="margin-left: {$ELEM_INDENT}em">\r
+ <xsl:text><!-- Mixed content --></xsl:text>\r
+ </span>\r
+ </xsl:if>\r
+\r
+ <!-- Element Content -->\r
+ <xsl:copy-of select="$content"/>\r
+\r
+ <!-- End Tag -->\r
+ <xsl:text></</xsl:text>\r
+ <xsl:copy-of select="$tag"/>\r
+ <xsl:text>></xsl:text>\r
+ </xsl:otherwise>\r
+ </xsl:choose>\r
+ </div>\r
+ </xsl:otherwise>\r
+ </xsl:choose>\r
+ </xsl:template>\r
+\r
+ <!--\r
+ Prints out attributes of a complex type definition, including \r
+ those inherited from a base type.\r
+ Param(s):\r
+ type (Node) required\r
+ Complex type definition\r
+ subTypeAttrs (String) optional\r
+ List of attributes in sub-types of this current type \r
+ definition\r
+ isInherited (boolean) optional\r
+ If true, display attributes using 'inherited' CSS class.\r
+ isNewField (boolean) optional\r
+ If true, display attributes using 'newFields' CSS class.\r
+ fromTopCType (boolean) optional\r
+ Set to true if this is being displayed in the XML \r
+ Instance Representation table of a top-level complex \r
+ type definition, in which case, 'inherited' attributes \r
+ and elements are distinguished.\r
+ margin (nonNegativeInteger) optional\r
+ Number of 'em' to indent from left\r
+ schemaLoc (String) optional\r
+ Schema file containing this complex type definition; \r
+ if in current schema, 'schemaLoc' is set to 'this'.\r
+ typeList (String) optional\r
+ List of types in this call chain. Name of type starts\r
+ with '*', and ends with '+'. (Used to prevent infinite\r
+ recursive loop.)\r
+ -->\r
+ <xsl:template name="PrintSampleTypeAttrs">\r
+ <xsl:param name="type"/>\r
+ <xsl:param name="subTypeAttrs"/>\r
+ <xsl:param name="isInherited">false</xsl:param>\r
+ <xsl:param name="isNewField">false</xsl:param>\r
+ <xsl:param name="fromTopCType">false</xsl:param>\r
+ <xsl:param name="margin">0</xsl:param>\r
+ <xsl:param name="schemaLoc">this</xsl:param>\r
+ <xsl:param name="typeList"/>\r
+\r
+ <xsl:choose>\r
+ <!-- Circular type hierarchy -->\r
+ <xsl:when test="$type/@name and contains($typeList, concat('*', $type/@name, '+'))">\r
+ <!-- Do nothing. \r
+ Error message will be written out by 'PrintSampleTypeContent' template. \r
+ -->\r
+ </xsl:when>\r
+ <!-- Derivation -->\r
+ <xsl:when test="$type/xsd:complexContent or $type/xsd:simpleContent">\r
+ <xsl:choose>\r
+ <xsl:when test="$type/xsd:complexContent/xsd:restriction">\r
+ <xsl:call-template name="PrintSampleDerivedTypeAttrs">\r
+ <xsl:with-param name="derivationElem" select="$type/xsd:complexContent/xsd:restriction"/>\r
+ <xsl:with-param name="subTypeAttrs" select="$subTypeAttrs"/>\r
+ <xsl:with-param name="isInherited" select="$isInherited"/>\r
+ <xsl:with-param name="isNewField" select="$isNewField"/>\r
+ <xsl:with-param name="fromTopCType" select="$fromTopCType"/>\r
+ <xsl:with-param name="margin" select="$margin"/>\r
+ <xsl:with-param name="schemaLoc" select="$schemaLoc"/>\r
+ <xsl:with-param name="typeList" select="concat($typeList, '*', $type/@name, '+')"/>\r
+ </xsl:call-template>\r
+ </xsl:when>\r
+ <xsl:when test="$type/xsd:simpleContent/xsd:restriction">\r
+ <xsl:call-template name="PrintSampleDerivedTypeAttrs">\r
+ <xsl:with-param name="derivationElem" select="$type/xsd:simpleContent/xsd:restriction"/>\r
+ <xsl:with-param name="subTypeAttrs" select="$subTypeAttrs"/>\r
+ <xsl:with-param name="isInherited" select="$isInherited"/>\r
+ <xsl:with-param name="isNewField" select="$isNewField"/>\r
+ <xsl:with-param name="fromTopCType" select="$fromTopCType"/>\r
+ <xsl:with-param name="margin" select="$margin"/>\r
+ <xsl:with-param name="schemaLoc" select="$schemaLoc"/>\r
+ <xsl:with-param name="typeList" select="concat($typeList, '*', $type/@name, '+')"/>\r
+ </xsl:call-template>\r
+ </xsl:when>\r
+ <xsl:when test="$type/xsd:complexContent/xsd:extension">\r
+ <xsl:call-template name="PrintSampleDerivedTypeAttrs">\r
+ <xsl:with-param name="derivationElem" select="$type/xsd:complexContent/xsd:extension"/>\r
+ <xsl:with-param name="subTypeAttrs" select="$subTypeAttrs"/>\r
+ <xsl:with-param name="isInherited" select="$isInherited"/>\r
+ <xsl:with-param name="isNewField" select="$isNewField"/>\r
+ <xsl:with-param name="fromTopCType" select="$fromTopCType"/>\r
+ <xsl:with-param name="margin" select="$margin"/>\r
+ <xsl:with-param name="schemaLoc" select="$schemaLoc"/>\r
+ <xsl:with-param name="typeList" select="concat($typeList, '*', $type/@name, '+')"/>\r
+ </xsl:call-template>\r
+ </xsl:when>\r
+ <xsl:when test="$type/xsd:simpleContent/xsd:extension">\r
+ <xsl:call-template name="PrintSampleDerivedTypeAttrs">\r
+ <xsl:with-param name="derivationElem" select="$type/xsd:simpleContent/xsd:extension"/>\r
+ <xsl:with-param name="subTypeAttrs" select="$subTypeAttrs"/>\r
+ <xsl:with-param name="isInherited" select="$isInherited"/>\r
+ <xsl:with-param name="isNewField" select="$isNewField"/>\r
+ <xsl:with-param name="fromTopCType" select="$fromTopCType"/>\r
+ <xsl:with-param name="margin" select="$margin"/>\r
+ <xsl:with-param name="schemaLoc" select="$schemaLoc"/>\r
+ <xsl:with-param name="typeList" select="concat($typeList, '*', $type/@name, '+')"/>\r
+ </xsl:call-template>\r
+ </xsl:when>\r
+ </xsl:choose>\r
+ </xsl:when>\r
+ <!-- No derivation -->\r
+ <xsl:when test="local-name($type)='complexType'">\r
+ <xsl:call-template name="PrintSampleAttrList">\r
+ <xsl:with-param name="list" select="$type"/>\r
+ <xsl:with-param name="subTypeAttrs" select="$subTypeAttrs"/>\r
+ <xsl:with-param name="isInherited" select="$isInherited"/>\r
+ <xsl:with-param name="isNewField" select="$isNewField"/>\r
+ <xsl:with-param name="margin" select="$margin"/>\r
+ <xsl:with-param name="schemaLoc" select="$schemaLoc"/>\r
+ <xsl:with-param name="typeList" select="concat($typeList, '*', $type/@name, '+')"/>\r
+ </xsl:call-template>\r
+ </xsl:when>\r
+ <!-- Ignore base types that are simple types -->\r
+ </xsl:choose>\r
+ </xsl:template>\r
+\r
+ <!--\r
+ Helper function 'PrintSampleTypeAttrs' template to\r
+ handle case of derived types.\r
+ Param(s):\r
+ derivationElem (Node) required\r
+ 'restriction' or 'extension' element\r
+ subTypeAttrs (String) optional\r
+ List of attributes in sub-types of \r
+ this current type definition\r
+ isInherited (boolean) optional\r
+ If true, display attributes using 'inherited' CSS class.\r
+ isNewField (boolean) optional\r
+ If true, display attributes using 'newFields' CSS class.\r
+ fromTopCType (boolean) optional\r
+ Set to true if this is being displayed \r
+ in the XML Instance Representation table \r
+ of a top-level complex type definition, in\r
+ which case, 'inherited' attributes and\r
+ elements are distinguished.\r
+ margin (nonNegativeInteger) optional\r
+ Number of 'em' to indent from left\r
+ schemaLoc (String) optional\r
+ Schema file containing this derivation element; \r
+ if in current schema, 'schemaLoc' is set to 'this'.\r
+ typeList (String) optional\r
+ List of types in this call chain. Name of type starts\r
+ with '*', and ends with '+'. (Used to prevent infinite\r
+ recursive loop.)\r
+ -->\r
+ <xsl:template name="PrintSampleDerivedTypeAttrs">\r
+ <xsl:param name="derivationElem"/>\r
+ <xsl:param name="subTypeAttrs"/>\r
+ <xsl:param name="isInherited">false</xsl:param>\r
+ <xsl:param name="isNewField">false</xsl:param>\r
+ <xsl:param name="fromTopCType">false</xsl:param>\r
+ <xsl:param name="margin">0</xsl:param>\r
+ <xsl:param name="schemaLoc">this</xsl:param>\r
+ <xsl:param name="typeList"/>\r
+\r
+ <!-- Get attributes from this type to add to \r
+ 'subTypeAttrs' list for recursive call on base type -->\r
+ <xsl:variable name="thisAttrs">\r
+ <xsl:call-template name="GetAttrList">\r
+ <xsl:with-param name="list" select="$derivationElem"/>\r
+ </xsl:call-template>\r
+ </xsl:variable>\r
+\r
+ <!-- Look for base type -->\r
+ <xsl:variable name="baseTypeName">\r
+ <xsl:call-template name="GetRefName">\r
+ <xsl:with-param name="ref" select="$derivationElem/@base"/>\r
+ </xsl:call-template>\r
+ </xsl:variable>\r
+ <xsl:variable name="defLoc">\r
+ <xsl:call-template name="FindComponent">\r
+ <xsl:with-param name="ref" select="$derivationElem/@base"/>\r
+ <xsl:with-param name="compType">complex type</xsl:with-param>\r
+ </xsl:call-template>\r
+ </xsl:variable>\r
+ <xsl:choose>\r
+ <!-- Complex type was found in current schema. -->\r
+ <xsl:when test="normalize-space($defLoc)='this'">\r
+ <xsl:variable name="ctype" select="key('complexType', $baseTypeName)"/>\r
+ <xsl:call-template name="PrintSampleTypeAttrs">\r
+ <xsl:with-param name="type" select="$ctype"/>\r
+ <xsl:with-param name="subTypeAttrs" select="concat($subTypeAttrs, $thisAttrs)"/>\r
+ <xsl:with-param name="isInherited">\r
+ <xsl:choose>\r
+ <xsl:when test="$fromTopCType!='false'">\r
+ <xsl:text>true</xsl:text>\r
+ </xsl:when>\r
+ <xsl:otherwise>\r
+ <xsl:text>false</xsl:text>\r
+ </xsl:otherwise>\r
+ </xsl:choose>\r
+ </xsl:with-param>\r
+ <xsl:with-param name="isNewField" select="$isNewField"/>\r
+ <xsl:with-param name="fromTopCType" select="$fromTopCType"/>\r
+ <xsl:with-param name="margin" select="$margin"/>\r
+ <xsl:with-param name="schemaLoc" select="$schemaLoc"/>\r
+ <xsl:with-param name="typeList" select="$typeList"/>\r
+ </xsl:call-template>\r
+ </xsl:when>\r
+ <!-- Complex type was not found. -->\r
+ <xsl:when test="normalize-space($defLoc)='' or normalize-space($defLoc)='none' or normalize-space($defLoc)='xml' or normalize-space($defLoc)='xsd'">\r
+ <!-- IGNORE: Error message will be printed out be\r
+ 'PrintSampleTypeContent' template. -->\r
+ </xsl:when>\r
+ <!-- Complex type was found in external schema. -->\r
+ <xsl:otherwise>\r
+ <xsl:variable name="ctype" select="document($defLoc)/xsd:schema/xsd:complexType[@name=$baseTypeName]"/>\r
+ <xsl:call-template name="PrintSampleTypeAttrs">\r
+ <xsl:with-param name="type" select="$ctype"/>\r
+ <xsl:with-param name="subTypeAttrs" select="concat($subTypeAttrs, $thisAttrs)"/>\r
+ <xsl:with-param name="isInherited">\r
+ <xsl:choose>\r
+ <xsl:when test="$fromTopCType!='false'">\r
+ <xsl:text>true</xsl:text>\r
+ </xsl:when>\r
+ <xsl:otherwise>\r
+ <xsl:text>false</xsl:text>\r
+ </xsl:otherwise>\r
+ </xsl:choose>\r
+ </xsl:with-param>\r
+ <xsl:with-param name="isNewField" select="$isNewField"/>\r
+ <xsl:with-param name="fromTopCType" select="$fromTopCType"/>\r
+ <xsl:with-param name="margin" select="$margin"/>\r
+ <xsl:with-param name="schemaLoc" select="$defLoc"/>\r
+ <xsl:with-param name="typeList" select="$typeList"/>\r
+ </xsl:call-template>\r
+ </xsl:otherwise>\r
+ </xsl:choose>\r
+\r
+ <!-- Print out attributes in this type -->\r
+ <xsl:call-template name="PrintSampleAttrList">\r
+ <xsl:with-param name="list" select="$derivationElem"/>\r
+ <xsl:with-param name="subTypeAttrs" select="$subTypeAttrs"/>\r
+ <xsl:with-param name="isInherited" select="$isInherited"/>\r
+ <xsl:with-param name="isNewField">\r
+ <xsl:choose>\r
+ <xsl:when test="$fromTopCType!='false' and $isInherited='false'">\r
+ <xsl:text>true</xsl:text>\r
+ </xsl:when>\r
+ <xsl:otherwise>\r
+ <xsl:text>false</xsl:text>\r
+ </xsl:otherwise>\r
+ </xsl:choose>\r
+ </xsl:with-param>\r
+ <xsl:with-param name="margin" select="$margin"/>\r
+ <xsl:with-param name="schemaLoc" select="$schemaLoc"/>\r
+ </xsl:call-template>\r
+ </xsl:template>\r
+\r
+ <!--\r
+ Returns the names and namespaces of attributes\r
+ in a list of attributes and attribute groups.\r
+ Param(s):\r
+ list (Node) required\r
+ Node containing list of attributes and attribute groups\r
+ -->\r
+ <xsl:template name="GetAttrList">\r
+ <xsl:param name="list"/>\r
+\r
+ <xsl:if test="$list">\r
+ <xsl:for-each select="$list/xsd:attribute | $list/xsd:attributeGroup | $list/xsd:anyAttribute">\r
+ <xsl:choose>\r
+ <!-- Attribute declaration -->\r
+ <xsl:when test="local-name(.)='attribute' and @name">\r
+ <!-- Get attribute name -->\r
+ <xsl:variable name="attrName" select="@name"/>\r
+ <!-- Get attribute namespace -->\r
+ <xsl:variable name="attrNS">\r
+ <xsl:call-template name="GetAttributeNS">\r
+ <xsl:with-param name="attribute" select="."/>\r
+ </xsl:call-template>\r
+ </xsl:variable>\r
+\r
+ <xsl:value-of select="concat('*', normalize-space($attrNS), '+', normalize-space($attrName), '+')"/>\r
+ </xsl:when>\r
+ <!-- Attribute reference -->\r
+ <xsl:when test="local-name(.)='attribute' and @ref">\r
+ <!-- Get attribute name -->\r
+ <xsl:variable name="attrName">\r
+ <xsl:call-template name="GetRefName">\r
+ <xsl:with-param name="ref" select="@ref"/>\r
+ </xsl:call-template>\r
+ </xsl:variable>\r
+ <!-- Get attribute namespace -->\r
+ <xsl:variable name="attrNS">\r
+ <xsl:call-template name="GetAttributeNS">\r
+ <xsl:with-param name="attribute" select="."/>\r
+ </xsl:call-template>\r
+ </xsl:variable>\r
+\r
+ <xsl:value-of select="concat('*', normalize-space($attrNS), '+', normalize-space($attrName), '+')"/>\r
+ </xsl:when>\r
+ <!-- Attribute Group reference -->\r
+ <xsl:when test="local-name(.)='attributeGroup' and @ref">\r
+ <xsl:variable name="attrGrpName">\r
+ <xsl:call-template name="GetRefName">\r
+ <xsl:with-param name="ref" select="@ref"/>\r
+ </xsl:call-template>\r
+ </xsl:variable>\r
+ <xsl:call-template name="GetAttrList">\r
+ <xsl:with-param name="list" select="key('attributeGroup', $attrGrpName)"/>\r
+ </xsl:call-template>\r
+ </xsl:when>\r
+ <!-- Attribute wildcard -->\r
+ <xsl:when test="local-name(.)='anyAttribute'">\r
+ </xsl:when>\r
+ </xsl:choose>\r
+ </xsl:for-each>\r
+ </xsl:if>\r
+ </xsl:template>\r
+\r
+ <!--\r
+ Prints out sample XML instances from a list of attributes and \r
+ attribute groups.\r
+ Param(s):\r
+ list (Node) required\r
+ Node containing list of attributes and attribute groups\r
+ subTypeAttrs (String) optional\r
+ List of attributes in sub-types of \r
+ the type definition containing this list\r
+ isInherited (boolean) optional\r
+ If true, display attributes using 'inherited' CSS class.\r
+ isNewField (boolean) optional\r
+ If true, display attributes using 'newFields' CSS class.\r
+ margin (nonNegativeInteger) optional\r
+ Number of 'em' to indent from left\r
+ schemaLoc (String) optional\r
+ Schema file containing this attribute list; \r
+ if in current schema, 'schemaLoc' is set to 'this'.\r
+ -->\r
+ <xsl:template name="PrintSampleAttrList">\r
+ <xsl:param name="list"/>\r
+ <xsl:param name="subTypeAttrs"/>\r
+ <xsl:param name="isInherited">false</xsl:param>\r
+ <xsl:param name="isNewField">false</xsl:param>\r
+ <xsl:param name="margin">0</xsl:param>\r
+ <xsl:param name="schemaLoc">this</xsl:param>\r
+\r
+ <xsl:apply-templates select="$list/xsd:attribute | $list/xsd:attributeGroup | $list/xsd:anyAttribute" mode="sample">\r
+ <xsl:with-param name="subTypeAttrs" select="$subTypeAttrs"/>\r
+ <xsl:with-param name="isInherited" select="$isInherited"/>\r
+ <xsl:with-param name="isNewField" select="$isNewField"/>\r
+ <xsl:with-param name="margin" select="$margin"/>\r
+ <xsl:with-param name="addBR">true</xsl:with-param>\r
+ <xsl:with-param name="schemaLoc" select="$schemaLoc"/>\r
+ </xsl:apply-templates>\r
+ </xsl:template>\r
+\r
+ <!--\r
+ Prints out the element content of a complex type definition,\r
+ including those inherited from a base type.\r
+ Param(s):\r
+ type (Node) required\r
+ Complex type definition\r
+ margin (nonNegativeInteger) optional\r
+ Number of 'em' to indent from left\r
+ isInherited (boolean) optional\r
+ If true, display elements using 'inherited' CSS class.\r
+ isNewField (boolean) optional\r
+ If true, display elements using 'newFields' CSS class.\r
+ fromTopCType (boolean) optional\r
+ Set to true if this is being displayed in the XML \r
+ Instance Representation table of a top-level complex \r
+ type definition, in which case, 'inherited' attributes \r
+ and elements are distinguished.\r
+ addBR (boolean) optional\r
+ If true, can add <br/> before element content.\r
+ Applicable only if displaying complex content.\r
+ schemaLoc (String) optional\r
+ Schema file containing this type definition; \r
+ if in current schema, 'schemaLoc' is set to 'this'.\r
+ typeList (String) optional\r
+ List of types in this call chain. Name of type starts\r
+ with '*', and ends with '+'. (Used to prevent infinite\r
+ recursive loop.)\r
+ -->\r
+ <xsl:template name="PrintSampleTypeContent">\r
+ <xsl:param name="type"/>\r
+ <xsl:param name="margin">0</xsl:param>\r
+ <xsl:param name="isInherited">false</xsl:param>\r
+ <xsl:param name="isNewField">false</xsl:param>\r
+ <xsl:param name="fromTopCType">false</xsl:param>\r
+ <xsl:param name="addBR">true</xsl:param>\r
+ <xsl:param name="schemaLoc">this</xsl:param>\r
+ <xsl:param name="typeList"/>\r
+ <xsl:param name="parentGroups"/>\r
+\r
+ <xsl:if test="$addBR='true'"><br/></xsl:if>\r
+\r
+ <xsl:choose>\r
+ <!-- Circular type hierarchy -->\r
+ <xsl:when test="$type/@name and contains($typeList, concat('*', $type/@name, '+'))"/>\r
+ <!-- Derivation by restriction on complex content -->\r
+ <xsl:when test="$type/xsd:complexContent/xsd:restriction">\r
+ <xsl:variable name="restriction" select="$type/xsd:complexContent/xsd:restriction"/>\r
+\r
+ <!-- Test if base type is in schema to print out warning comment-->\r
+ <xsl:variable name="baseTypeName">\r
+ <xsl:call-template name="GetRefName">\r
+ <xsl:with-param name="ref" select="$restriction/@base"/>\r
+ </xsl:call-template>\r
+ </xsl:variable>\r
+ <!-- Look for base type -->\r
+ <xsl:variable name="defLoc">\r
+ <xsl:call-template name="FindComponent">\r
+ <xsl:with-param name="ref" select="$restriction/@base"/>\r
+ <xsl:with-param name="compType">complex type</xsl:with-param>\r
+ </xsl:call-template>\r
+ </xsl:variable>\r
+\r
+ <xsl:choose>\r
+ <!-- Complex type was not found. -->\r
+ <xsl:when test="normalize-space($defLoc)='' or normalize-space($defLoc)='none' or normalize-space($defLoc)='xml' or normalize-space($defLoc)='xsd'">\r
+ <div class="other" style="margin-left: {$margin}em;">\r
+ <xsl:text><!-- '</xsl:text>\r
+ <xsl:call-template name="PrintTypeRef">\r
+ <xsl:with-param name="ref" select="$restriction/@base"/>\r
+ <xsl:with-param name="schemaLoc" select="$schemaLoc"/>\r
+ </xsl:call-template>\r
+ <xsl:text>' super type was not found in this schema. Some elements and attributes may be missing. --></xsl:text>\r
+ </div>\r
+ </xsl:when>\r
+ <!-- Complex type was found. -->\r
+ <xsl:otherwise>\r
+ <!-- IGNORE element content of base type if by restriction,\r
+ since current content will override restricted\r
+ base type's content. -->\r
+ </xsl:otherwise>\r
+ </xsl:choose>\r
+\r
+ <!-- Print out content from this type -->\r
+ <xsl:if test="$restriction/xsd:*[local-name(.)!='annotation']">\r
+ <xsl:call-template name="PrintSampleParticleList">\r
+ <xsl:with-param name="list" select="$restriction"/>\r
+ <xsl:with-param name="margin" select="$margin"/>\r
+ <xsl:with-param name="isInherited" select="$isInherited"/>\r
+ <xsl:with-param name="isNewField">\r
+ <xsl:choose>\r
+ <xsl:when test="$fromTopCType!='false' and $isInherited='false'">\r
+ <xsl:text>true</xsl:text>\r
+ </xsl:when>\r
+ <xsl:otherwise>\r
+ <xsl:text>false</xsl:text>\r
+ </xsl:otherwise>\r
+ </xsl:choose>\r
+ </xsl:with-param>\r
+ <xsl:with-param name="schemaLoc" select="$schemaLoc"/>\r
+ <xsl:with-param name="typeList" select="concat($typeList, '*', $type/@name, '+')"/>\r
+ <xsl:with-param name="parentGroups" select="$parentGroups"/>\r
+ </xsl:call-template>\r
+ </xsl:if>\r
+ </xsl:when>\r
+ <!-- Derivation by extension on complex content -->\r
+ <xsl:when test="$type/xsd:complexContent/xsd:extension">\r
+ <xsl:variable name="extension" select="$type/xsd:complexContent/xsd:extension"/>\r
+\r
+ <xsl:variable name="baseTypeName">\r
+ <xsl:call-template name="GetRefName">\r
+ <xsl:with-param name="ref" select="$extension/@base"/>\r
+ </xsl:call-template>\r
+ </xsl:variable>\r
+\r
+ <xsl:choose>\r
+ <xsl:when test="contains($typeList, concat('*', $baseTypeName, '+'))">\r
+ <div class="other" style="margin-left: {$margin}em">\r
+ <xsl:text><-- Extends: </xsl:text>\r
+ <xsl:call-template name="PrintTypeRef">\r
+ <xsl:with-param name="ref" select="$extension/@base"/>\r
+ <xsl:with-param name="schemaLoc" select="$schemaLoc"/>\r
+ </xsl:call-template>\r
+ <xsl:text> (Circular type hierarchy) --></xsl:text>\r
+ </div>\r
+ </xsl:when>\r
+ <xsl:otherwise>\r
+ <!-- Look for base type -->\r
+ <xsl:variable name="defLoc">\r
+ <xsl:call-template name="FindComponent">\r
+ <xsl:with-param name="ref" select="$extension/@base"/>\r
+ <xsl:with-param name="compType">complex type</xsl:with-param>\r
+ </xsl:call-template>\r
+ </xsl:variable>\r
+\r
+ <xsl:choose>\r
+ <!-- Complex type was found in current schema. -->\r
+ <xsl:when test="normalize-space($defLoc)='this'">\r
+ <xsl:variable name="ctype" select="key('complexType', $baseTypeName)"/>\r
+ <xsl:call-template name="PrintSampleTypeContent">\r
+ <xsl:with-param name="type" select="$ctype"/>\r
+ <xsl:with-param name="margin" select="$margin"/>\r
+ <xsl:with-param name="isInherited">\r
+ <xsl:choose>\r
+ <xsl:when test="$fromTopCType!='false'">\r
+ <xsl:text>true</xsl:text>\r
+ </xsl:when>\r
+ <xsl:otherwise>\r
+ <xsl:text>false</xsl:text>\r
+ </xsl:otherwise>\r
+ </xsl:choose>\r
+ </xsl:with-param>\r
+ <xsl:with-param name="isNewField" select="$isNewField"/>\r
+ <xsl:with-param name="fromTopCType" select="$fromTopCType"/>\r
+ <xsl:with-param name="addBR">false</xsl:with-param>\r
+ <xsl:with-param name="schemaLoc" select="$schemaLoc"/>\r
+ <xsl:with-param name="typeList" select="concat($typeList, '*', $type/@name, '+')"/>\r
+ <xsl:with-param name="parentGroups" select="$parentGroups"/>\r
+ </xsl:call-template>\r
+ </xsl:when>\r
+ <!-- Complex type was not found. -->\r
+ <xsl:when test="normalize-space($defLoc)='' or normalize-space($defLoc)='none' or normalize-space($defLoc)='xml' or normalize-space($defLoc)='xsd'">\r
+ <div class="other" style="margin-left: {$margin}em;">\r
+ <xsl:text><!-- '</xsl:text>\r
+ <xsl:call-template name="PrintTypeRef">\r
+ <xsl:with-param name="ref" select="$extension/@base"/>\r
+ <xsl:with-param name="schemaLoc" select="$schemaLoc"/>\r
+ </xsl:call-template>\r
+ <xsl:text>' super type was not found in this schema. Some elements and attributes may be missing. --></xsl:text>\r
+ </div>\r
+ </xsl:when>\r
+ <!-- Complex type was found in external schema. -->\r
+ <xsl:otherwise>\r
+ <xsl:variable name="ctype" select="document($defLoc)/xsd:schema/xsd:complexType[@name=$baseTypeName]"/>\r
+ <xsl:call-template name="PrintSampleTypeContent">\r
+ <xsl:with-param name="type" select="$ctype"/>\r
+ <xsl:with-param name="margin" select="$margin"/>\r
+ <xsl:with-param name="isInherited">\r
+ <xsl:choose>\r
+ <xsl:when test="$fromTopCType!='false'">\r
+ <xsl:text>true</xsl:text>\r
+ </xsl:when>\r
+ <xsl:otherwise>\r
+ <xsl:text>false</xsl:text>\r
+ </xsl:otherwise>\r
+ </xsl:choose>\r
+ </xsl:with-param>\r
+ <xsl:with-param name="isNewField" select="$isNewField"/>\r
+ <xsl:with-param name="fromTopCType" select="$fromTopCType"/>\r
+ <xsl:with-param name="addBR">false</xsl:with-param>\r
+ <xsl:with-param name="schemaLoc" select="$defLoc"/>\r
+ <xsl:with-param name="typeList" select="concat($typeList, '*', $type/@name, '+')"/>\r
+ <xsl:with-param name="parentGroups" select="$parentGroups"/>\r
+ </xsl:call-template>\r
+ </xsl:otherwise>\r
+ </xsl:choose>\r
+\r
+ <!-- Print out content from this type -->\r
+ <xsl:if test="$extension/xsd:*[local-name(.)!='annotation']">\r
+ <xsl:call-template name="PrintSampleParticleList">\r
+ <xsl:with-param name="list" select="$extension"/>\r
+ <xsl:with-param name="margin" select="$margin"/>\r
+ <xsl:with-param name="isInherited" select="$isInherited"/>\r
+ <xsl:with-param name="isNewField">\r
+ <xsl:choose>\r
+ <xsl:when test="$fromTopCType!='false' and $isInherited='false'">\r
+ <xsl:text>true</xsl:text>\r
+ </xsl:when>\r
+ <xsl:otherwise>\r
+ <xsl:text>false</xsl:text>\r
+ </xsl:otherwise>\r
+ </xsl:choose>\r
+ </xsl:with-param>\r
+ <xsl:with-param name="schemaLoc" select="$schemaLoc"/>\r
+ <xsl:with-param name="typeList" select="concat($typeList, '*', $type/@name, '+')"/>\r
+ <xsl:with-param name="parentGroups" select="$parentGroups"/>\r
+ </xsl:call-template>\r
+ </xsl:if>\r
+ </xsl:otherwise>\r
+ </xsl:choose>\r
+ </xsl:when>\r
+ <!-- Derivation by restriction on simple content -->\r
+ <xsl:when test="$type/xsd:simpleContent/xsd:restriction">\r
+ <!-- Print out simple type constraints-->\r
+ <span style="margin-left: {$margin}em">\r
+ <xsl:text> </xsl:text>\r
+ <xsl:apply-templates select="$type/xsd:simpleContent" mode="sample">\r
+ <xsl:with-param name="schemaLoc" select="$schemaLoc"/>\r
+ </xsl:apply-templates>\r
+ <xsl:text> </xsl:text>\r
+ </span><br/>\r
+ </xsl:when>\r
+ <!-- Derivation by extension on simple content -->\r
+ <xsl:when test="$type/xsd:simpleContent/xsd:extension">\r
+ <!-- Print out base type name -->\r
+ <span style="margin-left: {$margin}em">\r
+ <xsl:text> </xsl:text>\r
+ <xsl:call-template name="PrintTypeRef">\r
+ <xsl:with-param name="ref" select="$type/xsd:simpleContent/xsd:extension/@base"/>\r
+ <xsl:with-param name="schemaLoc" select="$schemaLoc"/>\r
+ </xsl:call-template>\r
+ <xsl:text> </xsl:text>\r
+ </span><br/>\r
+ </xsl:when>\r
+ <!-- No derivation: complex type definition -->\r
+ <xsl:when test="local-name($type)='complexType'">\r
+ <!-- Print out content from this type -->\r
+ <xsl:call-template name="PrintSampleParticleList">\r
+ <xsl:with-param name="list" select="$type"/>\r
+ <xsl:with-param name="margin" select="$margin"/>\r
+ <xsl:with-param name="isInherited" select="$isInherited"/>\r
+ <xsl:with-param name="isNewField" select="$isNewField"/>\r
+ <xsl:with-param name="schemaLoc" select="$schemaLoc"/>\r
+ <xsl:with-param name="typeList" select="concat($typeList, '*', $type/@name, '+')"/>\r
+ <xsl:with-param name="parentGroups" select="$parentGroups"/>\r
+ </xsl:call-template>\r
+ </xsl:when>\r
+ </xsl:choose>\r
+ </xsl:template>\r
+\r
+ <!--\r
+ Prints out sample XML instances from a list of \r
+ element particle.\r
+ Param(s):\r
+ list (Node) required\r
+ Node containing list of element particles\r
+ margin (nonNegativeInteger) optional\r
+ Number of 'em' to indent from left\r
+ isInherited (boolean) optional\r
+ If true, display elements using 'inherited' CSS class.\r
+ isNewField (boolean) optional\r
+ If true, display elements using 'newFields' CSS class.\r
+ schemaLoc (String) optional\r
+ Schema file containing this particle list; \r
+ if in current schema, 'schemaLoc' is set to 'this'.\r
+ typeList (String) optional\r
+ List of types in this call chain. Name of type starts\r
+ with '*', and ends with '+'. (Used to prevent infinite\r
+ recursive loop.)\r
+ -->\r
+ <xsl:template name="PrintSampleParticleList">\r
+ <xsl:param name="list"/>\r
+ <xsl:param name="margin">0</xsl:param>\r
+ <xsl:param name="isInherited">false</xsl:param>\r
+ <xsl:param name="isNewField">false</xsl:param>\r
+ <xsl:param name="schemaLoc">this</xsl:param>\r
+ <xsl:param name="typeList"/>\r
+ <xsl:param name="parentGroups"/>\r
+\r
+ <xsl:if test="$list">\r
+ <xsl:apply-templates select="$list/xsd:group | $list/xsd:sequence | $list/xsd:choice | $list/xsd:all | $list/xsd:element" mode="sample">\r
+ <xsl:with-param name="margin" select="$margin"/>\r
+ <xsl:with-param name="isInherited" select="$isInherited"/>\r
+ <xsl:with-param name="isNewField" select="$isNewField"/>\r
+ <xsl:with-param name="schemaLoc" select="$schemaLoc"/>\r
+ <xsl:with-param name="typeList" select="$typeList"/>\r
+ <xsl:with-param name="parentGroups" select="$parentGroups"/>\r
+ </xsl:apply-templates>\r
+ </xsl:if>\r
+ </xsl:template>\r
+\r
+ <!--\r
+ Prints out the constraints of simple content\r
+ to be displayed within a sample XML instance.\r
+ Param(s):\r
+ simpleContent (Node) required\r
+ Node containing with the simple content\r
+ schemaLoc (String) optional\r
+ Schema file containing these simple constraints; \r
+ if in current schema, 'schemaLoc' is set to 'this'.\r
+ -->\r
+ <xsl:template name="PrintSampleSimpleConstraints">\r
+ <xsl:param name="simpleContent"/>\r
+ <xsl:param name="schemaLoc">this</xsl:param>\r
+ <xsl:param name="typeList"/>\r
+\r
+ <xsl:choose>\r
+ <!-- Derivation by restriction -->\r
+ <xsl:when test="$simpleContent/xsd:restriction">\r
+ <xsl:call-template name="PrintSampleSimpleRestriction">\r
+ <xsl:with-param name="restriction" select="$simpleContent/xsd:restriction"/>\r
+ <xsl:with-param name="schemaLoc" select="$schemaLoc"/>\r
+ <xsl:with-param name="typeList" select="$typeList"/>\r
+ </xsl:call-template>\r
+ </xsl:when>\r
+ <!-- Derivation by list -->\r
+ <xsl:when test="$simpleContent/xsd:list">\r
+ <xsl:choose>\r
+ <xsl:when test="$simpleContent/xsd:list/@itemType">\r
+ <xsl:text>list of: </xsl:text>\r
+ <xsl:call-template name="PrintTypeRef">\r
+ <xsl:with-param name="ref" select="$simpleContent/xsd:list/@itemType"/>\r
+ <xsl:with-param name="schemaLoc" select="$schemaLoc"/>\r
+ </xsl:call-template>\r
+ </xsl:when>\r
+ <xsl:otherwise>\r
+ <xsl:text>list of: [ </xsl:text>\r
+ <xsl:call-template name="PrintSampleSimpleConstraints">\r
+ <xsl:with-param name="simpleContent" select="$simpleContent/xsd:list/xsd:simpleType"/>\r
+ <xsl:with-param name="schemaLoc" select="$schemaLoc"/>\r
+ </xsl:call-template>\r
+ <xsl:text> ]</xsl:text>\r
+ </xsl:otherwise>\r
+ </xsl:choose>\r
+ </xsl:when>\r
+ <!-- Derivation by union -->\r
+ <xsl:when test="$simpleContent/xsd:union">\r
+ <xsl:text>union of: [ </xsl:text>\r
+\r
+ <xsl:variable name="hasMemberTypes">\r
+ <xsl:if test="normalize-space($simpleContent/xsd:union/@memberTypes)!=''">\r
+ <xsl:text>true</xsl:text>\r
+ </xsl:if>\r
+ </xsl:variable>\r
+ <xsl:if test="$hasMemberTypes='true'">\r
+ <xsl:call-template name="PrintWhitespaceList">\r
+ <xsl:with-param name="value" select="$simpleContent/xsd:union/@memberTypes"/>\r
+ <xsl:with-param name="compType">type</xsl:with-param>\r
+ <xsl:with-param name="separator">,</xsl:with-param>\r
+ <xsl:with-param name="schemaLoc" select="$schemaLoc"/>\r
+ </xsl:call-template>\r
+ </xsl:if>\r
+ <xsl:for-each select="$simpleContent/xsd:union/xsd:simpleType">\r
+ <xsl:if test="position()!=1 or $hasMemberTypes='true'">\r
+ <xsl:text>, </xsl:text>\r
+ </xsl:if>\r
+ <xsl:text>[ </xsl:text>\r
+ <xsl:call-template name="PrintSampleSimpleConstraints">\r
+ <xsl:with-param name="simpleContent" select="."/>\r
+ <xsl:with-param name="schemaLoc" select="$schemaLoc"/>\r
+ </xsl:call-template>\r
+ <xsl:text> ]</xsl:text>\r
+ </xsl:for-each>\r
+\r
+ <xsl:text> ]</xsl:text>\r
+ </xsl:when>\r
+ </xsl:choose>\r
+ </xsl:template>\r
+\r
+ <!--\r
+ Prints out the constraints of simple content\r
+ derived by restriction, which is to be displayed \r
+ within a sample XML instance.\r
+ Param(s):\r
+ restriction (Node) required\r
+ Node containing with the restriction\r
+ schemaLoc (String) optional\r
+ Schema file containing this restriction element; \r
+ if in current schema, 'schemaLoc' is set to 'this'.\r
+ -->\r
+ <xsl:template name="PrintSampleSimpleRestriction">\r
+ <xsl:param name="restriction"/>\r
+ <xsl:param name="schemaLoc">this</xsl:param>\r
+ <xsl:param name="typeList"/>\r
+\r
+ <xsl:variable name="typeName" select="$restriction/parent::xsd:simpleType/@name"/>\r
+\r
+ <!-- Print out base type info -->\r
+ <xsl:choose>\r
+ <!-- Circular type hierarchy -->\r
+ <xsl:when test="$typeName != '' and contains($typeList, concat('*', $typeName, '+'))">\r
+ <xsl:call-template name="HandleError">\r
+ <xsl:with-param name="isTerminating">false</xsl:with-param>\r
+ <xsl:with-param name="errorMsg">\r
+ <xsl:text>Circular type reference to '</xsl:text>\r
+ <xsl:value-of select="$typeName"/>\r
+ <xsl:text>' in type hierarchy.</xsl:text>\r
+ </xsl:with-param>\r
+ </xsl:call-template>\r
+ </xsl:when>\r
+ <!-- Locally-defined base type -->\r
+ <xsl:when test="$restriction/xsd:simpleType">\r
+ <xsl:call-template name="PrintSampleSimpleConstraints">\r
+ <xsl:with-param name="simpleContent" select="$restriction/xsd:simpleType"/>\r
+ <xsl:with-param name="schemaLoc" select="$schemaLoc"/>\r
+ <xsl:with-param name="typeList" select="$typeList"/>\r
+ </xsl:call-template>\r
+ </xsl:when>\r
+ <!-- Base type reference -->\r
+ <xsl:when test="$restriction">\r
+ <xsl:variable name="baseTypeRef" select="$restriction/@base"/>\r
+ <xsl:variable name="baseTypeName">\r
+ <xsl:call-template name="GetRefName">\r
+ <xsl:with-param name="ref" select="$baseTypeRef"/>\r
+ </xsl:call-template>\r
+ </xsl:variable>\r
+ <xsl:variable name="baseTypeNS">\r
+ <xsl:call-template name="GetRefNS">\r
+ <xsl:with-param name="ref" select="$baseTypeRef"/>\r
+ </xsl:call-template>\r
+ </xsl:variable>\r
+ <!-- Write out reference to base type -->\r
+ <xsl:call-template name="PrintTypeRef">\r
+ <xsl:with-param name="ref" select="$baseTypeRef"/>\r
+ <xsl:with-param name="schemaLoc" select="$schemaLoc"/>\r
+ </xsl:call-template>\r
+ </xsl:when>\r
+ </xsl:choose>\r
+\r
+ <!-- Regular Expression Pattern -->\r
+ <xsl:variable name="pattern">\r
+ <xsl:call-template name="PrintPatternFacet">\r
+ <xsl:with-param name="simpleRestrict" select="$restriction"/>\r
+ </xsl:call-template>\r
+ </xsl:variable>\r
+ <!-- Range -->\r
+ <xsl:variable name="range">\r
+ <xsl:call-template name="PrintRangeFacets">\r
+ <xsl:with-param name="simpleRestrict" select="$restriction"/>\r
+ </xsl:call-template>\r
+ </xsl:variable>\r
+ <!-- Length -->\r
+ <xsl:variable name="length">\r
+ <xsl:call-template name="PrintLengthFacets">\r
+ <xsl:with-param name="simpleRestrict" select="$restriction"/>\r
+ </xsl:call-template>\r
+ </xsl:variable>\r
+\r
+ <!-- Print out facets -->\r
+ <xsl:if test="$restriction/xsd:enumeration">\r
+ <xsl:text> (</xsl:text>\r
+ <xsl:call-template name="PrintEnumFacets">\r
+ <xsl:with-param name="simpleRestrict" select="$restriction"/>\r
+ </xsl:call-template>\r
+ <xsl:text>)</xsl:text>\r
+ </xsl:if>\r
+ <xsl:if test="$pattern !=''">\r
+ <xsl:text> (</xsl:text>\r
+ <xsl:copy-of select="$pattern"/>\r
+ <xsl:text>)</xsl:text>\r
+ </xsl:if>\r
+ <xsl:if test="$range !=''">\r
+ <xsl:text> (</xsl:text>\r
+ <xsl:copy-of select="$range"/>\r
+ <xsl:text>)</xsl:text>\r
+ </xsl:if>\r
+ <xsl:if test="$restriction/xsd:totalDigits">\r
+ <xsl:text> (</xsl:text>\r
+ <xsl:call-template name="PrintTotalDigitsFacet">\r
+ <xsl:with-param name="simpleRestrict" select="$restriction"/>\r
+ </xsl:call-template>\r
+ <xsl:text>)</xsl:text>\r
+ </xsl:if>\r
+ <xsl:if test="$restriction/xsd:fractionDigits">\r
+ <xsl:text> (</xsl:text>\r
+ <xsl:call-template name="PrintFractionDigitsFacet">\r
+ <xsl:with-param name="simpleRestrict" select="$restriction"/>\r
+ </xsl:call-template>\r
+ <xsl:text>)</xsl:text>\r
+ </xsl:if>\r
+ <xsl:if test="$length !=''">\r
+ <xsl:text> (</xsl:text>\r
+ <xsl:copy-of select="$length"/>\r
+ <xsl:text>)</xsl:text>\r
+ </xsl:if>\r
+ <xsl:if test="$restriction/xsd:whiteSpace">\r
+ <xsl:text> (</xsl:text>\r
+ <xsl:call-template name="PrintWhitespaceFacet">\r
+ <xsl:with-param name="simpleRestrict" select="$restriction"/>\r
+ </xsl:call-template>\r
+ <xsl:text>)</xsl:text>\r
+ </xsl:if>\r
+ </xsl:template>\r
+\r
+ <!-- ******** Schema Component Representation table ******** -->\r
+\r
+ <!-- \r
+ Prints out the Schema Component Representation table \r
+ for a top-level schema component. \r
+ Param(s):\r
+ component (Node) required\r
+ Top-level schema component\r
+ -->\r
+ <xsl:template name="SchemaComponentTable">\r
+ <xsl:param name="component"/>\r
+\r
+ <xsl:variable name="componentID">\r
+ <xsl:call-template name="GetComponentID">\r
+ <xsl:with-param name="component" select="$component"/>\r
+ </xsl:call-template>\r
+ </xsl:variable>\r
+\r
+ <xsl:call-template name="CollapseableBox">\r
+ <xsl:with-param name="id" select="concat($componentID, '_scbox')"/>\r
+ <xsl:with-param name="styleClass">schemaComponent</xsl:with-param>\r
+ <xsl:with-param name="caption">Schema Component Representation</xsl:with-param>\r
+ <xsl:with-param name="contents">\r
+ <xsl:apply-templates select="$component" mode="schemaComponent"/>\r
+ </xsl:with-param>\r
+ <xsl:with-param name="isOpened">false</xsl:with-param>\r
+ </xsl:call-template>\r
+ </xsl:template>\r
+\r
+ <!--\r
+ Prints out schema component representation of \r
+ declarations.\r
+ Param(s):\r
+ margin (nonNegativeInteger) optional\r
+ Number of 'em' to indent from left\r
+ -->\r
+ <xsl:template match="xsd:attribute[@name] | xsd:element[@name]" mode="schemaComponent">\r
+ <xsl:param name="margin">0</xsl:param>\r
+\r
+ <xsl:call-template name="DisplaySchemaComponent">\r
+ <xsl:with-param name="component" select="."/>\r
+ <xsl:with-param name="margin" select="$margin"/>\r
+ <xsl:with-param name="attributes">\r
+ <!-- Attribute: name -->\r
+ <xsl:call-template name="DisplayAttr">\r
+ <xsl:with-param name="attrName">name</xsl:with-param>\r
+ <xsl:with-param name="attrValue" select="normalize-space(@name)"/>\r
+ </xsl:call-template>\r
+ <!-- Attribute: type -->\r
+ <xsl:if test="@type">\r
+ <xsl:call-template name="DisplayAttr">\r
+ <xsl:with-param name="attrName">type</xsl:with-param>\r
+ <xsl:with-param name="attrValue">\r
+ <xsl:call-template name="PrintTypeRef">\r
+ <xsl:with-param name="ref" select="normalize-space(@type)"/>\r
+ </xsl:call-template>\r
+ </xsl:with-param>\r
+ </xsl:call-template>\r
+ </xsl:if>\r
+ <!-- Other attributes -->\r
+ <xsl:call-template name="DisplayOtherAttributes">\r
+ <xsl:with-param name="component" select="."/>\r
+ <xsl:with-param name="attrsNotToDisplay">*name+*type+</xsl:with-param>\r
+ </xsl:call-template>\r
+ </xsl:with-param>\r
+ <xsl:with-param name="excludeFilter">*annotation+</xsl:with-param>\r
+ </xsl:call-template>\r
+ </xsl:template>\r
+\r
+ <!--\r
+ Prints out schema component representation of \r
+ definitions and key/uniqueness constraints.\r
+ Param(s):\r
+ margin (nonNegativeInteger) optional\r
+ Number of 'em' to indent from left\r
+ -->\r
+ <xsl:template match="xsd:attributeGroup[@name] | xsd:complexType[@name] | xsd:simpleType[@name] | xsd:group[@name] | xsd:key | xsd:unique" mode="schemaComponent">\r
+ <xsl:param name="margin">0</xsl:param>\r
+\r
+ <xsl:call-template name="DisplaySchemaComponent">\r
+ <xsl:with-param name="component" select="."/>\r
+ <xsl:with-param name="margin" select="$margin"/>\r
+ <xsl:with-param name="attributes">\r
+ <!-- Attribute: name -->\r
+ <xsl:call-template name="DisplayAttr">\r
+ <xsl:with-param name="attrName">name</xsl:with-param>\r
+ <xsl:with-param name="attrValue" select="normalize-space(@name)"/>\r
+ </xsl:call-template>\r
+ <!-- Other attributes -->\r
+ <xsl:call-template name="DisplayOtherAttributes">\r
+ <xsl:with-param name="component" select="."/>\r
+ <xsl:with-param name="attrsNotToDisplay">*name+</xsl:with-param>\r
+ </xsl:call-template>\r
+ </xsl:with-param>\r
+ <xsl:with-param name="excludeFilter">*annotation+</xsl:with-param>\r
+ </xsl:call-template>\r
+ </xsl:template>\r
+\r
+ <!--\r
+ Prints out schema component representation of attribute\r
+ references.\r
+ Param(s):\r
+ margin (nonNegativeInteger) optional\r
+ Number of 'em' to indent from left\r
+ -->\r
+ <xsl:template match="xsd:attribute[@ref]" mode="schemaComponent">\r
+ <xsl:param name="margin">0</xsl:param>\r
+\r
+ <xsl:call-template name="DisplaySchemaComponent">\r
+ <xsl:with-param name="component" select="."/>\r
+ <xsl:with-param name="margin" select="$margin"/>\r
+ <xsl:with-param name="attributes">\r
+ <!-- Attribute: ref -->\r
+ <xsl:call-template name="DisplayAttr">\r
+ <xsl:with-param name="attrName">ref</xsl:with-param>\r
+ <xsl:with-param name="attrValue">\r
+ <xsl:call-template name="PrintAttributeRef">\r
+ <xsl:with-param name="ref" select="normalize-space(@ref)"/>\r
+ </xsl:call-template>\r
+ </xsl:with-param>\r
+ </xsl:call-template>\r
+ <!-- Other attributes -->\r
+ <xsl:call-template name="DisplayOtherAttributes">\r
+ <xsl:with-param name="component" select="."/>\r
+ <xsl:with-param name="attrsNotToDisplay">*ref+</xsl:with-param>\r
+ </xsl:call-template>\r
+ </xsl:with-param>\r
+ <xsl:with-param name="excludeFilter">*annotation+</xsl:with-param>\r
+ </xsl:call-template>\r
+ </xsl:template>\r
+\r
+ <!--\r
+ Prints out schema component representation of attribute group\r
+ references.\r
+ Param(s):\r
+ margin (nonNegativeInteger) optional\r
+ Number of 'em' to indent from left\r
+ -->\r
+ <xsl:template match="xsd:attributeGroup[@ref]" mode="schemaComponent">\r
+ <xsl:param name="margin">0</xsl:param>\r
+\r
+ <xsl:call-template name="DisplaySchemaComponent">\r
+ <xsl:with-param name="component" select="."/>\r
+ <xsl:with-param name="margin" select="$margin"/>\r
+ <xsl:with-param name="attributes">\r
+ <!-- Attribute: ref -->\r
+ <xsl:call-template name="DisplayAttr">\r
+ <xsl:with-param name="attrName">ref</xsl:with-param>\r
+ <xsl:with-param name="attrValue">\r
+ <xsl:call-template name="PrintAttributeGroupRef">\r
+ <xsl:with-param name="ref" select="normalize-space(@ref)"/>\r
+ </xsl:call-template>\r
+ </xsl:with-param>\r
+ </xsl:call-template>\r
+ <!-- Other attributes -->\r
+ <xsl:call-template name="DisplayOtherAttributes">\r
+ <xsl:with-param name="component" select="."/>\r
+ <xsl:with-param name="attrsNotToDisplay">*ref+</xsl:with-param>\r
+ </xsl:call-template>\r
+ </xsl:with-param>\r
+ <xsl:with-param name="excludeFilter">*annotation+</xsl:with-param>\r
+ </xsl:call-template>\r
+ </xsl:template>\r
+\r
+ <!--\r
+ Prints out schema component representation of element \r
+ references.\r
+ Param(s):\r
+ margin (nonNegativeInteger) optional\r
+ Number of 'em' to indent from left\r
+ -->\r
+ <xsl:template match="xsd:element[@ref]" mode="schemaComponent">\r
+ <xsl:param name="margin">0</xsl:param>\r
+\r
+ <xsl:call-template name="DisplaySchemaComponent">\r
+ <xsl:with-param name="component" select="."/>\r
+ <xsl:with-param name="margin" select="$margin"/>\r
+ <xsl:with-param name="attributes">\r
+ <!-- Attribute: ref -->\r
+ <xsl:call-template name="DisplayAttr">\r
+ <xsl:with-param name="attrName">ref</xsl:with-param>\r
+ <xsl:with-param name="attrValue">\r
+ <xsl:call-template name="PrintElementRef">\r
+ <xsl:with-param name="ref" select="normalize-space(@ref)"/>\r
+ </xsl:call-template>\r
+ </xsl:with-param>\r
+ </xsl:call-template>\r
+ <!-- Other attributes -->\r
+ <xsl:call-template name="DisplayOtherAttributes">\r
+ <xsl:with-param name="component" select="."/>\r
+ <xsl:with-param name="attrsNotToDisplay">*ref+</xsl:with-param>\r
+ </xsl:call-template>\r
+ </xsl:with-param>\r
+ <xsl:with-param name="excludeFilter">*annotation+</xsl:with-param>\r
+ </xsl:call-template>\r
+ </xsl:template>\r
+\r
+ <!--\r
+ Prints out schema component representation of model group\r
+ references.\r
+ Param(s):\r
+ margin (nonNegativeInteger) optional\r
+ Number of 'em' to indent from left\r
+ -->\r
+ <xsl:template match="xsd:group[@ref]" mode="schemaComponent">\r
+ <xsl:param name="margin">0</xsl:param>\r
+\r
+ <xsl:call-template name="DisplaySchemaComponent">\r
+ <xsl:with-param name="component" select="."/>\r
+ <xsl:with-param name="margin" select="$margin"/>\r
+ <xsl:with-param name="attributes">\r
+ <!-- Attribute: ref -->\r
+ <xsl:call-template name="DisplayAttr">\r
+ <xsl:with-param name="attrName">ref</xsl:with-param>\r
+ <xsl:with-param name="attrValue">\r
+ <xsl:call-template name="PrintGroupRef">\r
+ <xsl:with-param name="ref" select="normalize-space(@ref)"/>\r
+ </xsl:call-template>\r
+ </xsl:with-param>\r
+ </xsl:call-template>\r
+ <!-- Other attributes -->\r
+ <xsl:call-template name="DisplayOtherAttributes">\r
+ <xsl:with-param name="component" select="."/>\r
+ <xsl:with-param name="attrsNotToDisplay">*ref+</xsl:with-param>\r
+ </xsl:call-template>\r
+ </xsl:with-param>\r
+ <xsl:with-param name="excludeFilter">*annotation+</xsl:with-param>\r
+ </xsl:call-template>\r
+ </xsl:template>\r
+\r
+ <!--\r
+ Prints out schema component representation of \r
+ 'appinfo' and 'documentation' elements.\r
+ Param(s):\r
+ margin (nonNegativeInteger) optional\r
+ Number of 'em' to indent from left\r
+ -->\r
+ <xsl:template match="xsd:appinfo | xsd:documentation" mode="schemaComponent">\r
+ <xsl:param name="margin">0</xsl:param>\r
+\r
+ <xsl:call-template name="DisplaySchemaComponent">\r
+ <xsl:with-param name="component" select="."/>\r
+ <xsl:with-param name="margin" select="$margin"/>\r
+ <xsl:with-param name="attributes">\r
+ <!-- Attribute: source -->\r
+ <xsl:if test="@source">\r
+ <xsl:call-template name="DisplayAttr">\r
+ <xsl:with-param name="attrName">source</xsl:with-param>\r
+ <xsl:with-param name="attrValue">\r
+ <xsl:call-template name="PrintURI">\r
+ <xsl:with-param name="uri" select="normalize-space(@source)"/>\r
+ </xsl:call-template>\r
+ </xsl:with-param>\r
+ </xsl:call-template>\r
+ </xsl:if>\r
+ <!-- Other attributes -->\r
+ <xsl:call-template name="DisplayOtherAttributes">\r
+ <xsl:with-param name="component" select="."/>\r
+ <xsl:with-param name="attrsNotToDisplay">*source+</xsl:with-param>\r
+ </xsl:call-template>\r
+ </xsl:with-param>\r
+ <xsl:with-param name="hasAnyContent">true</xsl:with-param>\r
+ </xsl:call-template>\r
+ </xsl:template>\r
+\r
+ <!--\r
+ Prints out schema component representation of \r
+ key reference constraints.\r
+ Param(s):\r
+ margin (nonNegativeInteger) optional\r
+ Number of 'em' to indent from left\r
+ -->\r
+ <xsl:template match="xsd:keyref" mode="schemaComponent">\r
+ <xsl:param name="margin">0</xsl:param>\r
+\r
+ <xsl:call-template name="DisplaySchemaComponent">\r
+ <xsl:with-param name="component" select="."/>\r
+ <xsl:with-param name="margin" select="$margin"/>\r
+ <xsl:with-param name="attributes">\r
+ <!-- Attribute: name -->\r
+ <xsl:call-template name="DisplayAttr">\r
+ <xsl:with-param name="attrName">name</xsl:with-param>\r
+ <xsl:with-param name="attrValue" select="normalize-space(@name)"/>\r
+ </xsl:call-template>\r
+ <!-- Attribute: refers -->\r
+ <xsl:call-template name="DisplayAttr">\r
+ <xsl:with-param name="attrName">refer</xsl:with-param>\r
+ <xsl:with-param name="attrValue">\r
+ <xsl:call-template name="PrintKeyRef">\r
+ <xsl:with-param name="ref">\r
+ <xsl:value-of select="normalize-space(@refer)"/>\r
+ </xsl:with-param>\r
+ </xsl:call-template>\r
+ </xsl:with-param>\r
+ </xsl:call-template>\r
+ <!-- Other attributes -->\r
+ <xsl:call-template name="DisplayOtherAttributes">\r
+ <xsl:with-param name="component" select="."/>\r
+ <xsl:with-param name="attrsNotToDisplay">*name+*refer+</xsl:with-param>\r
+ </xsl:call-template>\r
+ </xsl:with-param>\r
+ <xsl:with-param name="excludeFilter">*annotation+</xsl:with-param>\r
+ </xsl:call-template>\r
+ </xsl:template>\r
+\r
+ <!--\r
+ Prints out schema component representation of \r
+ derivations by extension and restrictions.\r
+ Param(s):\r
+ margin (nonNegativeInteger) optional\r
+ Number of 'em' to indent from left\r
+ -->\r
+ <xsl:template match="xsd:extension | xsd:restriction" mode="schemaComponent">\r
+ <xsl:param name="margin">0</xsl:param>\r
+\r
+ <xsl:call-template name="DisplaySchemaComponent">\r
+ <xsl:with-param name="component" select="."/>\r
+ <xsl:with-param name="margin" select="$margin"/>\r
+ <xsl:with-param name="attributes">\r
+ <!-- Attribute: base -->\r
+ <xsl:if test="@base">\r
+ <xsl:call-template name="DisplayAttr">\r
+ <xsl:with-param name="attrName">base</xsl:with-param>\r
+ <xsl:with-param name="attrValue">\r
+ <xsl:call-template name="PrintTypeRef">\r
+ <xsl:with-param name="ref" select="normalize-space(@base)"/>\r
+ </xsl:call-template>\r
+ </xsl:with-param>\r
+ </xsl:call-template>\r
+ </xsl:if>\r
+ <!-- Other attributes -->\r
+ <xsl:call-template name="DisplayOtherAttributes">\r
+ <xsl:with-param name="component" select="."/>\r
+ <xsl:with-param name="attrsNotToDisplay">*base+</xsl:with-param>\r
+ </xsl:call-template>\r
+ </xsl:with-param>\r
+ <xsl:with-param name="excludeFilter">*annotation+</xsl:with-param>\r
+ </xsl:call-template>\r
+ </xsl:template>\r
+\r
+ <!--\r
+ Prints out schema component representation of \r
+ derivations by list.\r
+ Param(s):\r
+ margin (nonNegativeInteger) optional\r
+ Number of 'em' to indent from left\r
+ -->\r
+ <xsl:template match="xsd:list" mode="schemaComponent">\r
+ <xsl:param name="margin">0</xsl:param>\r
+\r
+ <xsl:call-template name="DisplaySchemaComponent">\r
+ <xsl:with-param name="component" select="."/>\r
+ <xsl:with-param name="margin" select="$margin"/>\r
+ <xsl:with-param name="attributes">\r
+ <!-- Attribute: itemType-->\r
+ <xsl:if test="@itemType">\r
+ <xsl:call-template name="DisplayAttr">\r
+ <xsl:with-param name="attrName">itemType</xsl:with-param>\r
+ <xsl:with-param name="attrValue">\r
+ <xsl:call-template name="PrintTypeRef">\r
+ <xsl:with-param name="ref" select="normalize-space(@itemType)"/>\r
+ </xsl:call-template>\r
+ </xsl:with-param>\r
+ </xsl:call-template>\r
+ </xsl:if>\r
+ <!-- Other attributes -->\r
+ <xsl:call-template name="DisplayOtherAttributes">\r
+ <xsl:with-param name="component" select="."/>\r
+ <xsl:with-param name="attrsNotToDisplay">*itemType+</xsl:with-param>\r
+ </xsl:call-template>\r
+ </xsl:with-param>\r
+ <xsl:with-param name="excludeFilter">*annotation+</xsl:with-param>\r
+ </xsl:call-template>\r
+ </xsl:template>\r
+\r
+ <!--\r
+ Prints out schema component representation of \r
+ derivations by union.\r
+ Param(s):\r
+ margin (nonNegativeInteger) optional\r
+ Number of 'em' to indent from left\r
+ -->\r
+ <xsl:template match="xsd:union" mode="schemaComponent">\r
+ <xsl:param name="margin">0</xsl:param>\r
+\r
+ <xsl:call-template name="DisplaySchemaComponent">\r
+ <xsl:with-param name="component" select="."/>\r
+ <xsl:with-param name="margin" select="$margin"/>\r
+ <xsl:with-param name="attributes">\r
+ <!-- Attribute: memberTypes-->\r
+ <xsl:if test="@memberTypes">\r
+ <xsl:call-template name="DisplayAttr">\r
+ <xsl:with-param name="attrName">memberTypes</xsl:with-param>\r
+ <xsl:with-param name="attrValue">\r
+ <xsl:call-template name="PrintWhitespaceList">\r
+ <xsl:with-param name="value" select="normalize-space(@memberTypes)"/>\r
+ <xsl:with-param name="compType">type</xsl:with-param>\r
+ </xsl:call-template>\r
+ </xsl:with-param>\r
+ </xsl:call-template>\r
+ </xsl:if>\r
+ <!-- Other attributes -->\r
+ <xsl:call-template name="DisplayOtherAttributes">\r
+ <xsl:with-param name="component" select="."/>\r
+ <xsl:with-param name="attrsNotToDisplay">*memberTypes+</xsl:with-param>\r
+ </xsl:call-template>\r
+ </xsl:with-param>\r
+ <xsl:with-param name="excludeFilter">*annotation+</xsl:with-param>\r
+ </xsl:call-template>\r
+ </xsl:template>\r
+\r
+ <!--\r
+ Prints out schema component representation of \r
+ the root schema element.\r
+ Param(s):\r
+ margin (nonNegativeInteger) optional\r
+ Number of 'em' to indent from left\r
+ -->\r
+ <xsl:template match="xsd:schema" mode="schemaComponent">\r
+ <xsl:param name="margin">0</xsl:param>\r
+\r
+ <xsl:call-template name="DisplaySchemaComponent">\r
+ <xsl:with-param name="component" select="."/>\r
+ <xsl:with-param name="margin" select="$margin"/>\r
+ <xsl:with-param name="attributes">\r
+ <!-- Attribute: source -->\r
+ <xsl:if test="@xml:lang">\r
+ <xsl:call-template name="DisplayAttr">\r
+ <xsl:with-param name="attrName">xml:lang</xsl:with-param>\r
+ <xsl:with-param name="attrValue" select="normalize-space(@xml:lang)"/>\r
+ </xsl:call-template>\r
+ </xsl:if>\r
+ <!-- Other attributes -->\r
+ <xsl:call-template name="DisplayOtherAttributes">\r
+ <xsl:with-param name="component" select="."/>\r
+ <xsl:with-param name="attrsNotToDisplay">*lang+</xsl:with-param>\r
+ </xsl:call-template>\r
+ </xsl:with-param>\r
+ <xsl:with-param name="includeFilter">*include+*import+*redefine+</xsl:with-param>\r
+ </xsl:call-template>\r
+ </xsl:template>\r
+\r
+ <!--\r
+ Default way to print out schema component representation.\r
+ Param(s):\r
+ margin (nonNegativeInteger) optional\r
+ Number of 'em' to indent from left\r
+ -->\r
+ <xsl:template match="*" mode="schemaComponent">\r
+ <xsl:param name="margin">0</xsl:param>\r
+\r
+ <xsl:call-template name="DisplaySchemaComponent">\r
+ <xsl:with-param name="component" select="."/>\r
+ <xsl:with-param name="margin" select="$margin"/>\r
+ <xsl:with-param name="attributes">\r
+ <xsl:call-template name="DisplayOtherAttributes">\r
+ <xsl:with-param name="component" select="."/>\r
+ </xsl:call-template>\r
+ </xsl:with-param>\r
+ <xsl:with-param name="excludeFilter">*annotation+</xsl:with-param>\r
+ </xsl:call-template>\r
+ </xsl:template>\r
+\r
+ <!--\r
+ Prints out comments in schema component representation.\r
+ Param(s):\r
+ margin (nonNegativeInteger) optional\r
+ Number of 'em' to indent from left\r
+ -->\r
+ <xsl:template match="comment()" mode="schemaComponent">\r
+ <xsl:param name="margin">0</xsl:param>\r
+\r
+ <div class="comment" style="margin-left: {$margin}em">\r
+ <xsl:text><--</xsl:text>\r
+ <xsl:value-of select="."/>\r
+ <xsl:text>--></xsl:text>\r
+ </div>\r
+ </xsl:template>\r
+\r
+ <!--\r
+ Displays a schema element in the correct format\r
+ for the Schema Component Representation table, e.g.\r
+ tags are one color, and content are another.\r
+ Param(s):\r
+ component (Node) required\r
+ Schema element to be displayed\r
+ attributes (Result Tree Fragment) optional\r
+ Pre-formatted attributes of schema element\r
+ margin (nonNegativeInteger) optional\r
+ Number of 'em' to indent from left\r
+ hasAnyContent (boolean) optional\r
+ Set to true if schema element can accept \r
+ child elements from namespaces other than\r
+ the schema namespace, e.g. 'documentation'\r
+ and 'appinfo'\r
+ includeFilter (String) optional\r
+ List of element names, sandwiched between the\r
+ characters, '*' and '+'. If specified, only the\r
+ child elements of the component with tags in \r
+ the list will be displayed.\r
+ excludeFilter (String) optional\r
+ List of element names, sandwiched between the\r
+ characters, '*' and '+'. If specified, display\r
+ all child elements of the component, except\r
+ those with tags in the list.\r
+ -->\r
+ <xsl:template name="DisplaySchemaComponent">\r
+ <xsl:param name="component"/>\r
+ <xsl:param name="attributes"/>\r
+ <xsl:param name="margin">0</xsl:param>\r
+ <xsl:param name="hasAnyContent">false</xsl:param>\r
+ <xsl:param name="includeFilter"/>\r
+ <xsl:param name="excludeFilter"/>\r
+\r
+ <xsl:variable name="tag">\r
+ <xsl:call-template name="PrintNSPrefix">\r
+ <xsl:with-param name="prefix">\r
+ <xsl:call-template name="GetXSDPrefix"/>\r
+ </xsl:with-param>\r
+ <xsl:with-param name="nolink">true</xsl:with-param>\r
+ </xsl:call-template>\r
+ <xsl:value-of select="local-name($component)"/>\r
+ </xsl:variable>\r
+\r
+ <div style="margin-left: {$margin}em">\r
+ <!-- Start Tag -->\r
+ <xsl:text><</xsl:text>\r
+ <span class="scTag">\r
+ <xsl:copy-of select="$tag"/>\r
+ </span>\r
+ <!-- Attributes -->\r
+ <xsl:copy-of select="$attributes"/>\r
+ <!-- Content -->\r
+ <xsl:variable name="content">\r
+ <xsl:choose>\r
+ <!-- Include filter is on -->\r
+ <xsl:when test="$includeFilter!=''">\r
+ <xsl:apply-templates select="$component/xsd:*[contains($includeFilter, concat('*', local-name(.), '+'))]" mode="schemaComponent">\r
+ <xsl:with-param name="margin" select="$ELEM_INDENT"/>\r
+ </xsl:apply-templates>\r
+ <div class="scContent" style="margin-left: {$ELEM_INDENT}em">...</div>\r
+ </xsl:when>\r
+ <!-- Exclude filter is on -->\r
+ <xsl:when test="$excludeFilter!=''">\r
+ <xsl:apply-templates select="comment() | $component/xsd:*[not(contains($excludeFilter, concat('*', local-name(.), '+')))]" mode="schemaComponent">\r
+ <xsl:with-param name="margin" select="$ELEM_INDENT"/>\r
+ </xsl:apply-templates>\r
+ </xsl:when>\r
+ <!-- Permits any content -->\r
+ <xsl:when test="$hasAnyContent='true'">\r
+ <div class="scContent" style="margin-left: {$ELEM_INDENT}em">\r
+ <xsl:apply-templates select="comment() | $component/* | $component/text()" mode="xpp"/>\r
+ </div>\r
+ </xsl:when>\r
+ <!-- Contains schema elements -->\r
+ <xsl:otherwise>\r
+ <xsl:apply-templates select="comment() | $component/xsd:*" mode="schemaComponent">\r
+ <xsl:with-param name="margin" select="$ELEM_INDENT"/>\r
+ </xsl:apply-templates>\r
+ </xsl:otherwise>\r
+ </xsl:choose>\r
+ </xsl:variable>\r
+\r
+ <xsl:choose>\r
+ <!-- Has content -->\r
+ <xsl:when test="normalize-space($content)!=''">\r
+ <!-- End of start tag -->\r
+ <xsl:text>></xsl:text>\r
+\r
+ <!-- Content -->\r
+ <xsl:copy-of select="$content"/>\r
+\r
+ <!-- End Tag -->\r
+ <xsl:text></</xsl:text>\r
+ <span class="scTag">\r
+ <xsl:copy-of select="$tag"/>\r
+ </span>\r
+ <xsl:text>></xsl:text>\r
+ </xsl:when>\r
+ <!-- Empty content -->\r
+ <xsl:otherwise>\r
+ <!-- End of start tag -->\r
+ <xsl:text>/></xsl:text>\r
+ </xsl:otherwise>\r
+ </xsl:choose>\r
+ </div>\r
+ </xsl:template>\r
+\r
+ <!--\r
+ Displays a schema attribute in the correct format\r
+ for the Schema Component Representation table, e.g.\r
+ tags are one color, and content are another.\r
+ Param(s):\r
+ attrName (String) required\r
+ Name of attribute\r
+ attrValue (Result Tree Fragment) required\r
+ Value of attribute, which may be links\r
+ -->\r
+ <xsl:template name="DisplayAttr">\r
+ <xsl:param name="attrName"/>\r
+ <xsl:param name="attrValue"/>\r
+\r
+ <xsl:text> </xsl:text>\r
+ <span class="scTag">\r
+ <xsl:value-of select="$attrName"/>\r
+ </span>\r
+ <xsl:text>="</xsl:text>\r
+ <xsl:if test="normalize-space($attrValue)!=''">\r
+ <span class="scContent">\r
+ <xsl:copy-of select="$attrValue"/>\r
+ </span>\r
+ </xsl:if>\r
+ <xsl:text>"</xsl:text>\r
+ </xsl:template>\r
+\r
+ <!--\r
+ Displays attributes from a schema element, unless\r
+ otherwise specified, in the correct format\r
+ for the Schema Component Representation table, e.g.\r
+ tags are one color, and content are another.\r
+ Param(s):\r
+ component (Node) required\r
+ Schema element whose attributes are to be displayed\r
+ attrsNotToDisplay (String) required\r
+ List of attributes not to be displayed\r
+ Each attribute name should prepended with '*'\r
+ and appended with '+'\r
+ -->\r
+ <xsl:template name="DisplayOtherAttributes">\r
+ <xsl:param name="component"/>\r
+ <xsl:param name="attrsNotToDisplay"/>\r
+\r
+ <xsl:for-each select="$component/attribute::*">\r
+ <xsl:variable name="attrName" select="local-name(.)"/>\r
+ <xsl:if test="not(contains($attrsNotToDisplay, concat('*', $attrName, '+')))">\r
+ <xsl:call-template name="DisplayAttr">\r
+ <xsl:with-param name="attrName" select="normalize-space($attrName)"/>\r
+ <xsl:with-param name="attrValue" select="normalize-space(.)"/>\r
+ </xsl:call-template>\r
+ </xsl:if>\r
+ </xsl:for-each>\r
+ </xsl:template>\r
+\r
+\r
+ <!-- ******** XML Pretty Printer ******** -->\r
+\r
+ <!--\r
+ Puts XHTML elements into the result.\r
+ -->\r
+ <xsl:template match="html:*" mode="html">\r
+ <xsl:element name="{local-name(.)}">\r
+ <xsl:for-each select="@*">\r
+ <xsl:copy-of select="."/>\r
+ </xsl:for-each>\r
+ <xsl:apply-templates select="* | text()" mode="html"/>\r
+ </xsl:element>\r
+ </xsl:template>\r
+\r
+ <!--\r
+ Displays non-XHTML elements found within XHTML elements.\r
+ -->\r
+ <xsl:template match="*" mode="html">\r
+ <xsl:call-template name="WriteElement">\r
+ <xsl:with-param name="element" select="."/>\r
+ <xsl:with-param name="mode">html</xsl:with-param>\r
+ </xsl:call-template>\r
+ </xsl:template>\r
+\r
+ <!--\r
+ Displays text node.\r
+ -->\r
+ <xsl:template match="text()" mode="html">\r
+ <xsl:value-of select="."/>\r
+ </xsl:template>\r
+\r
+ <!--\r
+ Displays an arbitrary XML element.\r
+ -->\r
+ <xsl:template match="*" mode="xpp">\r
+ <code>\r
+ <xsl:call-template name="WriteElement">\r
+ <xsl:with-param name="element" select="."/>\r
+ <xsl:with-param name="mode">xpp</xsl:with-param>\r
+ </xsl:call-template>\r
+ </code>\r
+ </xsl:template>\r
+\r
+ <!--\r
+ Displays an arbitrary XML text node.\r
+ -->\r
+ <xsl:template match="text()" mode="xpp">\r
+ <xsl:value-of select="."/>\r
+ </xsl:template>\r
+\r
+ <!--\r
+ Displays an XML comment.\r
+ -->\r
+ <xsl:template match="comment()" mode="xpp">\r
+ <div class="comment">\r
+ <xsl:text><--</xsl:text>\r
+ <xsl:value-of select="."/>\r
+ <xsl:text>--></xsl:text>\r
+ </div>\r
+ </xsl:template>\r
+\r
+ <!--\r
+ Displays an XML element in the documentation, e.g.\r
+ tags are escaped.\r
+ Param(s):\r
+ element (Node) required\r
+ XML element to display\r
+ mode (xpp|html) required\r
+ Which mode to invoke for child elements\r
+ -->\r
+ <xsl:template name="WriteElement">\r
+ <xsl:param name="element"/>\r
+ <xsl:param name="mode">xpp</xsl:param>\r
+\r
+ <!-- Start Tag -->\r
+ <xsl:text><</xsl:text>\r
+ <xsl:call-template name="PrintNSPrefix">\r
+ <xsl:with-param name="prefix">\r
+ <xsl:call-template name="GetRefPrefix">\r
+ <xsl:with-param name="ref" select="name($element)"/>\r
+ </xsl:call-template>\r
+ </xsl:with-param>\r
+ </xsl:call-template>\r
+ <xsl:value-of select="local-name($element)"/>\r
+ <!-- Attributes -->\r
+ <xsl:for-each select="$element/@*">\r
+ <xsl:text> </xsl:text>\r
+ <xsl:value-of select="name(.)"/>\r
+ <xsl:text>="</xsl:text>\r
+ <xsl:value-of select="."/>\r
+ <xsl:text>"</xsl:text>\r
+ </xsl:for-each>\r
+\r
+ <xsl:choose>\r
+ <xsl:when test="$element/* | $element/text()">\r
+ <!-- Close Start Tag -->\r
+ <xsl:text>> </xsl:text>\r
+ <!-- Content -->\r
+ <xsl:choose>\r
+ <xsl:when test="$mode!='xpp'">\r
+ <xsl:apply-templates select="$element/* | $element/text()" mode="html"/>\r
+ </xsl:when>\r
+ <xsl:otherwise>\r
+ <div style="margin-left: {$ELEM_INDENT}em">\r
+ <xsl:apply-templates select="$element/* | $element/text()" mode="xpp"/>\r
+ </div>\r
+ </xsl:otherwise>\r
+ </xsl:choose>\r
+ <!-- End Tag -->\r
+ <xsl:text></</xsl:text>\r
+ <xsl:call-template name="PrintNSPrefix">\r
+ <xsl:with-param name="prefix">\r
+ <xsl:call-template name="GetRefPrefix">\r
+ <xsl:with-param name="ref" select="name($element)"/>\r
+ </xsl:call-template>\r
+ </xsl:with-param>\r
+ </xsl:call-template>\r
+ <xsl:value-of select="local-name($element)"/>\r
+ <xsl:text>></xsl:text>\r
+ </xsl:when>\r
+ <xsl:otherwise>\r
+ <!-- Close Start Tag -->\r
+ <xsl:text>/></xsl:text>\r
+ </xsl:otherwise>\r
+ </xsl:choose>\r
+ </xsl:template>\r
+\r
+\r
+ <!-- ******** Templates for Handling References ******** -->\r
+\r
+ <!--\r
+ Prints out a reference to a term in the glossary section.\r
+ Param(s):\r
+ code (String) required\r
+ Unique ID of glossary term\r
+ term (String) optional\r
+ Glossary term\r
+ -->\r
+ <xsl:template name="PrintGlossaryTermRef">\r
+ <xsl:param name="code"/>\r
+ <xsl:param name="term"/>\r
+\r
+ <xsl:choose>\r
+ <xsl:when test="$code !='' and normalize-space(translate($printGlossary,'TRUE','true'))='true'">\r
+ <a title="Look up '{$term}' in glossary" href="#{concat($TERM_PREFIX, $code)}">\r
+ <xsl:choose>\r
+ <xsl:when test="$term!=''">\r
+ <xsl:value-of select="$term"/>\r
+ </xsl:when>\r
+ <xsl:otherwise>\r
+ <xsl:text>[term]</xsl:text>\r
+ </xsl:otherwise>\r
+ </xsl:choose>\r
+ </a>\r
+ </xsl:when>\r
+ <xsl:otherwise>\r
+ <xsl:value-of select="$term"/>\r
+ </xsl:otherwise>\r
+ </xsl:choose>\r
+ </xsl:template>\r
+\r
+ <!--\r
+ Prints out a reference to a namespace in the schema.\r
+ Param(s):\r
+ prefix (String) required\r
+ Namespace prefix referenced\r
+ schemaLoc (String) optional\r
+ Schema file containing this namespace prefix;\r
+ if in current schema, 'schemaLoc' is set to 'this'\r
+ -->\r
+ <xsl:template name="PrintNamespaceRef">\r
+ <xsl:param name="prefix"/>\r
+ <xsl:param name="schemaLoc">this</xsl:param>\r
+\r
+ <xsl:if test="$prefix!=''">\r
+ <xsl:choose>\r
+ <xsl:when test="/xsd:schema/namespace::*[local-name(.)=normalize-space($prefix)]">\r
+ <xsl:variable name="link">\r
+ <xsl:if test="normalize-space($schemaLoc)!='this'">\r
+ <xsl:call-template name="GetSchemaDocLocation">\r
+ <xsl:with-param name="uri" select="$schemaLoc"/>\r
+ </xsl:call-template>\r
+ </xsl:if>\r
+ <xsl:value-of select="concat('#', $NS_PREFIX, $prefix)"/>\r
+ </xsl:variable>\r
+ <a href="{$link}" title="Find out namespace of '{$prefix}' prefix">\r
+ <xsl:value-of select="$prefix"/>\r
+ </a>\r
+ </xsl:when>\r
+ <xsl:otherwise>\r
+ <xsl:variable name="title">\r
+ <xsl:text>Unknown namespace prefix, </xsl:text>\r
+ <xsl:value-of select="$prefix"/>\r
+ <xsl:text>.</xsl:text>\r
+ </xsl:variable>\r
+ <a href="javascript:void(0)" onclick="alert('{$title}')" title="{$title}">\r
+ <xsl:value-of select="$prefix"/>\r
+ </a>\r
+ </xsl:otherwise>\r
+ </xsl:choose>\r
+ </xsl:if>\r
+ </xsl:template>\r
+\r
+ <!--\r
+ Generates a link to an attribute.\r
+ Param(s):\r
+ name (String) optional\r
+ Name of attribute\r
+ ref (String) optional\r
+ Reference to attribute\r
+ (One of 'name' and 'ref' must be provided.)\r
+ schemaLoc (String) optional\r
+ Schema file containing this attribute reference\r
+ if in current schema, 'schemaLoc' is set to 'this'\r
+ -->\r
+ <xsl:template name="PrintAttributeRef">\r
+ <xsl:param name="name"/>\r
+ <xsl:param name="ref"/>\r
+ <xsl:param name="schemaLoc">this</xsl:param>\r
+\r
+ <xsl:choose>\r
+ <xsl:when test="$name!=''">\r
+ <xsl:call-template name="PrintCompName">\r
+ <xsl:with-param name="name" select="$name"/>\r
+ <xsl:with-param name="compType">attribute</xsl:with-param>\r
+ <xsl:with-param name="schemaLoc" select="$schemaLoc"/>\r
+ </xsl:call-template>\r
+ </xsl:when>\r
+ <xsl:when test="$ref!=''">\r
+ <xsl:call-template name="PrintCompRef">\r
+ <xsl:with-param name="ref" select="$ref"/>\r
+ <xsl:with-param name="compType">attribute</xsl:with-param>\r
+ <xsl:with-param name="schemaLoc" select="$schemaLoc"/>\r
+ </xsl:call-template>\r
+ </xsl:when>\r
+ </xsl:choose>\r
+ </xsl:template>\r
+\r
+ <!--\r
+ Generates a link to an attribute group.\r
+ Param(s):\r
+ name (String) optional\r
+ Name of attribute group\r
+ ref (String) optional\r
+ Reference to attribute group\r
+ (One of 'name' and 'ref' must be provided.)\r
+ schemaLoc (String) optional\r
+ Schema file containing this attribute group reference\r
+ if in current schema, 'schemaLoc' is set to 'this'\r
+ -->\r
+ <xsl:template name="PrintAttributeGroupRef">\r
+ <xsl:param name="name"/>\r
+ <xsl:param name="ref"/>\r
+ <xsl:param name="schemaLoc">this</xsl:param>\r
+\r
+ <xsl:choose>\r
+ <xsl:when test="$name!=''">\r
+ <xsl:call-template name="PrintCompName">\r
+ <xsl:with-param name="name" select="$name"/>\r
+ <xsl:with-param name="compType">attribute group</xsl:with-param>\r
+ <xsl:with-param name="schemaLoc" select="$schemaLoc"/>\r
+ </xsl:call-template>\r
+ </xsl:when>\r
+ <xsl:when test="$ref!=''">\r
+ <xsl:call-template name="PrintCompRef">\r
+ <xsl:with-param name="ref" select="$ref"/>\r
+ <xsl:with-param name="compType">attribute group</xsl:with-param>\r
+ <xsl:with-param name="schemaLoc" select="$schemaLoc"/>\r
+ </xsl:call-template>\r
+ </xsl:when>\r
+ </xsl:choose>\r
+ </xsl:template>\r
+\r
+ <!--\r
+ Generates a link to an element.\r
+ Param(s):\r
+ name (String) optional\r
+ Name of element\r
+ ref (String) optional\r
+ Reference to element\r
+ (One of 'name' and 'ref' must be provided.)\r
+ schemaLoc (String) optional\r
+ Schema file containing this element reference\r
+ if in current schema, 'schemaLoc' is set to 'this'\r
+ -->\r
+ <xsl:template name="PrintElementRef">\r
+ <xsl:param name="name"/>\r
+ <xsl:param name="ref"/>\r
+ <xsl:param name="schemaLoc">this</xsl:param>\r
+\r
+ <xsl:choose>\r
+ <xsl:when test="$name!=''">\r
+ <xsl:call-template name="PrintCompName">\r
+ <xsl:with-param name="name" select="$name"/>\r
+ <xsl:with-param name="compType">element</xsl:with-param>\r
+ <xsl:with-param name="schemaLoc" select="$schemaLoc"/>\r
+ </xsl:call-template>\r
+ </xsl:when>\r
+ <xsl:when test="$ref!=''">\r
+ <xsl:call-template name="PrintCompRef">\r
+ <xsl:with-param name="ref" select="$ref"/>\r
+ <xsl:with-param name="compType">element</xsl:with-param>\r
+ <xsl:with-param name="schemaLoc" select="$schemaLoc"/>\r
+ </xsl:call-template>\r
+ </xsl:when>\r
+ </xsl:choose>\r
+ </xsl:template>\r
+\r
+ <!--\r
+ Generates a link to a group.\r
+ Param(s):\r
+ name (String) optional\r
+ Name of group\r
+ ref (String) optional\r
+ Reference to group\r
+ (One of 'name' and 'ref' must be provided.)\r
+ schemaLoc (String) optional\r
+ Schema file containing this group reference\r
+ if in current schema, 'schemaLoc' is set to 'this'\r
+ -->\r
+ <xsl:template name="PrintGroupRef">\r
+ <xsl:param name="name"/>\r
+ <xsl:param name="ref"/>\r
+ <xsl:param name="schemaLoc">this</xsl:param>\r
+\r
+ <xsl:choose>\r
+ <xsl:when test="$name!=''">\r
+ <xsl:call-template name="PrintCompName">\r
+ <xsl:with-param name="name" select="$name"/>\r
+ <xsl:with-param name="compType">group</xsl:with-param>\r
+ <xsl:with-param name="schemaLoc" select="$schemaLoc"/>\r
+ </xsl:call-template>\r
+ </xsl:when>\r
+ <xsl:when test="$ref!=''">\r
+ <xsl:call-template name="PrintCompRef">\r
+ <xsl:with-param name="ref" select="$ref"/>\r
+ <xsl:with-param name="compType">group</xsl:with-param>\r
+ <xsl:with-param name="schemaLoc" select="$schemaLoc"/>\r
+ </xsl:call-template>\r
+ </xsl:when>\r
+ </xsl:choose>\r
+ </xsl:template>\r
+\r
+ <!--\r
+ Generates a link to a key/uniqueness constraint.\r
+ Param(s):\r
+ name (String) optional\r
+ Name of key/uniqueness constraint\r
+ ref (String) optional\r
+ Reference to key/uniqueness constraint\r
+ (One of 'name' and 'ref' must be provided.)\r
+ schemaLoc (String) optional\r
+ Schema file containing this key/uniqueness constraint\r
+ reference; if in current schema, 'schemaLoc' is set \r
+ to 'this'\r
+ -->\r
+ <xsl:template name="PrintKeyRef">\r
+ <xsl:param name="name"/>\r
+ <xsl:param name="ref"/>\r
+ <xsl:param name="schemaLoc">this</xsl:param>\r
+\r
+ <xsl:choose>\r
+ <xsl:when test="$name!=''">\r
+ <xsl:call-template name="PrintCompName">\r
+ <xsl:with-param name="name" select="$name"/>\r
+ <xsl:with-param name="compType">uniqueness/key constraint</xsl:with-param>\r
+ <xsl:with-param name="schemaLoc" select="$schemaLoc"/>\r
+ </xsl:call-template>\r
+ </xsl:when>\r
+ <xsl:when test="$ref!=''">\r
+ <xsl:call-template name="PrintCompRef">\r
+ <xsl:with-param name="ref" select="$ref"/>\r
+ <xsl:with-param name="compType">uniqueness/key constraint</xsl:with-param>\r
+ <xsl:with-param name="schemaLoc" select="$schemaLoc"/>\r
+ </xsl:call-template>\r
+ </xsl:when>\r
+ </xsl:choose>\r
+ </xsl:template>\r
+\r
+ <!--\r
+ Generates a link to a type.\r
+ Param(s):\r
+ name (String) optional\r
+ Name of type\r
+ ref (String) optional\r
+ Reference to type\r
+ (One of 'name' and 'ref' must be provided.)\r
+ schemaLoc (String) optional\r
+ Schema file containing this type reference'\r
+ if in current schema, 'schemaLoc' is set \r
+ to 'this'\r
+ -->\r
+ <xsl:template name="PrintTypeRef">\r
+ <xsl:param name="name"/>\r
+ <xsl:param name="ref"/>\r
+ <xsl:param name="schemaLoc">this</xsl:param>\r
+\r
+ <xsl:choose>\r
+ <xsl:when test="$name!=''">\r
+ <span class="type">\r
+ <xsl:call-template name="PrintCompName">\r
+ <xsl:with-param name="name" select="$name"/>\r
+ <xsl:with-param name="compType">type</xsl:with-param>\r
+ <xsl:with-param name="schemaLoc" select="$schemaLoc"/>\r
+ </xsl:call-template>\r
+ </span>\r
+ </xsl:when>\r
+ <xsl:when test="$ref!=''">\r
+ <span class="type">\r
+ <xsl:call-template name="PrintCompRef">\r
+ <xsl:with-param name="ref" select="$ref"/>\r
+ <xsl:with-param name="compType">type</xsl:with-param>\r
+ <xsl:with-param name="schemaLoc" select="$schemaLoc"/>\r
+ </xsl:call-template>\r
+ </span>\r
+ </xsl:when>\r
+ </xsl:choose>\r
+ </xsl:template>\r
+\r
+ <!--\r
+ Prints out a link to a schema component's section.\r
+ Param(s):\r
+ baseFile (String) optional\r
+ Documentation file of schema containing this \r
+ component.\r
+ If this component belongs to the current schema, \r
+ omit this variable.\r
+ If this component is from an included or imported \r
+ schema, provide this variable.\r
+ name (String) required\r
+ Name of schema component\r
+ compType (String) required\r
+ Type of schema component\r
+ errMsg (String) optional\r
+ Sentence fragment.\r
+ If specified, link will open up an alert box with \r
+ an error message. For example, if 'errMsg' was set \r
+ to "could not be found", 'name' was "x", and\r
+ 'compType' was "type", the error message would be:\r
+ "x" type definition could not be found.\r
+ The sentence fragment should not:\r
+ -start with a capital letter.\r
+ -have a space in front\r
+ -end with a period.\r
+ schemaLoc (String) optional\r
+ Schema file containing this component;\r
+ if in current schema, 'schemaLoc' is set to 'this'\r
+ -->\r
+ <xsl:template name="PrintCompName">\r
+ <xsl:param name="baseFile"/>\r
+ <xsl:param name="name"/>\r
+ <xsl:param name="compType"/>\r
+ <xsl:param name="schemaLoc">this</xsl:param>\r
+ <xsl:param name="errMsg"/>\r
+\r
+ <!-- Get correct terminology for statements -->\r
+ <xsl:variable name="noun">\r
+ <xsl:choose>\r
+ <xsl:when test="$compType='element' or $compType='attribute'">\r
+ <xsl:text>declaration</xsl:text>\r
+ </xsl:when>\r
+ <xsl:otherwise>\r
+ <xsl:text>definition</xsl:text>\r
+ </xsl:otherwise>\r
+ </xsl:choose>\r
+ </xsl:variable>\r
+\r
+ <!-- Get prefix to use in anchor name. -->\r
+ <xsl:variable name="compPrefix">\r
+ <xsl:choose>\r
+ <xsl:when test="$compType='attribute'">\r
+ <xsl:value-of select="$ATTR_PREFIX"/>\r
+ </xsl:when>\r
+ <xsl:when test="$compType='attribute group'">\r
+ <xsl:value-of select="$ATTR_GRP_PREFIX"/>\r
+ </xsl:when>\r
+ <xsl:when test="$compType='element'">\r
+ <xsl:value-of select="$ELEM_PREFIX"/>\r
+ </xsl:when>\r
+ <xsl:when test="$compType='group'">\r
+ <xsl:value-of select="$GRP_PREFIX"/>\r
+ </xsl:when>\r
+ <xsl:when test="$compType='type'">\r
+ <xsl:value-of select="$TYPE_PREFIX"/>\r
+ </xsl:when>\r
+ <xsl:when test="$compType='uniqueness/key constraint'">\r
+ <xsl:value-of select="$KEY_PREFIX"/>\r
+ </xsl:when>\r
+ </xsl:choose>\r
+ </xsl:variable>\r
+\r
+ <!-- Get base URI. -->\r
+ <xsl:variable name="baseURI">\r
+ <xsl:choose>\r
+ <xsl:when test="$baseFile!=''">\r
+ <xsl:value-of select="$baseFile"/>\r
+ </xsl:when>\r
+ <xsl:when test="normalize-space($schemaLoc)!='this'">\r
+ <xsl:call-template name="GetSchemaDocLocation">\r
+ <xsl:with-param name="uri" select="$schemaLoc"/>\r
+ </xsl:call-template>\r
+ </xsl:when>\r
+ </xsl:choose>\r
+ </xsl:variable>\r
+\r
+ <!-- Generate message. -->\r
+ <xsl:variable name="title">\r
+ <xsl:choose>\r
+ <!-- Error message was provided. -->\r
+ <xsl:when test="$errMsg!=''">\r
+ <xsl:text>"</xsl:text><xsl:value-of select="$name"/><xsl:text>" </xsl:text>\r
+ <xsl:value-of select="$compType"/><xsl:text> </xsl:text>\r
+ <xsl:value-of select="$noun"/><xsl:text> </xsl:text>\r
+ <xsl:value-of select="$errMsg"/>\r
+ </xsl:when>\r
+ <!-- There exists a link to the schema component's\r
+ documentation. -->\r
+ <xsl:otherwise>\r
+ <xsl:text>Jump to "</xsl:text>\r
+ <xsl:value-of select="$name"/>\r
+ <xsl:text>" </xsl:text>\r
+ <xsl:value-of select="$compType"/>\r
+ <xsl:text> </xsl:text>\r
+ <xsl:value-of select="$noun"/>\r
+ <!-- External link -->\r
+ <xsl:if test="normalize-space($baseURI)!=''">\r
+ <xsl:text>(located in external schema documentation)</xsl:text>\r
+ </xsl:if>\r
+ </xsl:otherwise>\r
+ </xsl:choose>\r
+ <xsl:text>.</xsl:text>\r
+ </xsl:variable>\r
+\r
+ <!-- Generate href link -->\r
+ <xsl:variable name="link">\r
+ <xsl:choose>\r
+ <!-- Error message was provided. -->\r
+ <xsl:when test="$errMsg!=''">\r
+ <xsl:text>javascript:void(0)</xsl:text>\r
+ </xsl:when>\r
+ <!-- There exists a link to the schema component's\r
+ documentation. -->\r
+ <xsl:otherwise>\r
+ <!-- Base URI -->\r
+ <xsl:value-of select="normalize-space($baseURI)"/>\r
+ <!-- Anchor within URI -->\r
+ <xsl:value-of select="concat('#',normalize-space($compPrefix),normalize-space($name))"/>\r
+ </xsl:otherwise>\r
+ </xsl:choose>\r
+ </xsl:variable>\r
+\r
+ <a title="{$title}" href="{$link}">\r
+ <!-- External link -->\r
+ <xsl:if test="normalize-space($baseURI)!=''">\r
+ <xsl:attribute name="class">externalLink</xsl:attribute>\r
+ </xsl:if>\r
+\r
+ <!-- Error message was provided. -->\r
+ <xsl:if test="$errMsg!=''">\r
+ <xsl:attribute name="onclick">\r
+ <xsl:text>alert('</xsl:text>\r
+ <xsl:value-of select="$title"/>\r
+ <xsl:text>');</xsl:text>\r
+ </xsl:attribute>\r
+ </xsl:if>\r
+\r
+ <xsl:value-of select="$name"/>\r
+ </a>\r
+ </xsl:template>\r
+\r
+ <!--\r
+ Prints out a reference to a schema component.\r
+ This template will try to work out which schema that this\r
+ component belongs to and print out the appropriate link.\r
+ component.\r
+ It will also print out the namespace prefix given\r
+ in the reference.\r
+ Param(s):\r
+ ref (String) required\r
+ Reference to schema component\r
+ compType (String) required\r
+ Type of schema component\r
+ schemaLoc (String) optional\r
+ Schema file containing this component reference;\r
+ if in current schema, 'schemaLoc' is set to 'this'\r
+ -->\r
+ <xsl:template name="PrintCompRef">\r
+ <xsl:param name="ref"/>\r
+ <xsl:param name="compType"/>\r
+ <xsl:param name="schemaLoc">this</xsl:param>\r
+\r
+ <!-- Get correct terminology for statements -->\r
+ <xsl:variable name="noun">\r
+ <xsl:choose>\r
+ <xsl:when test="$compType='element' or $compType='attribute'">\r
+ <xsl:text>declaration</xsl:text>\r
+ </xsl:when>\r
+ <xsl:otherwise>\r
+ <xsl:text>definition</xsl:text>\r
+ </xsl:otherwise>\r
+ </xsl:choose>\r
+ </xsl:variable>\r
+\r
+ <!-- Get local name -->\r
+ <xsl:variable name="refName">\r
+ <xsl:call-template name="GetRefName">\r
+ <xsl:with-param name="ref" select="$ref"/>\r
+ </xsl:call-template>\r
+ </xsl:variable>\r
+\r
+ <!-- Get prefix -->\r
+ <xsl:variable name="refPrefix">\r
+ <xsl:call-template name="GetRefPrefix">\r
+ <xsl:with-param name="ref" select="$ref"/>\r
+ </xsl:call-template>\r
+ </xsl:variable>\r
+\r
+ <!-- Get prefix of this schema's target namespace -->\r
+ <xsl:variable name="tnPrefix">\r
+ <xsl:call-template name="GetThisPrefix"/>\r
+ </xsl:variable>\r
+\r
+ <!-- Get file location of the schema component that is\r
+ being referenced. -->\r
+ <xsl:variable name="compLoc">\r
+ <xsl:call-template name="FindComponent">\r
+ <xsl:with-param name="ref" select="$ref"/>\r
+ <xsl:with-param name="compType" select="$compType"/>\r
+ </xsl:call-template>\r
+ </xsl:variable>\r
+\r
+ <!-- Print prefix -->\r
+ <xsl:call-template name="PrintNSPrefix">\r
+ <xsl:with-param name="prefix" select="$refPrefix"/>\r
+ <xsl:with-param name="schemaLoc" select="$schemaLoc"/>\r
+ </xsl:call-template>\r
+\r
+ <!-- Print local name -->\r
+ <xsl:choose>\r
+ <!-- Component from XML Schema's or XML's namespace -->\r
+ <xsl:when test="normalize-space($compLoc)='xsd' or normalize-space($compLoc)='xml'">\r
+ <xsl:value-of select="$refName"/>\r
+ </xsl:when>\r
+ <!-- Component found in this schema. -->\r
+ <xsl:when test="normalize-space($compLoc)='this'">\r
+ <xsl:call-template name="PrintCompName">\r
+ <xsl:with-param name="name" select="$refName"/>\r
+ <xsl:with-param name="compType" select="$compType"/>\r
+ <xsl:with-param name="schemaLoc" select="$schemaLoc"/>\r
+ </xsl:call-template>\r
+ </xsl:when>\r
+ <!-- Component not found. -->\r
+ <xsl:when test="normalize-space($compLoc)='' or normalize-space($compLoc)='none'">\r
+ <xsl:call-template name="PrintCompName">\r
+ <xsl:with-param name="name" select="$refName"/>\r
+ <xsl:with-param name="compType" select="$compType"/>\r
+ <xsl:with-param name="errMsg">could not be found</xsl:with-param>\r
+ </xsl:call-template>\r
+ </xsl:when>\r
+ <!-- Component found in an external schema. -->\r
+ <xsl:otherwise>\r
+ <!-- Get documentation file for included schema. -->\r
+ <xsl:variable name="docFile">\r
+ <xsl:call-template name="GetSchemaDocLocation">\r
+ <xsl:with-param name="uri" select="$compLoc"/>\r
+ </xsl:call-template>\r
+ </xsl:variable>\r
+\r
+ <xsl:call-template name="PrintCompName">\r
+ <xsl:with-param name="baseFile" select="$docFile"/>\r
+ <xsl:with-param name="name" select="$refName"/>\r
+ <xsl:with-param name="compType" select="$compType"/>\r
+ <xsl:with-param name="schemaLoc" select="$schemaLoc"/>\r
+ </xsl:call-template>\r
+ </xsl:otherwise>\r
+ </xsl:choose>\r
+ </xsl:template>\r
+\r
+\r
+ <!-- ******** Templates for Finding Components in Different\r
+ Schema documents ******** -->\r
+\r
+ <!-- Special key words: xml, xsd, this, none -->\r
+ <xsl:template name="FindComponent">\r
+ <xsl:param name="ref"/>\r
+ <xsl:param name="compType"/>\r
+\r
+ <!-- Get local name -->\r
+ <xsl:variable name="refName">\r
+ <xsl:call-template name="GetRefName">\r
+ <xsl:with-param name="ref" select="$ref"/>\r
+ </xsl:call-template>\r
+ </xsl:variable>\r
+\r
+ <!-- Get prefix -->\r
+ <xsl:variable name="refPrefix">\r
+ <xsl:call-template name="GetRefPrefix">\r
+ <xsl:with-param name="ref" select="$ref"/>\r
+ </xsl:call-template>\r
+ </xsl:variable>\r
+\r
+ <!-- Get prefix of this schema's target namespace -->\r
+ <xsl:variable name="tnPrefix">\r
+ <xsl:call-template name="GetThisPrefix"/>\r
+ </xsl:variable>\r
+\r
+ <!-- Get prefix of XML Schema -->\r
+ <xsl:variable name="xsdPrefix">\r
+ <xsl:call-template name="GetXSDPrefix"/>\r
+ </xsl:variable>\r
+\r
+ <xsl:choose>\r
+ <!-- Schema component from XML Schema's namespace,\r
+ unless this schema is for XML Schema -->\r
+ <xsl:when test="$refPrefix=$xsdPrefix and $xsdPrefix!=$tnPrefix">\r
+ <xsl:text>xsd</xsl:text>\r
+ </xsl:when>\r
+ <!-- Schema component from XML's namespace -->\r
+ <xsl:when test="$refPrefix='xml'">\r
+ <xsl:text>xml</xsl:text>\r
+ </xsl:when>\r
+ <!-- Schema component from current schema's namespace -->\r
+ <xsl:when test="$refPrefix=$tnPrefix">\r
+ <xsl:call-template name="FindComponentInSchema">\r
+ <xsl:with-param name="name" select="$refName"/>\r
+ <xsl:with-param name="compType" select="$compType"/>\r
+ <xsl:with-param name="schema" select="/xsd:schema"/>\r
+ <xsl:with-param name="schemaFileLoc">this</xsl:with-param>\r
+ </xsl:call-template>\r
+ </xsl:when>\r
+ <!-- Schema component from imported namespace -->\r
+ <xsl:when test="normalize-space(translate($searchImportedSchemas, 'TRUE', 'true'))='true'">\r
+ <xsl:variable name="refNS" select="/xsd:schema/namespace::*[local-name(.)=normalize-space($refPrefix)]"/>\r
+ <xsl:call-template name="FindComponentInImportedSchemas">\r
+ <xsl:with-param name="name" select="$refName"/>\r
+ <xsl:with-param name="compType" select="$compType"/>\r
+ <xsl:with-param name="compNS" select="$refNS"/>\r
+ <xsl:with-param name="schema" select="/xsd:schema"/>\r
+ <xsl:with-param name="index">1</xsl:with-param>\r
+ </xsl:call-template>\r
+ </xsl:when>\r
+ </xsl:choose>\r
+ </xsl:template>\r
+\r
+ <xsl:template name="FindComponentInSchema">\r
+ <xsl:param name="name"/>\r
+ <xsl:param name="compType"/>\r
+ <xsl:param name="schema"/>\r
+ <xsl:param name="schemaFileLoc"/>\r
+ <xsl:param name="schemasSearched"/>\r
+\r
+ <!-- Don't examine this schema if we've already\r
+ searched it. Prevents infinite recursion.\r
+ Also check if schema actually exists. -->\r
+ <xsl:if test="$schema and not(contains($schemasSearched, concat('*', $schemaFileLoc, '+')))">\r
+ <!-- Find out if the component is in this schema -->\r
+ <xsl:variable name="thisResult">\r
+ <xsl:call-template name="IsComponentInSchema">\r
+ <xsl:with-param name="name" select="$name"/>\r
+ <xsl:with-param name="compType" select="$compType"/>\r
+ <xsl:with-param name="schema" select="$schema"/>\r
+ </xsl:call-template>\r
+ </xsl:variable>\r
+\r
+ <xsl:choose>\r
+ <!-- Component found -->\r
+ <xsl:when test="normalize-space($thisResult)='true'">\r
+ <xsl:value-of select="$schemaFileLoc"/>\r
+ </xsl:when>\r
+ <!-- Component not found -->\r
+ <xsl:when test="normalize-space(translate($searchIncludedSchemas, 'TRUE', 'true'))='true'">\r
+ <!-- Search included schemas -->\r
+ <xsl:variable name="includeResult">\r
+ <xsl:call-template name="FindComponentInIncludedSchemas">\r
+ <xsl:with-param name="schema" select="$schema"/>\r
+ <xsl:with-param name="name" select="$name"/>\r
+ <xsl:with-param name="compType" select="$compType"/>\r
+ <xsl:with-param name="index">1</xsl:with-param>\r
+ <xsl:with-param name="schemasSearched" select="concat($schemasSearched, '*', $schemaFileLoc, '+')"/>\r
+ </xsl:call-template>\r
+ </xsl:variable>\r
+\r
+ <xsl:choose>\r
+ <xsl:when test="normalize-space($includeResult)!='' and normalize-space($includeResult)!='none'">\r
+ <xsl:value-of select="$includeResult"/>\r
+ </xsl:when>\r
+ <xsl:otherwise>\r
+ <!-- Search redefined schemas -->\r
+ <xsl:call-template name="FindComponentInRedefinedSchemas">\r
+ <xsl:with-param name="schema" select="$schema"/>\r
+ <xsl:with-param name="name" select="$name"/>\r
+ <xsl:with-param name="compType" select="$compType"/>\r
+ <xsl:with-param name="index">1</xsl:with-param>\r
+ <xsl:with-param name="schemasSearched" select="concat($schemasSearched, '*', $schemaFileLoc, '+')"/>\r
+ </xsl:call-template>\r
+ </xsl:otherwise>\r
+ </xsl:choose>\r
+ </xsl:when>\r
+ </xsl:choose>\r
+ </xsl:if>\r
+ </xsl:template>\r
+\r
+ <xsl:template name="IsComponentInSchema">\r
+ <xsl:param name="name"/>\r
+ <xsl:param name="compType"/>\r
+ <xsl:param name="schema"/>\r
+\r
+ <xsl:choose>\r
+ <!-- Schema not found. -->\r
+ <xsl:when test="not($schema)">\r
+ <xsl:text>false</xsl:text>\r
+ </xsl:when>\r
+ <!-- Search for attribute declaration. -->\r
+ <xsl:when test="$compType='attribute' and $schema/xsd:attribute[@name=$name]">\r
+ <xsl:text>true</xsl:text>\r
+ </xsl:when>\r
+ <!-- Search for attribute group definition. -->\r
+ <xsl:when test="$compType='attribute group' and ($schema/xsd:attributeGroup[@name=$name] or $schema/xsd:redefine/xsd:attributeGroup[@name=$name])">\r
+ <xsl:text>true</xsl:text>\r
+ </xsl:when>\r
+ <!-- Search for element declaration. -->\r
+ <xsl:when test="$compType='element' and $schema/xsd:element[@name=$name]">\r
+ <xsl:text>true</xsl:text>\r
+ </xsl:when>\r
+ <!-- Search for group definition. -->\r
+ <xsl:when test="$compType='group' and ($schema/xsd:group[@name=$name] or $schema/xsd:redefine/xsd:group[@name=$name])">\r
+ <xsl:text>true</xsl:text>\r
+ </xsl:when>\r
+ <!-- Search for complex type definition. -->\r
+ <xsl:when test="($compType='type' or $compType='complex type') and ($schema/xsd:complexType[@name=$name] or $schema/xsd:redefine/xsd:complexType[@name=$name])">\r
+ <xsl:text>true</xsl:text>\r
+ </xsl:when>\r
+ <!-- Search for simple type definition. -->\r
+ <xsl:when test="($compType='type' or $compType='simple type') and ($schema/xsd:simpleType[@name=$name] or $schema/xsd:redefine/xsd:simpleType[@name=$name])">\r
+ <xsl:text>true</xsl:text>\r
+ </xsl:when>\r
+ <!-- Search for uniqueness/key constraint definition. -->\r
+ <xsl:when test="$compType='uniqueness/key constraint' and ($schema//xsd:element/xsd:key[@name=$name] or $schema//xsd:element/xsd:unique[@name=$name])">\r
+ <xsl:text>true</xsl:text>\r
+ </xsl:when>\r
+ <!-- Component not found. -->\r
+ <xsl:otherwise>\r
+ <xsl:text>false</xsl:text>\r
+ </xsl:otherwise>\r
+ </xsl:choose>\r
+ </xsl:template>\r
+\r
+ <xsl:template name="FindComponentInIncludedSchemas">\r
+ <xsl:param name="schema"/>\r
+ <xsl:param name="name"/>\r
+ <xsl:param name="compType"/>\r
+ <xsl:param name="schemasSearched"/>\r
+ <xsl:param name="index">1</xsl:param>\r
+\r
+ <xsl:if test="count($schema/xsd:include) >= number($index)">\r
+ <!-- Get the 'schemaLocation' attribute of the 'include'\r
+ element in this schema at position, 'index'. -->\r
+ <xsl:variable name="schemaLoc" select="$schema/xsd:include[position()=$index]/@schemaLocation"/>\r
+\r
+ <xsl:variable name="thisResult">\r
+ <!-- Search for the component in the current \r
+ included schema. -->\r
+ <xsl:call-template name="FindComponentInSchema">\r
+ <xsl:with-param name="name" select="$name"/>\r
+ <xsl:with-param name="compType" select="$compType"/>\r
+ <xsl:with-param name="schema" select="document($schemaLoc)/xsd:schema"/>\r
+ <xsl:with-param name="schemaFileLoc" select="$schemaLoc"/>\r
+ <xsl:with-param name="schemasSearched" select="$schemasSearched"/>\r
+ </xsl:call-template>\r
+ </xsl:variable>\r
+\r
+ <xsl:choose>\r
+ <!-- Component was found, so return result. -->\r
+ <xsl:when test="normalize-space($thisResult)!='' and normalize-space($thisResult)!='none'">\r
+ <xsl:value-of select="$thisResult"/>\r
+ </xsl:when>\r
+ <!-- Component was not found, so keep on searching. -->\r
+ <xsl:otherwise>\r
+ <!-- Examine other included schemas in this schema -->\r
+ <xsl:call-template name="FindComponentInIncludedSchemas">\r
+ <xsl:with-param name="schema" select="$schema"/>\r
+ <xsl:with-param name="name" select="$name"/>\r
+ <xsl:with-param name="compType" select="$compType"/>\r
+ <xsl:with-param name="index" select="number($index)+1"/>\r
+ <xsl:with-param name="schemasSearched" select="concat($schemasSearched, '*', $schemaLoc, '+')"/>\r
+ </xsl:call-template>\r
+ </xsl:otherwise>\r
+ </xsl:choose>\r
+ </xsl:if>\r
+ </xsl:template>\r
+\r
+ <xsl:template name="FindComponentInRedefinedSchemas">\r
+ <xsl:param name="schema"/>\r
+ <xsl:param name="name"/>\r
+ <xsl:param name="compType"/>\r
+ <xsl:param name="schemasSearched"/>\r
+ <xsl:param name="index">1</xsl:param>\r
+\r
+ <xsl:if test="count($schema/xsd:redefine) >= number($index)">\r
+ <!-- Get the 'schemaLocation' attribute of the 'redefine'\r
+ element in this schema at position, 'index'. -->\r
+ <xsl:variable name="schemaLoc" select="$schema/xsd:redefine[position()=$index]/@schemaLocation"/>\r
+\r
+ <xsl:variable name="thisResult">\r
+ <!-- Search for the component in the current \r
+ redefined schema. -->\r
+ <xsl:call-template name="FindComponentInSchema">\r
+ <xsl:with-param name="name" select="$name"/>\r
+ <xsl:with-param name="compType" select="$compType"/>\r
+ <xsl:with-param name="schema" select="document($schemaLoc)/xsd:schema"/>\r
+ <xsl:with-param name="schemaFileLoc" select="$schemaLoc"/>\r
+ <xsl:with-param name="schemasSearched" select="$schemasSearched"/>\r
+ </xsl:call-template>\r
+ </xsl:variable>\r
+\r
+ <xsl:choose>\r
+ <!-- Component was found, so return result. -->\r
+ <xsl:when test="normalize-space($thisResult)!='' and normalize-space($thisResult)!='none'">\r
+ <xsl:value-of select="$thisResult"/>\r
+ </xsl:when>\r
+ <!-- Component was not found, so keep on searching. -->\r
+ <xsl:otherwise>\r
+ <!-- Examine other redefined schemas in this schema -->\r
+ <xsl:call-template name="FindComponentInRedefinedSchemas">\r
+ <xsl:with-param name="schema" select="$schema"/>\r
+ <xsl:with-param name="name" select="$name"/>\r
+ <xsl:with-param name="compType" select="$compType"/>\r
+ <xsl:with-param name="index" select="number($index)+1"/>\r
+ <xsl:with-param name="schemasSearched" select="concat($schemasSearched, '*', $schemaLoc, '+')"/>\r
+ </xsl:call-template>\r
+ </xsl:otherwise>\r
+ </xsl:choose>\r
+ </xsl:if>\r
+ </xsl:template>\r
+\r
+ <xsl:template name="FindComponentInImportedSchemas">\r
+ <xsl:param name="schema"/>\r
+ <xsl:param name="name"/>\r
+ <xsl:param name="compType"/>\r
+ <xsl:param name="compNS"/>\r
+ <xsl:param name="schemasSearched"/>\r
+ <xsl:param name="index">1</xsl:param>\r
+\r
+ <xsl:if test="count($schema/xsd:import) >= number($index)">\r
+ <!-- Get the 'namespace' attribute of the 'import'\r
+ element in this schema at position, 'index'. -->\r
+ <xsl:variable name="schemaNS" select="$schema/xsd:import[position()=$index]/@namespace"/>\r
+ <!-- Get the 'schemaLocation' attribute. -->\r
+ <xsl:variable name="schemaLoc" select="$schema/xsd:import[position()=$index]/@schemaLocation"/>\r
+\r
+ <xsl:variable name="thisResult">\r
+ <!-- Check that the imported schema has the matching\r
+ namespace as the component that we're looking\r
+ for. -->\r
+ <xsl:if test="normalize-space($compNS)=normalize-space($schemaNS)">\r
+ <!-- Search for the component in the current \r
+ imported schema. -->\r
+ <xsl:call-template name="FindComponentInSchema">\r
+ <xsl:with-param name="name" select="$name"/>\r
+ <xsl:with-param name="compType" select="$compType"/>\r
+ <xsl:with-param name="schema" select="document($schemaLoc)/xsd:schema"/>\r
+ <xsl:with-param name="schemaFileLoc" select="$schemaLoc"/>\r
+ <xsl:with-param name="schemasSearched" select="$schemasSearched"/>\r
+ </xsl:call-template>\r
+ </xsl:if>\r
+ </xsl:variable>\r
+\r
+ <xsl:choose>\r
+ <!-- Component was found, so return result. -->\r
+ <xsl:when test="normalize-space($thisResult)!='' and normalize-space($thisResult)!='none'">\r
+ <xsl:value-of select="$thisResult"/>\r
+ </xsl:when>\r
+ <!-- Component was not found, so keep on searching. -->\r
+ <xsl:otherwise>\r
+ <!-- Examine other included schemas in this schema -->\r
+ <xsl:call-template name="FindComponentInImportedSchemas">\r
+ <xsl:with-param name="schema" select="$schema"/>\r
+ <xsl:with-param name="name" select="$name"/>\r
+ <xsl:with-param name="compType" select="$compType"/>\r
+ <xsl:with-param name="compNS" select="$compNS"/>\r
+ <xsl:with-param name="index" select="number($index)+1"/>\r
+ <xsl:with-param name="schemasSearched" select="concat($schemasSearched, '*', $schemaLoc, '+')"/>\r
+ </xsl:call-template>\r
+ </xsl:otherwise>\r
+ </xsl:choose>\r
+ </xsl:if>\r
+ </xsl:template>\r
+\r
+\r
+ <!-- ******** General Utility Templates ******** -->\r
+\r
+ <!-- \r
+ Creates a box that can be opened and closed, such\r
+ that the contents can be hidden away until a button\r
+ is pressed.\r
+ Param(s):\r
+ id (String) required\r
+ Unique ID of the 'div' box\r
+ caption (String) required\r
+ Text describing the contents of the box;\r
+ it will always be shown even when the box\r
+ is closed\r
+ contents (String) required\r
+ Contents of box, which may appear and disappear\r
+ with the press of a button.\r
+ anchor (String) optional\r
+ Anchor, e.g. <a name="...", for this box\r
+ styleClass (String) optional\r
+ Additional CSS class for the entire collapseable box\r
+ isOpened (String) optional\r
+ Set to true if initially opened, and\r
+ false if initially closed\r
+ -->\r
+ <xsl:template name="CollapseableBox">\r
+ <xsl:param name="id"/>\r
+ <xsl:param name="caption"/>\r
+ <xsl:param name="contents"/>\r
+ <xsl:param name="anchor"/>\r
+ <xsl:param name="styleClass"/>\r
+ <xsl:param name="isOpened">false</xsl:param>\r
+\r
+ <xsl:variable name="buttonID" select="concat($id, '_button')"/>\r
+\r
+ <div class="{$styleClass} box">\r
+ <div>\r
+ <!-- Button to control the opening and closing of the 'div' box -->\r
+ <xsl:if test="normalize-space(translate($useJavaScript,'TRUE','true'))='true'">\r
+ <input type="button" id="{$buttonID}" class="control" onclick="switchState('{$id}'); return false;" style="display: none"/>\r
+ <!--\r
+ Button's 'display' property is set to 'none', \r
+ so that button will only be displayed if\r
+ box can be successfully opened and closed.\r
+ -->\r
+ </xsl:if>\r
+ <!-- Box Title -->\r
+ <xsl:text> </xsl:text>\r
+ <span class="caption">\r
+ <xsl:choose>\r
+ <xsl:when test="$anchor != ''">\r
+ <a name="{$anchor}">\r
+ <xsl:value-of select="$caption"/>\r
+ </a>\r
+ </xsl:when>\r
+ <xsl:otherwise>\r
+ <xsl:value-of select="$caption"/>\r
+ </xsl:otherwise>\r
+ </xsl:choose>\r
+ </span>\r
+ </div>\r
+\r
+ <!-- Box Contents -->\r
+ <div id="{$id}" class="contents">\r
+ <xsl:copy-of select="$contents"/>\r
+ </div>\r
+ <xsl:if test="normalize-space(translate($useJavaScript,'TRUE','true'))='true'">\r
+ <xsl:call-template name="PrintJSCode">\r
+ <xsl:with-param name="code">setState('<xsl:value-of select="$id"/>', <xsl:value-of select="$isOpened"/>);</xsl:with-param>\r
+ </xsl:call-template>\r
+ </xsl:if>\r
+ </div>\r
+ </xsl:template>\r
+\r
+ <!--\r
+ Returns the namespace of an attribute\r
+ declaration or reference.\r
+ Param(s):\r
+ attribute (Node) required\r
+ Attribute declaration or reference\r
+ -->\r
+ <xsl:template name="GetAttributeNS">\r
+ <xsl:param name="attribute"/>\r
+\r
+ <xsl:choose>\r
+ <!-- Qualified local attribute declaration -->\r
+ <xsl:when test="$attribute[@name] and (normalize-space(translate($attribute/@form, 'QUALIFED', 'qualifed'))='qualified' or normalize-space(translate(/xsd:schema/@attributeFormDefault, 'QUALIFED', 'qualifed'))='qualified')">\r
+ <xsl:value-of select="/xsd:schema/@targetNamespace"/>\r
+ </xsl:when>\r
+ <!-- Reference to global attribute declaration -->\r
+ <xsl:when test="$attribute[@ref]">\r
+ <xsl:call-template name="GetRefNS">\r
+ <xsl:with-param name="ref" select="$attribute/@ref"/>\r
+ </xsl:call-template>\r
+ </xsl:when>\r
+ <!-- Otherwise, attribute has no namespace -->\r
+ </xsl:choose>\r
+ </xsl:template>\r
+\r
+ <!--\r
+ Returns the description that can be used in \r
+ headers for a schema component.\r
+ Param(s):\r
+ component (Node) required\r
+ Schema component\r
+ -->\r
+ <xsl:template name="GetComponentDescription">\r
+ <xsl:param name="component"/>\r
+\r
+ <xsl:choose>\r
+ <xsl:when test="local-name($component)='all'">\r
+ <xsl:text>All Model Group</xsl:text>\r
+ </xsl:when>\r
+ <xsl:when test="local-name($component)='attribute'">\r
+ <xsl:text>Attribute</xsl:text>\r
+ </xsl:when>\r
+ <xsl:when test="local-name($component)='attributeGroup'">\r
+ <xsl:text>Attribute Group</xsl:text>\r
+ </xsl:when>\r
+ <xsl:when test="local-name($component)='choice'">\r
+ <xsl:text>Choice Model Group</xsl:text>\r
+ </xsl:when>\r
+ <xsl:when test="local-name($component)='complexType'">\r
+ <xsl:text>Complex Type</xsl:text>\r
+ </xsl:when>\r
+ <xsl:when test="local-name($component)='element'">\r
+ <xsl:text>Element</xsl:text>\r
+ </xsl:when>\r
+ <xsl:when test="local-name($component)='group'">\r
+ <xsl:text>Model Group</xsl:text>\r
+ </xsl:when>\r
+ <xsl:when test="local-name($component)='notation'">\r
+ <xsl:text>Notation</xsl:text>\r
+ </xsl:when>\r
+ <xsl:when test="local-name($component)='sequence'">\r
+ <xsl:text>Sequence Model Group</xsl:text>\r
+ </xsl:when>\r
+ <xsl:when test="local-name($component)='simpleType'">\r
+ <xsl:text>Simple Type</xsl:text>\r
+ </xsl:when>\r
+ <xsl:otherwise>\r
+ <xsl:call-template name="HandleError">\r
+ <xsl:with-param name="isTerminating">true</xsl:with-param>\r
+ <xsl:with-param name="errorMsg">\r
+Unknown schema component, <xsl:value-of select="local-name($component)"/>.\r
+ </xsl:with-param>\r
+ </xsl:call-template>\r
+ </xsl:otherwise>\r
+ </xsl:choose>\r
+ </xsl:template>\r
+\r
+ <!--\r
+ Returns the unique identifier for a top-level schema\r
+ component. Returns the string "schema" if the 'component' \r
+ is the root schema element.\r
+ Param(s):\r
+ component (Node) required\r
+ Schema component\r
+ -->\r
+ <xsl:template name="GetComponentID">\r
+ <xsl:param name="component"/>\r
+\r
+ <xsl:choose>\r
+ <xsl:when test="local-name($component)='schema'">\r
+ <xsl:text>schema</xsl:text>\r
+ </xsl:when>\r
+ <xsl:otherwise>\r
+ <xsl:variable name="componentPrefix">\r
+ <xsl:call-template name="GetComponentPrefix">\r
+ <xsl:with-param name="component" select="$component"/>\r
+ </xsl:call-template>\r
+ </xsl:variable>\r
+ <xsl:value-of select="concat($componentPrefix, $component/@name)"/>\r
+ </xsl:otherwise>\r
+ </xsl:choose>\r
+ </xsl:template>\r
+\r
+ <!--\r
+ Returns the prefix to add in front of a schema component\r
+ name when generating anchor names.\r
+ Param(s):\r
+ component (Node) required\r
+ Schema component\r
+ -->\r
+ <xsl:template name="GetComponentPrefix">\r
+ <xsl:param name="component"/>\r
+\r
+ <xsl:choose>\r
+ <xsl:when test="local-name($component)='attribute'">\r
+ <xsl:value-of select="$ATTR_PREFIX"/>\r
+ </xsl:when>\r
+ <xsl:when test="local-name($component)='attributeGroup'">\r
+ <xsl:value-of select="$ATTR_GRP_PREFIX"/>\r
+ </xsl:when>\r
+ <xsl:when test="local-name($component)='complexType'">\r
+ <xsl:value-of select="$CTYPE_PREFIX"/>\r
+ </xsl:when>\r
+ <xsl:when test="local-name($component)='element'">\r
+ <xsl:value-of select="$ELEM_PREFIX"/>\r
+ </xsl:when>\r
+ <xsl:when test="local-name($component)='group'">\r
+ <xsl:value-of select="$GRP_PREFIX"/>\r
+ </xsl:when>\r
+ <xsl:when test="local-name($component)='notation'">\r
+ <xsl:value-of select="$NOTA_PREFIX"/>\r
+ </xsl:when>\r
+ <xsl:when test="local-name($component)='simpleType'">\r
+ <xsl:value-of select="$STYPE_PREFIX"/>\r
+ </xsl:when>\r
+ <xsl:when test="local-name($component)='key' or local-name($component)='unique'">\r
+ <xsl:value-of select="$KEY_PREFIX"/>\r
+ </xsl:when>\r
+ <xsl:otherwise>\r
+ <xsl:call-template name="HandleError">\r
+ <xsl:with-param name="isTerminating">true</xsl:with-param>\r
+ <xsl:with-param name="errorMsg">\r
+Unknown schema component, <xsl:value-of select="local-name($component)"/>.\r
+ </xsl:with-param>\r
+ </xsl:call-template>\r
+ </xsl:otherwise>\r
+ </xsl:choose>\r
+ </xsl:template>\r
+\r
+ <!--\r
+ Returns a glossary term reference for the \r
+ schema component type, if applicable.\r
+ Param(s):\r
+ component (Node) required\r
+ Schema component\r
+ -->\r
+ <xsl:template name="GetComponentTermRef">\r
+ <xsl:param name="component"/>\r
+\r
+ <xsl:choose>\r
+ <xsl:when test="local-name($component)='notation'">\r
+ <xsl:text>Notation</xsl:text>\r
+ </xsl:when>\r
+ </xsl:choose>\r
+ </xsl:template>\r
+\r
+ <!--\r
+ Returns the namespace prefix of an attribute.\r
+ Param(s):\r
+ attribute (Node) required\r
+ Attribute declaration or reference\r
+ -->\r
+ <xsl:template name="GetAttributePrefix">\r
+ <xsl:param name="attribute"/>\r
+\r
+ <xsl:choose>\r
+ <!-- Element reference -->\r
+ <xsl:when test="$attribute/@ref">\r
+ <xsl:call-template name="GetRefPrefix">\r
+ <xsl:with-param name="ref" select="$attribute/@ref"/>\r
+ </xsl:call-template>\r
+ </xsl:when>\r
+ <!-- Global element declaration -->\r
+ <xsl:when test="local-name($attribute/..)='schema'">\r
+ <xsl:call-template name="GetThisPrefix"/>\r
+ </xsl:when>\r
+ <!-- Local element declaration -->\r
+ <xsl:otherwise>\r
+ <xsl:if test="($attribute/@form and normalize-space($attribute/@form)='qualified') or (/xsd:schema/@attributeFormDefault and normalize-space(/xsd:schema/@attributeFormDefault)='qualified')">\r
+ <xsl:call-template name="GetThisPrefix"/>\r
+ </xsl:if>\r
+ </xsl:otherwise>\r
+ </xsl:choose>\r
+ </xsl:template>\r
+\r
+ <!--\r
+ Returns the namespace prefix of an element.\r
+ Param(s):\r
+ element (Node) required\r
+ Element declaration or reference\r
+ -->\r
+ <xsl:template name="GetElementPrefix">\r
+ <xsl:param name="element"/>\r
+\r
+ <xsl:choose>\r
+ <!-- Element reference -->\r
+ <xsl:when test="$element/@ref">\r
+ <xsl:call-template name="GetRefPrefix">\r
+ <xsl:with-param name="ref" select="$element/@ref"/>\r
+ </xsl:call-template>\r
+ </xsl:when>\r
+ <!-- Global element declaration -->\r
+ <xsl:when test="local-name($element/..)='schema'">\r
+ <xsl:call-template name="GetThisPrefix"/>\r
+ </xsl:when>\r
+ <!-- Local element declaration -->\r
+ <xsl:otherwise>\r
+ <xsl:if test="($element/@form and normalize-space($element/@form)='qualified') or (/xsd:schema/@elementFormDefault and normalize-space(/xsd:schema/@elementFormDefault)='qualified')">\r
+ <xsl:call-template name="GetThisPrefix"/>\r
+ </xsl:if>\r
+ </xsl:otherwise>\r
+ </xsl:choose>\r
+ </xsl:template>\r
+\r
+ <!--\r
+ Returns the local name of a reference.\r
+ Param(s):\r
+ ref (String) required\r
+ Reference\r
+ -->\r
+ <xsl:template name="GetRefName">\r
+ <xsl:param name="ref"/>\r
+\r
+ <xsl:choose>\r
+ <xsl:when test="contains($ref, ':')">\r
+ <!-- Ref has namespace prefix -->\r
+ <xsl:value-of select="substring-after($ref, ':')"/>\r
+ </xsl:when>\r
+ <xsl:otherwise>\r
+ <!-- Ref has no namespace prefix -->\r
+ <xsl:value-of select="$ref"/>\r
+ </xsl:otherwise>\r
+ </xsl:choose>\r
+ </xsl:template>\r
+\r
+ <!--\r
+ Returns the namespace prefix of a reference.\r
+ Param(s):\r
+ ref (String) required\r
+ Reference\r
+ -->\r
+ <xsl:template name="GetRefPrefix">\r
+ <xsl:param name="ref"/>\r
+ <!-- Get namespace prefix -->\r
+ <xsl:value-of select="substring-before($ref, ':')"/>\r
+ </xsl:template>\r
+\r
+ <!--\r
+ Returns the namespace of a reference.\r
+ Param(s):\r
+ ref (String) required\r
+ Reference\r
+ -->\r
+ <xsl:template name="GetRefNS">\r
+ <xsl:param name="ref"/>\r
+ <!-- Get namespace prefix -->\r
+ <xsl:variable name="refPrefix" select="substring-before($ref, ':')"/>\r
+ <!-- Get namespace -->\r
+ <xsl:value-of select="/xsd:schema/namespace::*[local-name(.)=normalize-space($refPrefix)]"/>\r
+ </xsl:template>\r
+\r
+ <!--\r
+ Returns the declared prefix of this schema's target namespace.\r
+ -->\r
+ <xsl:template name="GetThisPrefix">\r
+ <xsl:if test="/xsd:schema/@targetNamespace">\r
+ <xsl:value-of select="local-name(/xsd:schema/namespace::*[normalize-space(.)=normalize-space(/xsd:schema/@targetNamespace)])"/>\r
+ </xsl:if>\r
+ </xsl:template>\r
+\r
+ <!--\r
+ Returns the declared prefix of XML Schema namespace.\r
+ -->\r
+ <xsl:template name="GetXSDPrefix">\r
+ <xsl:value-of select="local-name(/xsd:schema/namespace::*[normalize-space(.)=$XSD_NS])"/>\r
+ </xsl:template>\r
+\r
+ <!--\r
+ Returns the schema documentation file location for a\r
+ given URI for a schema, done by looking up the file\r
+ specified in 'linksFile' variable.\r
+ It'll throw a fatal error if a value for 'linksFile' was \r
+ provided and the documentation file for 'uri' could not be\r
+ found.\r
+ Param(s):\r
+ uri (String) required\r
+ Location of schema file\r
+ -->\r
+ <xsl:template name="GetSchemaDocLocation">\r
+ <xsl:param name="uri"/>\r
+\r
+ <xsl:if test="$linksFile!=''">\r
+ <xsl:variable name="schemaDocFile" select="document($linksFile)/ppp:links/ppp:schema[@file-location=$uri]/@docfile-location"/>\r
+ <xsl:if test="$schemaDocFile=''">\r
+ <xsl:call-template name="HandleError">\r
+ <xsl:with-param name="isTerminating">true</xsl:with-param>\r
+ <xsl:with-param name="errorMsg">\r
+Documentation file for the schema at, <xsl:value-of select="$uri"/>,\r
+was not specified in the links file, <xsl:value-of select="$linksFile"/>.\r
+ </xsl:with-param>\r
+ </xsl:call-template>\r
+ </xsl:if>\r
+ <xsl:value-of select="$schemaDocFile"/>\r
+ </xsl:if>\r
+ </xsl:template>\r
+\r
+ <!--\r
+ Prints out a boolean value.\r
+ Param(s):\r
+ boolean (String) required\r
+ Boolean value\r
+ -->\r
+ <xsl:template name="PrintBoolean">\r
+ <xsl:param name="boolean"/>\r
+\r
+ <xsl:choose>\r
+ <xsl:when test="normalize-space(translate($boolean,'TRUE', 'true'))='true' or normalize-space($boolean)='1'">\r
+ <xsl:text>yes</xsl:text>\r
+ </xsl:when>\r
+ <xsl:otherwise>\r
+ <xsl:text>no</xsl:text>\r
+ </xsl:otherwise>\r
+ </xsl:choose>\r
+ </xsl:template>\r
+\r
+ <!--\r
+ Prints out a link to the namespace of a prefix,\r
+ and tacks on a colon in the end.\r
+ Param(s):\r
+ prefix (String) required\r
+ Namespace prefix\r
+ nolink (boolean) optional\r
+ If true, doesn't provide a link to the\r
+ namespace in the namespaces table.\r
+ schemaLoc (String) optional\r
+ Schema file containing this namespace prefix;\r
+ if in current schema, 'schemaLoc' is set to 'this'\r
+ -->\r
+ <xsl:template name="PrintNSPrefix">\r
+ <xsl:param name="prefix"/>\r
+ <xsl:param name="nolink">false</xsl:param>\r
+ <xsl:param name="schemaLoc">this</xsl:param>\r
+\r
+ <xsl:if test="$prefix!='' and normalize-space(translate($printNSPrefixes,'TRUE','true'))='true'">\r
+ <xsl:choose>\r
+ <xsl:when test="$nolink='false'">\r
+ <xsl:call-template name="PrintNamespaceRef">\r
+ <xsl:with-param name="prefix" select="$prefix"/>\r
+ <xsl:with-param name="schemaLoc" select="$schemaLoc"/>\r
+ </xsl:call-template>\r
+ </xsl:when>\r
+ <xsl:otherwise>\r
+ <xsl:value-of select="$prefix"/>\r
+ </xsl:otherwise>\r
+ </xsl:choose>\r
+ <xsl:text>:</xsl:text>\r
+ </xsl:if>\r
+ </xsl:template>\r
+\r
+ <!--\r
+ Prints out the min/max occurrences of a schema component.\r
+ Param(s):\r
+ component (Node) optional\r
+ Schema component\r
+ minOccurs (String) optional\r
+ Minimum occurrences\r
+ maxOccurs (String) optional\r
+ Maximum occurrences\r
+ -->\r
+ <xsl:template name="PrintOccurs">\r
+ <xsl:param name="component"/>\r
+ <xsl:param name="minOccurs"/>\r
+ <xsl:param name="maxOccurs"/>\r
+\r
+ <!-- Get min occurs -->\r
+ <xsl:variable name="min">\r
+ <xsl:choose>\r
+ <xsl:when test="$component and local-name($component)='attribute'">\r
+ <xsl:choose>\r
+ <xsl:when test="normalize-space($component/@use)='required'">\r
+ <xsl:text>1</xsl:text>\r
+ </xsl:when>\r
+ <xsl:otherwise>\r
+ <xsl:text>0</xsl:text>\r
+ </xsl:otherwise>\r
+ </xsl:choose>\r
+ </xsl:when>\r
+ <xsl:otherwise>\r
+ <xsl:choose>\r
+ <xsl:when test="$component and $component/@minOccurs">\r
+ <xsl:value-of select="$component/@minOccurs"/>\r
+ </xsl:when>\r
+ <xsl:when test="$minOccurs != ''">\r
+ <xsl:value-of select="$minOccurs"/>\r
+ </xsl:when>\r
+ <xsl:otherwise>\r
+ <xsl:text>1</xsl:text>\r
+ </xsl:otherwise>\r
+ </xsl:choose>\r
+ </xsl:otherwise>\r
+ </xsl:choose>\r
+ </xsl:variable>\r
+ <!-- Get max occurs -->\r
+ <xsl:variable name="max">\r
+ <xsl:choose>\r
+ <xsl:when test="$component and local-name($component)='attribute'">\r
+ <xsl:choose>\r
+ <xsl:when test="normalize-space($component/@use)='prohibited'">\r
+ <xsl:text>0</xsl:text>\r
+ </xsl:when>\r
+ <xsl:otherwise>\r
+ <xsl:text>1</xsl:text>\r
+ </xsl:otherwise>\r
+ </xsl:choose>\r
+ </xsl:when>\r
+ <xsl:otherwise>\r
+ <xsl:choose>\r
+ <xsl:when test="($component and normalize-space($component/@maxOccurs)='unbounded') or $maxOccurs='unbounded'">\r
+ <xsl:text>*</xsl:text>\r
+ </xsl:when>\r
+ <xsl:when test="$component and $component/@maxOccurs">\r
+ <xsl:value-of select="$component/@maxOccurs"/>\r
+ </xsl:when>\r
+ <xsl:when test="$maxOccurs != ''">\r
+ <xsl:value-of select="$maxOccurs"/>\r
+ </xsl:when>\r
+ <xsl:otherwise>\r
+ <xsl:text>1</xsl:text>\r
+ </xsl:otherwise>\r
+ </xsl:choose>\r
+ </xsl:otherwise>\r
+ </xsl:choose>\r
+ </xsl:variable>\r
+\r
+ <span class="occurs">\r
+ <xsl:choose>\r
+ <xsl:when test="number($min)=1 and number($max)=1">\r
+ <xsl:text>[1]</xsl:text>\r
+ </xsl:when>\r
+ <xsl:otherwise>\r
+ <xsl:text>[</xsl:text>\r
+ <xsl:value-of select="$min"/>\r
+ <xsl:text>..</xsl:text>\r
+ <xsl:value-of select="$max"/>\r
+ <xsl:text>]</xsl:text>\r
+ </xsl:otherwise>\r
+ </xsl:choose>\r
+ </span>\r
+ </xsl:template>\r
+\r
+ <!--\r
+ Translates occurrence of '#all' in 'block' value\r
+ of element declarations.\r
+ Param(s):\r
+ EBV (String) required\r
+ Value\r
+ -->\r
+ <xsl:template name="PrintBlockSet">\r
+ <xsl:param name="EBV"/>\r
+\r
+ <xsl:choose>\r
+ <xsl:when test="normalize-space($EBV)='#all'">\r
+ <xsl:text>restriction, extension, substitution</xsl:text>\r
+ </xsl:when>\r
+ <xsl:otherwise>\r
+ <xsl:value-of select="$EBV"/>\r
+ </xsl:otherwise>\r
+ </xsl:choose>\r
+ </xsl:template>\r
+\r
+ <!--\r
+ Translates occurrence of '#all' in 'final' value\r
+ of element declarations, and 'block' and 'final' values \r
+ in complex type definitions.\r
+ Param(s):\r
+ EBV (String) required\r
+ Value\r
+ -->\r
+ <xsl:template name="PrintDerivationSet">\r
+ <xsl:param name="EBV"/>\r
+\r
+ <xsl:choose>\r
+ <xsl:when test="normalize-space($EBV)='#all'">\r
+ <xsl:text>restriction, extension</xsl:text>\r
+ </xsl:when>\r
+ <xsl:otherwise>\r
+ <xsl:value-of select="$EBV"/>\r
+ </xsl:otherwise>\r
+ </xsl:choose>\r
+ </xsl:template>\r
+\r
+ <!--\r
+ Translates occurrence of '#all' in 'final' value\r
+ of simple type definitions.\r
+ Param(s):\r
+ EBV (String) required\r
+ Value\r
+ -->\r
+ <xsl:template name="PrintSimpleDerivationSet">\r
+ <xsl:param name="EBV"/>\r
+\r
+ <xsl:choose>\r
+ <xsl:when test="normalize-space($EBV)='#all'">\r
+ <xsl:text>restriction, list, union</xsl:text>\r
+ </xsl:when>\r
+ <xsl:when test="normalize-space($EBV)!=''">\r
+ <xsl:value-of select="$EBV"/>\r
+ </xsl:when>\r
+ </xsl:choose>\r
+ </xsl:template>\r
+\r
+ <!--\r
+ Print out a URI. If it starts with 'http', a link is provided.\r
+ Param(s):\r
+ uri (String) required\r
+ URI to be printed\r
+ -->\r
+ <xsl:template name="PrintURI">\r
+ <xsl:param name="uri"/>\r
+\r
+ <xsl:choose>\r
+ <xsl:when test="starts-with($uri, 'http')">\r
+ <a title="{$uri}" href="{$uri}">\r
+ <xsl:value-of select="$uri"/>\r
+ </a>\r
+ </xsl:when>\r
+ <xsl:otherwise>\r
+ <xsl:value-of select="$uri"/>\r
+ </xsl:otherwise>\r
+ </xsl:choose>\r
+ </xsl:template>\r
+\r
+ <!--\r
+ Print out a link to the documentation of schema document.\r
+ For this happen, the 'linksFile' variable must be provided,\r
+ it must point to an actual file, and in that file, there\r
+ must be a mapping from the schema file location to the\r
+ schema documentation file location.\r
+ Param(s):\r
+ uri (String) required\r
+ Location of schema file\r
+ -->\r
+ <xsl:template name="PrintSchemaLink">\r
+ <xsl:param name="uri"/>\r
+\r
+ <xsl:variable name="docFileLoc">\r
+ <xsl:call-template name="GetSchemaDocLocation">\r
+ <xsl:with-param name="uri" select="$uri"/>\r
+ </xsl:call-template>\r
+ </xsl:variable>\r
+\r
+ <xsl:choose>\r
+ <xsl:when test="$docFileLoc!=''">\r
+ <a title="Jump to schema documentation for '{$uri}'." href="{$docFileLoc}">\r
+ <xsl:value-of select="$uri"/>\r
+ </a>\r
+ </xsl:when>\r
+ <xsl:otherwise>\r
+ <xsl:value-of select="$uri"/>\r
+ </xsl:otherwise>\r
+ </xsl:choose>\r
+ </xsl:template>\r
+\r
+ <!--\r
+ Tokenises a whitespace-separated list of values, and\r
+ displays them appropriately.\r
+ Param(s):\r
+ value (String) required\r
+ Whitespace-separated list\r
+ compType (String) optional\r
+ Specify schema component type if values in list are\r
+ schema components, so appropriate links can be provided.\r
+ isInList (boolean) optional\r
+ If true, place each value within 'li' tags.\r
+ Assumes that this template is called within an HTML\r
+ list element.\r
+ separator (String) optional\r
+ Character(s) to use to separate resulting values in list.\r
+ Only used if 'isInList' is false.\r
+ If none is provided, uses a space character, ' '.\r
+ isFirst (boolean) optional\r
+ If false, it's a recursive call from 'PrintWhitespaceList'.\r
+ schemaLoc (String) optional\r
+ Schema file containing this all model group;\r
+ if in current schema, 'schemaLoc' is set to 'this'\r
+ -->\r
+ <xsl:template name="PrintWhitespaceList">\r
+ <xsl:param name="value"/>\r
+ <xsl:param name="compType"/>\r
+ <xsl:param name="isInList">false</xsl:param>\r
+ <xsl:param name="separator"/>\r
+ <xsl:param name="isFirst">true</xsl:param>\r
+ <xsl:param name="schemaLoc">this</xsl:param>\r
+\r
+ <xsl:variable name="token" select="normalize-space(substring-before($value, ' '))"/>\r
+ <xsl:choose>\r
+ <xsl:when test="$token!=''">\r
+ <!-- Whitespace found in value -->\r
+ <!-- Print out token -->\r
+ <xsl:call-template name="PrintWhitespaceListToken">\r
+ <xsl:with-param name="token" select="$token"/>\r
+ <xsl:with-param name="compType" select="$compType"/>\r
+ <xsl:with-param name="isInList" select="$isInList"/>\r
+ <xsl:with-param name="separator" select="$separator"/>\r
+ <xsl:with-param name="isFirst" select="$isFirst"/>\r
+ <xsl:with-param name="schemaLoc" select="$schemaLoc"/>\r
+ </xsl:call-template>\r
+ <!-- Continue parsing -->\r
+ <xsl:variable name="rest" select="normalize-space(substring-after($value, $token))"/>\r
+ <xsl:if test="$rest!=''">\r
+ <xsl:call-template name="PrintWhitespaceList">\r
+ <xsl:with-param name="value" select="$rest"/>\r
+ <xsl:with-param name="compType" select="$compType"/>\r
+ <xsl:with-param name="isInList" select="$isInList"/>\r
+ <xsl:with-param name="separator" select="$separator"/>\r
+ <xsl:with-param name="isFirst">false</xsl:with-param>\r
+ <xsl:with-param name="schemaLoc" select="$schemaLoc"/>\r
+ </xsl:call-template>\r
+ </xsl:if>\r
+ </xsl:when>\r
+ <xsl:otherwise>\r
+ <!-- No more whitespaces -->\r
+ <!-- Print out one last token -->\r
+ <xsl:if test="normalize-space($value)!=''">\r
+ <xsl:call-template name="PrintWhitespaceListToken">\r
+ <xsl:with-param name="token" select="$value"/>\r
+ <xsl:with-param name="compType" select="$compType"/>\r
+ <xsl:with-param name="isInList" select="$isInList"/>\r
+ <xsl:with-param name="separator" select="$separator"/>\r
+ <xsl:with-param name="isFirst" select="$isFirst"/>\r
+ <xsl:with-param name="schemaLoc" select="$schemaLoc"/>\r
+ </xsl:call-template>\r
+ </xsl:if>\r
+ </xsl:otherwise>\r
+ </xsl:choose>\r
+ </xsl:template>\r
+\r
+ <!--\r
+ Helper template for 'PrintWhitespaceList' template,\r
+ which prints out one token in the list.\r
+ Param(s):\r
+ token (String) required\r
+ Token to be printed\r
+ compType (String) optional\r
+ Schema component type of token, if applicable.\r
+ isInList (boolean) optional\r
+ If true, place token within 'li' tags.\r
+ separator (String) optional\r
+ Character(s) use to separate one token from another.\r
+ Only used if 'isInList' is false.\r
+ If none is provided, uses a space character, ' '.\r
+ isFirst (boolean) optional\r
+ If true, token is the first value in the list.\r
+ schemaLoc (String) optional\r
+ Schema file containing this all model group;\r
+ if in current schema, 'schemaLoc' is set to 'this'\r
+ -->\r
+ <xsl:template name="PrintWhitespaceListToken">\r
+ <xsl:param name="token"/>\r
+ <xsl:param name="compType"/>\r
+ <xsl:param name="isInList">false</xsl:param>\r
+ <xsl:param name="separator"/>\r
+ <xsl:param name="isFirst">true</xsl:param>\r
+ <xsl:param name="schemaLoc">this</xsl:param>\r
+\r
+ <xsl:variable name="displayValue">\r
+ <xsl:choose>\r
+ <xsl:when test="$compType!=''">\r
+ <xsl:call-template name="PrintCompRef">\r
+ <xsl:with-param name="ref" select="normalize-space($token)"/>\r
+ <xsl:with-param name="compType" select="$compType"/>\r
+ <xsl:with-param name="schemaLoc" select="$schemaLoc"/>\r
+ </xsl:call-template>\r
+ </xsl:when>\r
+ <xsl:otherwise>\r
+ <xsl:value-of select="normalize-space($token)"/>\r
+ </xsl:otherwise>\r
+ </xsl:choose>\r
+ </xsl:variable>\r
+\r
+ <xsl:choose>\r
+ <xsl:when test="$isInList!='false'">\r
+ <li>\r
+ <xsl:copy-of select="$displayValue"/>\r
+ </li>\r
+ </xsl:when>\r
+ <xsl:when test="$isFirst!='true'">\r
+ <xsl:choose>\r
+ <xsl:when test="$separator!=''">\r
+ <xsl:value-of select="$separator"/>\r
+ </xsl:when>\r
+ <xsl:otherwise>\r
+ <xsl:text> </xsl:text>\r
+ </xsl:otherwise>\r
+ </xsl:choose>\r
+ <xsl:copy-of select="$displayValue"/>\r
+ </xsl:when>\r
+ <xsl:otherwise>\r
+ <xsl:copy-of select="$displayValue"/>\r
+ </xsl:otherwise>\r
+ </xsl:choose>\r
+ </xsl:template>\r
+\r
+ <!--\r
+ Print out a wildcard.\r
+ Param(s):\r
+ componentType (attribute|element) required\r
+ XML Schema component type\r
+ namespaces (String) required\r
+ Namespace attribute of wildcard\r
+ processContents (String) required\r
+ Process contents attribute of wildcard\r
+ namespaces (String) required\r
+ Namespace attribute of wildcard\r
+ -->\r
+ <xsl:template name="PrintWildcard">\r
+ <xsl:param name="componentType">element</xsl:param>\r
+ <xsl:param name="namespace"/>\r
+ <xsl:param name="processContents"/>\r
+ <xsl:param name="minOccurs"/>\r
+ <xsl:param name="maxOccurs"/>\r
+\r
+ <xsl:text>Allow any </xsl:text>\r
+ <xsl:value-of select="$componentType"/>\r
+ <xsl:text>s from </xsl:text>\r
+\r
+ <xsl:choose>\r
+ <!-- ##any -->\r
+ <xsl:when test="not($namespace) or normalize-space($namespace)='##any'">\r
+ <xsl:text>any namespace</xsl:text>\r
+ </xsl:when>\r
+ <!-- ##other -->\r
+ <xsl:when test="normalize-space($namespace)='##other'">\r
+ <xsl:text>a namespace other than this schema's namespace</xsl:text>\r
+ </xsl:when>\r
+ <!-- ##targetNamespace, ##local, specific namespaces -->\r
+ <xsl:otherwise>\r
+ <!-- ##targetNamespace -->\r
+ <xsl:variable name="hasTargetNS">\r
+ <xsl:if test="contains($namespace, '##targetNamespace')">\r
+ <xsl:text>true</xsl:text>\r
+ </xsl:if>\r
+ </xsl:variable>\r
+ <!-- ##local -->\r
+ <xsl:variable name="hasLocalNS">\r
+ <xsl:if test="contains($namespace, '##local')">\r
+ <xsl:text>true</xsl:text>\r
+ </xsl:if>\r
+ </xsl:variable>\r
+ <!-- Specific namespaces -->\r
+ <!-- Remove '##targetNamespace' string if any-->\r
+ <xsl:variable name="temp">\r
+ <xsl:choose>\r
+ <xsl:when test="$hasTargetNS='true'">\r
+ <xsl:value-of select="concat(substring-before($namespace, '##targetNamespace'), substring-after($namespace, '##targetNamespace'))"/>\r
+ </xsl:when>\r
+ <xsl:otherwise>\r
+ <xsl:value-of select="$namespace"/>\r
+ </xsl:otherwise>\r
+ </xsl:choose>\r
+ </xsl:variable>\r
+ <!-- Remove '##local' string if any -->\r
+ <xsl:variable name="specificNS">\r
+ <xsl:choose>\r
+ <xsl:when test="$hasLocalNS='true'">\r
+ <xsl:value-of select="concat(substring-before($temp, '##local'), substring-after($temp, '##local'))"/>\r
+ </xsl:when>\r
+ <xsl:otherwise>\r
+ <xsl:value-of select="$temp"/>\r
+ </xsl:otherwise>\r
+ </xsl:choose>\r
+ </xsl:variable>\r
+ <xsl:variable name="hasSpecificNS">\r
+ <xsl:if test="normalize-space($specificNS)!=''">\r
+ <xsl:text>true</xsl:text>\r
+ </xsl:if>\r
+ </xsl:variable>\r
+\r
+ <xsl:if test="$hasLocalNS='true'">\r
+ <xsl:text>no namespace</xsl:text>\r
+ </xsl:if>\r
+\r
+ <xsl:if test="$hasTargetNS='true'">\r
+ <xsl:choose>\r
+ <xsl:when test="$hasLocalNS='true' and $hasSpecificNS!='true'">\r
+ <xsl:text> and </xsl:text>\r
+ </xsl:when>\r
+ <xsl:when test="$hasLocalNS='true'">\r
+ <xsl:text>, </xsl:text>\r
+ </xsl:when>\r
+ </xsl:choose>\r
+ <xsl:text>this schema's namespace</xsl:text>\r
+ </xsl:if>\r
+\r
+ <xsl:if test="$hasSpecificNS='true'">\r
+ <xsl:choose>\r
+ <xsl:when test="$hasTargetNS='true' and $hasLocalNS='true'">\r
+ <xsl:text>, and </xsl:text>\r
+ </xsl:when>\r
+ <xsl:when test="$hasTargetNS='true' or $hasLocalNS='true'">\r
+ <xsl:text> and </xsl:text>\r
+ </xsl:when>\r
+ </xsl:choose>\r
+ <xsl:text>the following namespace(s): </xsl:text>\r
+ <xsl:call-template name="PrintWhitespaceList">\r
+ <xsl:with-param name="value" select="normalize-space($specificNS)"/>\r
+ <xsl:with-param name="separator">,</xsl:with-param>\r
+ </xsl:call-template>\r
+ </xsl:if>\r
+ </xsl:otherwise>\r
+ </xsl:choose>\r
+ <!-- Process contents -->\r
+ <xsl:text> (</xsl:text>\r
+ <xsl:choose>\r
+ <xsl:when test="$processContents">\r
+ <xsl:value-of select="normalize-space($processContents)"/>\r
+ </xsl:when>\r
+ <xsl:otherwise>\r
+ <xsl:text>strict</xsl:text>\r
+ </xsl:otherwise>\r
+ </xsl:choose>\r
+ <xsl:text> validation)</xsl:text>\r
+ <xsl:text>.</xsl:text>\r
+\r
+ <!-- Print min/max occurs -->\r
+ <xsl:if test="$componentType='element'">\r
+ <xsl:text> </xsl:text>\r
+ <xsl:call-template name="PrintOccurs">\r
+ <xsl:with-param name="minOccurs" select="$minOccurs"/>\r
+ <xsl:with-param name="maxOccurs" select="$maxOccurs"/>\r
+ </xsl:call-template>\r
+ </xsl:if>\r
+ </xsl:template>\r
+\r
+ <!--\r
+ Print out the pattern property for derivations by\r
+ restriction on simple content.\r
+ Param(s):\r
+ simpleRestrict (Node) required\r
+ 'restriction' element\r
+ -->\r
+ <xsl:template name="PrintPatternFacet">\r
+ <xsl:param name="simpleRestrict"/>\r
+\r
+ <xsl:if test="$simpleRestrict/xsd:pattern">\r
+ <em>pattern</em>\r
+ <xsl:text> = </xsl:text>\r
+ <xsl:value-of select="$simpleRestrict/xsd:pattern/@value"/>\r
+ </xsl:if>\r
+ </xsl:template>\r
+\r
+ <!--\r
+ Print out the total digits property for derivations by\r
+ restriction on simple content.\r
+ Param(s):\r
+ simpleRestrict (Node) required\r
+ 'restriction' element\r
+ -->\r
+ <xsl:template name="PrintTotalDigitsFacet">\r
+ <xsl:param name="simpleRestrict"/>\r
+\r
+ <xsl:if test="$simpleRestrict/xsd:totalDigits">\r
+ <em>total no. of digits</em>\r
+ <xsl:text> = </xsl:text>\r
+ <xsl:value-of select="$simpleRestrict/xsd:totalDigits/@value"/>\r
+ </xsl:if>\r
+ </xsl:template>\r
+\r
+ <!--\r
+ Print out the fraction digits property for derivations by\r
+ restriction on simple content.\r
+ Param(s):\r
+ simpleRestrict (Node) required\r
+ 'restriction' element\r
+ -->\r
+ <xsl:template name="PrintFractionDigitsFacet">\r
+ <xsl:param name="simpleRestrict"/>\r
+\r
+ <xsl:if test="$simpleRestrict/xsd:fractionDigits">\r
+ <em>\r
+ <xsl:text>no. of fraction digits</xsl:text>\r
+ </em>\r
+ <xsl:text> = </xsl:text>\r
+ <xsl:value-of select="$simpleRestrict/xsd:fractionDigits/@value"/>\r
+ </xsl:if>\r
+ </xsl:template>\r
+\r
+ <!--\r
+ Print out the enumeration list for derivations by\r
+ restriction on simple content.\r
+ Param(s):\r
+ simpleRestrict (Node) required\r
+ 'restriction' element\r
+ -->\r
+ <xsl:template name="PrintEnumFacets">\r
+ <xsl:param name="simpleRestrict"/>\r
+\r
+ <xsl:if test="$simpleRestrict/xsd:enumeration">\r
+ <em>value</em>\r
+ <xsl:text> comes from list: {</xsl:text>\r
+\r
+ <xsl:for-each select="$simpleRestrict/xsd:enumeration">\r
+ <xsl:if test="position()!=1">\r
+ <xsl:text>|</xsl:text>\r
+ </xsl:if>\r
+ <xsl:text>'</xsl:text>\r
+ <xsl:value-of select="@value"/>\r
+ <xsl:text>'</xsl:text>\r
+ </xsl:for-each>\r
+\r
+ <xsl:text>}</xsl:text>\r
+ </xsl:if>\r
+ </xsl:template>\r
+\r
+ <!--\r
+ Print out the length property for derivations by\r
+ restriction on simple content.\r
+ Param(s):\r
+ simpleRestrict (Node) required\r
+ 'restriction' element\r
+ -->\r
+ <xsl:template name="PrintLengthFacets">\r
+ <xsl:param name="simpleRestrict"/>\r
+\r
+ <xsl:choose>\r
+ <xsl:when test="$simpleRestrict/xsd:length">\r
+ <em>\r
+ <xsl:text>length</xsl:text>\r
+ </em>\r
+ <xsl:text> = </xsl:text>\r
+ <xsl:value-of select="$simpleRestrict/xsd:length/@value"/>\r
+ </xsl:when>\r
+ <xsl:when test="$simpleRestrict/xsd:minLength">\r
+ <em>\r
+ <xsl:text>length</xsl:text>\r
+ </em>\r
+ <xsl:text> >= </xsl:text>\r
+ <xsl:value-of select="$simpleRestrict/xsd:minLength/@value"/>\r
+ </xsl:when>\r
+ <xsl:when test="$simpleRestrict/xsd:maxLength">\r
+ <em>\r
+ <xsl:text>length</xsl:text>\r
+ </em>\r
+ <xsl:text> <= </xsl:text>\r
+ <xsl:value-of select="$simpleRestrict/xsd:maxLength/@value"/>\r
+ </xsl:when>\r
+ </xsl:choose>\r
+ </xsl:template>\r
+\r
+ <!--\r
+ Print out the whitespace property for derivations by\r
+ restriction on simple content.\r
+ Param(s):\r
+ simpleRestrict (Node) required\r
+ 'restriction' element\r
+ -->\r
+ <xsl:template name="PrintWhitespaceFacet">\r
+ <xsl:param name="simpleRestrict"/>\r
+\r
+ <xsl:variable name="facetValue" select="normalize-space(translate($simpleRestrict/xsd:whiteSpace/@value, 'ACELOPRSV', 'aceloprsv'))"/>\r
+\r
+ <xsl:choose>\r
+ <xsl:when test="$facetValue='preserve'">\r
+ <em>Whitespace policy: </em>\r
+ <xsl:call-template name="PrintGlossaryTermRef">\r
+ <xsl:with-param name="code">PreserveWS</xsl:with-param>\r
+ <xsl:with-param name="term">preserve</xsl:with-param>\r
+ </xsl:call-template>\r
+ </xsl:when>\r
+ <xsl:when test="$facetValue='replace'">\r
+ <em>Whitespace policy: </em>\r
+ <xsl:call-template name="PrintGlossaryTermRef">\r
+ <xsl:with-param name="code">ReplaceWS</xsl:with-param>\r
+ <xsl:with-param name="term">replace</xsl:with-param>\r
+ </xsl:call-template>\r
+ </xsl:when>\r
+ <xsl:when test="$facetValue='collapse'">\r
+ <em>Whitespace policy: </em>\r
+ <xsl:call-template name="PrintGlossaryTermRef">\r
+ <xsl:with-param name="code">CollapseWS</xsl:with-param>\r
+ <xsl:with-param name="term">collapse</xsl:with-param>\r
+ </xsl:call-template>\r
+ </xsl:when>\r
+ </xsl:choose>\r
+ </xsl:template>\r
+\r
+ <!--\r
+ Print out the value ranges for derivations by\r
+ restriction on simple content.\r
+ Param(s):\r
+ simpleRestrict (Node) required\r
+ 'restriction' element\r
+ -->\r
+ <xsl:template name="PrintRangeFacets">\r
+ <xsl:param name="simpleRestrict"/>\r
+\r
+ <xsl:choose>\r
+ <xsl:when test="($simpleRestrict/xsd:minInclusive or $simpleRestrict/xsd:minExclusive) and ($simpleRestrict/xsd:maxInclusive or $simpleRestrict/xsd:maxExclusive)">\r
+ <xsl:choose>\r
+ <xsl:when test="$simpleRestrict/xsd:minInclusive">\r
+ <xsl:value-of select="$simpleRestrict/xsd:minInclusive/@value"/>\r
+ <xsl:text> <= </xsl:text>\r
+ </xsl:when>\r
+ <xsl:otherwise>\r
+ <xsl:value-of select="$simpleRestrict/xsd:minExclusive/@value"/>\r
+ <xsl:text> < </xsl:text>\r
+ </xsl:otherwise>\r
+ </xsl:choose>\r
+ <em>\r
+ <xsl:text>value</xsl:text>\r
+ </em>\r
+ <xsl:choose>\r
+ <xsl:when test="$simpleRestrict/xsd:maxInclusive">\r
+ <xsl:text> <= </xsl:text>\r
+ <xsl:value-of select="$simpleRestrict/xsd:maxInclusive/@value"/>\r
+ </xsl:when>\r
+ <xsl:otherwise>\r
+ <xsl:text> < </xsl:text>\r
+ <xsl:value-of select="$simpleRestrict/xsd:maxExclusive/@value"/>\r
+ </xsl:otherwise>\r
+ </xsl:choose>\r
+ </xsl:when>\r
+ <xsl:when test="$simpleRestrict/xsd:minInclusive">\r
+ <em>\r
+ <xsl:text>value</xsl:text>\r
+ </em>\r
+ <xsl:text> >= </xsl:text>\r
+ <xsl:value-of select="$simpleRestrict/xsd:minInclusive/@value"/>\r
+ </xsl:when>\r
+ <xsl:when test="$simpleRestrict/xsd:minExclusive">\r
+ <em>\r
+ <xsl:text>value</xsl:text>\r
+ </em>\r
+ <xsl:text> > </xsl:text>\r
+ <xsl:value-of select="$simpleRestrict/xsd:minExclusive/@value"/>\r
+ </xsl:when>\r
+ <xsl:when test="$simpleRestrict/xsd:maxInclusive">\r
+ <em>\r
+ <xsl:text>value</xsl:text>\r
+ </em>\r
+ <xsl:text> <= </xsl:text>\r
+ <xsl:value-of select="$simpleRestrict/xsd:maxInclusive/@value"/>\r
+ </xsl:when>\r
+ <xsl:when test="$simpleRestrict/xsd:maxExclusive">\r
+ <em>\r
+ <xsl:text>value</xsl:text>\r
+ </em>\r
+ <xsl:text> < </xsl:text>\r
+ <xsl:value-of select="$simpleRestrict/xsd:maxExclusive/@value"/>\r
+ </xsl:when>\r
+ </xsl:choose>\r
+ </xsl:template>\r
+\r
+ <!--\r
+ Prints out JavaScript code.\r
+ NOTE: Javascript code is placed within comments to make it\r
+ work with current browsers. In strict XHTML, JavaScript code \r
+ should be placed within CDATA sections. However, most\r
+ browsers generate a syntax error if the page contains \r
+ CDATA sections. Placing Javascript code within comments\r
+ means that the code cannot contain two dashes.\r
+ Param(s):\r
+ code (Result Tree Fragment) required\r
+ Javascript code\r
+ -->\r
+ <xsl:template name="PrintJSCode">\r
+ <xsl:param name="code"/>\r
+\r
+ <script type="text/javascript">\r
+ <!-- If browsers start supporting CDATA sections, \r
+ uncomment the following piece of code. -->\r
+ <!-- <xsl:text disable-output-escaping="yes">\r
+<![CDATA[\r
+</xsl:text> -->\r
+ <!-- If browsers start supporting CDATA sections, \r
+ remove the following piece of code. -->\r
+ <xsl:text disable-output-escaping="yes">\r
+<!--\r
+</xsl:text>\r
+\r
+ <xsl:value-of select="$code" disable-output-escaping="yes"/>\r
+ <!-- If browsers start supporting CDATA sections, \r
+ remove the following piece of code. -->\r
+ <xsl:text disable-output-escaping="yes">\r
+// -->\r
+</xsl:text>\r
+ <!-- If browsers start supporting CDATA sections, \r
+ uncomment the following piece of code. -->\r
+ <!-- <xsl:text disable-output-escaping="yes">\r
+]]>\r
+</xsl:text> -->\r
+ </script>\r
+ </xsl:template>\r
+\r
+ <!--\r
+ Translates occurrences of a string\r
+ in a piece of text with another string.\r
+ Param(s):\r
+ value (String) required\r
+ Text to translate\r
+ strToReplace (String) required\r
+ String to be replaced\r
+ replacementStr (String) required\r
+ Replacement text\r
+ -->\r
+ <xsl:template name="TranslateStr">\r
+ <xsl:param name="value"/>\r
+ <xsl:param name="strToReplace"/>\r
+ <xsl:param name="replacementStr"/>\r
+\r
+ <xsl:if test="$value != ''">\r
+ <xsl:variable name="beforeText" select="substring-before($value, $strToReplace)"/>\r
+ <xsl:choose>\r
+ <xsl:when test="$beforeText != ''">\r
+ <xsl:value-of select="$beforeText"/>\r
+ <xsl:value-of select="$replacementStr"/>\r
+ <xsl:call-template name="TranslateStr">\r
+ <xsl:with-param name="value" select="substring-after($value, $strToReplace)"/>\r
+ <xsl:with-param name="strToReplace" select="$strToReplace"/>\r
+ <xsl:with-param name="replacementStr" select="$replacementStr"/>\r
+ </xsl:call-template>\r
+ </xsl:when>\r
+ <xsl:otherwise>\r
+ <xsl:value-of select="$value"/>\r
+ </xsl:otherwise>\r
+ </xsl:choose>\r
+ </xsl:if>\r
+ </xsl:template>\r
+\r
+ <xsl:template name="HandleError">\r
+ <xsl:param name="errorMsg"/>\r
+ <xsl:param name="isTerminating">false</xsl:param>\r
+\r
+ <xsl:choose>\r
+ <xsl:when test="$isTerminating='true'">\r
+ <xsl:message terminate="yes">\r
+ <xsl:text>XS3P ERROR: </xsl:text>\r
+ <xsl:value-of select="$errorMsg"/>\r
+ </xsl:message>\r
+ </xsl:when>\r
+ <xsl:otherwise>\r
+ <span style="font-weight: bold; color: red">\r
+ <xsl:text>ERROR: </xsl:text>\r
+ <xsl:value-of select="$errorMsg"/>\r
+ </span>\r
+ </xsl:otherwise>\r
+ </xsl:choose>\r
+ </xsl:template>\r
+</xsl:stylesheet>\r