summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris St. Pierre <chris.a.st.pierre@gmail.com>2012-12-10 17:19:54 -0600
committerChris St. Pierre <chris.a.st.pierre@gmail.com>2012-12-10 17:22:38 -0600
commit9d6e6241954d001a5b49e4ea9a48c10e2a792958 (patch)
tree270309c0e04eacf2ce1e0d6cc6d61f1485899c0a
parent7dcb468f09781bacf79823748ef12bfbd1faeb21 (diff)
downloadbcfg2-9d6e6241954d001a5b49e4ea9a48c10e2a792958.tar.gz
bcfg2-9d6e6241954d001a5b49e4ea9a48c10e2a792958.tar.bz2
bcfg2-9d6e6241954d001a5b49e4ea9a48c10e2a792958.zip
generate XML schema docs from XML schemas themselves
-rw-r--r--doc/client/tools/actions.txt22
-rw-r--r--doc/client/tools/yum.txt45
-rw-r--r--doc/conf.py11
-rw-r--r--doc/exts/xmlschema.py810
-rw-r--r--doc/server/genshi-xml.txt24
-rw-r--r--doc/server/index.txt1
-rw-r--r--doc/server/info.txt100
-rw-r--r--doc/server/plugins/generators/packages.txt216
-rw-r--r--doc/server/plugins/generators/pkgmgr.txt91
-rw-r--r--doc/server/plugins/generators/rules.txt479
-rw-r--r--doc/server/plugins/generators/semodules.txt9
-rw-r--r--doc/server/plugins/generators/sslca.txt90
-rw-r--r--doc/server/plugins/grouping/metadata.txt236
-rw-r--r--doc/server/plugins/structures/bundler/index.txt2
-rw-r--r--doc/unsorted/writing_specification.txt102
-rw-r--r--schemas/bundle.xsd68
-rw-r--r--schemas/clients.xsd161
-rw-r--r--schemas/deps.xsd21
-rw-r--r--schemas/fileprobes.xsd12
-rw-r--r--schemas/genshi.xsd290
-rw-r--r--schemas/info.xsd127
-rw-r--r--schemas/metadata.xsd165
-rw-r--r--schemas/nagiosgen.xsd12
-rw-r--r--schemas/packages.xsd219
-rw-r--r--schemas/pkglist.xsd86
-rw-r--r--schemas/pkgtype.xsd316
-rw-r--r--schemas/rules.xsd114
-rw-r--r--schemas/selinux.xsd302
-rw-r--r--schemas/servicetype.xsd102
-rw-r--r--schemas/sslca-cert.xsd167
-rw-r--r--schemas/sslca-key.xsd76
-rw-r--r--schemas/types.xsd420
-rw-r--r--schemas/xs3p.xsl8503
-rwxr-xr-xsetup.py109
-rw-r--r--src/lib/Bcfg2/Client/Tools/POSIX/Hardlink.py1
-rw-r--r--src/lib/Bcfg2/Client/Tools/VCS.py7
-rw-r--r--src/lib/Bcfg2/Server/Plugins/Metadata.py12
-rw-r--r--testsuite/Testschema/test_schema.py36
-rw-r--r--testsuite/Testsrc/Testlib/TestServer/TestPlugins/TestMetadata.py3
39 files changed, 3558 insertions, 10009 deletions
diff --git a/doc/client/tools/actions.txt b/doc/client/tools/actions.txt
index 49488dfbe..81486ecd1 100644
--- a/doc/client/tools/actions.txt
+++ b/doc/client/tools/actions.txt
@@ -23,24 +23,7 @@ so they can be centrally observed. Actions look like:
status='ignore|check'
build='true|false'/>
-+-----------+------------------+-------------------------------------------+
-| Attribute | Values | Meaning |
-+===========+==================+===========================================+
-| timing | pre, post, both | When the action is run |
-+-----------+------------------+-------------------------------------------+
-| name | freeform | action name |
-+-----------+------------------+-------------------------------------------+
-| command | freeform | command text |
-+-----------+------------------+-------------------------------------------+
-| when | always, modified | If the action is always run, or only when |
-| | | a bundle should be or has been modified |
-+-----------+------------------+-------------------------------------------+
-| status | ignore, check | If the return code of the action |
-| | | should be reported or not |
-+-----------+------------------+-------------------------------------------+
-| build | true, false | Also execute the action in build mode |
-| | | (default: true) |
-+-----------+------------------+-------------------------------------------+
+.. xml:type:: ActionType
Note that the status attribute tells the bcfg2 client to ignore
return status, causing failures to still not be centrally reported. If
@@ -65,7 +48,8 @@ Then a corresponding entry must be included in the Rules directory, like:
.. code-block:: xml
<Rules priority='0'>
- <Action timing='post' when='modified' name='action_name' command='/path/to/command arg1 arg2' status='ignore'/>
+ <Action timing='post' when='modified' name='action_name'
+ command='/path/to/command arg1 arg2' status='ignore'/>
</Rules>
This allows different clients to get different actions as a part of the
diff --git a/doc/client/tools/yum.txt b/doc/client/tools/yum.txt
index 10c3cf725..47ef3d5e9 100644
--- a/doc/client/tools/yum.txt
+++ b/doc/client/tools/yum.txt
@@ -298,46 +298,19 @@ not in the clients configuration.
Ignoring Files during Verification
----------------------------------
-Ignore Tag
-^^^^^^^^^^
-
-The Ignore tag in Pkgmgr is used to "mask out" individual files from
-the RPM verification. This is done by comparing the verification
-failure results with the Ignore tag name. If there is a match, that
-entry is not used by the client to determine if a package has failed
+The :ref:`path-ignore` Path tag is used to exempt individual files
+from the RPM verification. This is done by comparing the verification
+failure results with the ignore Path. If there is a match, that entry
+is not used by the client to determine if a package has failed
verification.
-Ignore tag entries can be specified at both the Package level, in which
-case they apply to all Instances, and/or at the Instance level, in which
-case they only apply to that instance.
-
-Ignore tag entries are used by the RPM driver. They can be specified
-in both old and new style Pkgmgr files.
-
-The Ignore Tag supports the following attributes:
-
-+-----------+-------------+--------+
-| Attribute | Description | Values |
-+===========+=============+========+
-| name | File name. | String |
-+-----------+-------------+--------+
-
-Example
-
-.. code-block:: xml
-
- <Package name='glibc' type='rpm'>
- <Ignore name='/etc/rpc'/>
- <Instance simplefile='glibc-2.3.4-2.25.x86_64.rpm' version='2.3.4' release='2.25' arch='x86_64'/>
- </Package>
+Path ignore entries can be specified at both the Package level, in
+which case they apply to all Instances, and/or at the Instance level,
+in which case they only apply to that instance.
-POSIX 'ignore' Path entries
-^^^^^^^^^^^^^^^^^^^^^^^^^^^
+See :ref:`path-ignore` for more details.
-The YUM analog to the Ignore Tag used by RPM is the use of Path
-entries of type 'ignore'. The following shows an example for the
-centos-release package which doesn't verify if you remove the default
-repos and replace them with a custom repo.
+Example:
.. code-block:: xml
diff --git a/doc/conf.py b/doc/conf.py
index ab011b2a5..0b88ddf2f 100644
--- a/doc/conf.py
+++ b/doc/conf.py
@@ -21,6 +21,7 @@ import time
# documentation root, use os.path.abspath to make it absolute, like shown here.
sys.path.insert(0, os.path.abspath('../src/lib'))
sys.path.insert(0, os.path.abspath('..'))
+sys.path.insert(0, os.path.abspath('exts'))
# -- General configuration -----------------------------------------------------
@@ -30,11 +31,15 @@ sys.path.insert(0, os.path.abspath('..'))
# Add any Sphinx extension module names here, as strings. They can be extensions
# coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
extensions = ['sphinx.ext.autodoc', 'sphinx.ext.doctest',
- 'sphinx.ext.intersphinx', 'sphinx.ext.viewcode']
+ 'sphinx.ext.intersphinx', 'sphinx.ext.viewcode',
+ 'xmlschema']
# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']
+# Path to XML schemas
+xmlschema_path = "../schemas"
+
# The suffix of source filenames.
source_suffix = '.txt'
@@ -288,6 +293,7 @@ private_re = re.compile(r'^\s*\.\.\s*private-include:\s*(.+)$')
private_include = []
+
def skip_member_from_docstring(app, what, name, obj, skip, options):
""" since sphinx 1.0 autodoc doesn't support the :private-members:
directive, this function allows you to specify
@@ -308,7 +314,7 @@ def skip_member_from_docstring(app, what, name, obj, skip, options):
if match:
private_include.extend(re.split(r',\s*', match.group(1)))
return None
-
+
if not skip:
return None
@@ -316,6 +322,7 @@ def skip_member_from_docstring(app, what, name, obj, skip, options):
return False
return None
+
def setup(app):
app.connect('autodoc-skip-member', skip_member_from_docstring)
diff --git a/doc/exts/xmlschema.py b/doc/exts/xmlschema.py
new file mode 100644
index 000000000..fc5788107
--- /dev/null
+++ b/doc/exts/xmlschema.py
@@ -0,0 +1,810 @@
+""" Sphinx extension to generate documention from XML schemas. Known
+to be woefully imcomplete, probably buggy, terrible error handling,
+but it *works* for the subset of XML schema we use in Bcfg2.
+
+Provides the following directives:
+
+* ``.. xml:schema:: <filename>``: Document an XML schema
+* ``.. xml:type:: <name>``: Document a complexType or simpleType
+* ``.. xml:group:: <name>``: Document an element group
+* ``.. xml:attributegroup:: <name>``: Document an attributeGroup
+* ``.. xml:element:: <name>``: Document an XML element
+
+Provides the following roles to link to the objects documented above:
+
+* ``:xml:schema:`<name>```: Link to an XML schema
+* ``:xml:type:`<name>```: Link to a complexType or simpleType
+* ``:xml:group:`<name>```: Link to an element group
+* ``:xml:attributegroup:`<name>```: Link to an attributeGroup
+* ``:xml:element:`<name>```: Link to an element
+* ``:xml:attribute:`<context>:<name>```: Link to the attribute in the
+ given context. The context is the name of the containing object,
+ e.g., the parent attributeGroup, element, or complexType.
+* ``:xml:datatype:`<name>```: Link to a built-in XML data type.
+
+Note that the entity being linked to does not need to have been
+explicitly documented with a directive; e.g., if you document a schema
+that contains a complexType, you can link to that type without having
+used the ``xml:type::`` directive.
+
+Note also that it's far more reliable to link to a complexType than an
+element, since element name collisions are fairly common. You should
+avoid type name collisions whenever possible to maximize usability of
+this extension.
+
+There are two configuration items that may be added to conf.py:
+
+* ``xmlschema_path`` gives the base path to all XML schemas.
+* ``xmlschema_datatype_url`` gives a string pattern that will be used
+ to generate links to built-in XML types. It must contain a single
+ ``%s``, which will be replaced by the name of the type.
+"""
+
+import os
+import operator
+import lxml.etree
+from docutils import nodes
+from sphinx import addnodes, roles
+from docutils.statemachine import ViewList
+from docutils.parsers.rst import directives
+from sphinx.util.nodes import make_refnode, split_explicit_title, \
+ nested_parse_with_titles
+from sphinx.util.compat import Directive
+from sphinx.domains import ObjType, Domain
+
+XS = "http://www.w3.org/2001/XMLSchema"
+XS_NS = "{%s}" % XS
+NSMAP = dict(xs=XS)
+
+
+def comma_split(opt):
+ return opt.split(",")
+
+
+def flag_or_split(opt):
+ try:
+ return opt.split(",")
+ except AttributeError:
+ return True
+
+
+class _XMLDirective(Directive):
+ """ Superclass for the other XML schema directives. """
+ required_arguments = 1
+ option_spec = dict(namespace=directives.unchanged,
+ nochildren=directives.flag,
+ noattributegroups=directives.flag,
+ nodoc=directives.flag,
+ notext=directives.flag,
+ onlyattrs=comma_split,
+ requiredattrs=comma_split,
+ linktotype=flag_or_split,
+ noautodep=flag_or_split,
+ inlinetypes=comma_split)
+ types = []
+
+ def run(self):
+ name = self.arguments[0]
+ env = self.state.document.settings.env
+ ns_name = self.options.get('namespace')
+ try:
+ ns_uri = env.xmlschema_namespaces[ns_name]
+ except KeyError:
+ # URI given as namespace
+ ns_uri = ns_name
+ etype = None
+ for etype in self.types:
+ try:
+ entity = env.xmlschema_entities[ns_uri][etype][name]
+ break
+ except KeyError:
+ pass
+ else:
+ env.app.error("No XML %s %s found" %
+ (" or ".join(self.types), name))
+ documentor = XMLDocumentor(entity, env, self.state, name=name,
+ ns_uri=ns_uri,
+ include=self.process_include(),
+ options=self.process_options())
+ return documentor.document()
+
+ def process_include(self):
+ return dict(children='nochildren' not in self.options,
+ attributegroups='noattributegroups' not in self.options,
+ doc='nodoc' not in self.options,
+ text='notext' not in self.options)
+
+ def process_options(self):
+ return dict(onlyattrs=self.options.get('onlyattrs'),
+ requiredattrs=self.options.get('requiredattrs', []),
+ linktotype=self.options.get('linktotype', []),
+ noautodep=self.options.get('noautodep', False),
+ inlinetypes=self.options.get('inlinetypes', []))
+
+
+def XMLDirective(types):
+ class cls(_XMLDirective):
+ pass
+
+ cls.__name__ = 'XML%sDirective' % types[0]
+ cls.types = types
+ return cls
+
+
+class XMLDocumentor(object):
+ def __init__(self, entity, environment, state, name=None, ns_uri=None,
+ parent=None, include=None, options=None):
+ self.entity = entity
+ self.env = environment
+ self.entities = self.env.xmlschema_entities
+ self.namespaces = self.env.xmlschema_namespaces
+ self.namespaces_by_uri = self.env.xmlschema_namespaces_by_uri
+ self.state = state
+ self.include = include
+ self.options = options
+ self.app = self.env.app
+
+ if name is None:
+ self.ns_uri = ns_uri
+ self.fqname = self.entity.get("name")
+ self.ns_name, self.name = self.split_ns(self.fqname)
+ if self.ns_uri is None and self.ns_name is not None:
+ self.ns_uri = self.namespaces[self.ns_name]
+ else:
+ self.ns_uri = ns_uri
+ self.ns_name = self.namespaces_by_uri[self.ns_uri]
+ self.name = name
+ if self.ns_name:
+ self.fqname = "%s:%s" % (self.ns_name, self.name)
+ else:
+ self.fqname = name
+ self.tname = nodes.strong(self.fqname, self.fqname)
+ self.tag = self.entity.tag[len(XS_NS):]
+ self.type = tag2type(self.tag)
+ self.parent = parent
+ if self.parent is None:
+ self.dependencies = []
+ self.documented = []
+ else:
+ self.dependencies = self.parent.dependencies
+ self.documented = self.parent.documented
+
+ def document(self):
+ eid = (self.tag, self.fqname)
+ if eid in self.documented:
+ return [build_paragraph(get_xref(self.tag, eid[1]))]
+ else:
+ self.documented.append(eid)
+
+ rv = [self.target_node(self.tag, self.ns_name, self.name)]
+
+ data = addnodes.desc(objtype=self.tag)
+ targetid = get_target_id(self.tag, self.ns_name, self.name)
+ header = addnodes.desc_signature('', '',
+ first=True,
+ ids=[targetid])
+
+ if self.include['doc']:
+ header.extend([nodes.emphasis(self.tag, self.tag),
+ text(" "), self.tname])
+ data.append(header)
+ contents = nodes.definition()
+ if self.include['doc']:
+ contents.append(self.get_doc(self.entity))
+ contents.extend(getattr(self, "document_%s" % self.tag)())
+ data.append(contents)
+ rv.append(data)
+
+ if self.parent is None:
+ # avoid adding duplicate dependencies
+ added = [(self.type, self.name)]
+ for typ, name, entity in self.dependencies:
+ if not name:
+ name = entity.get('name')
+ if (typ, name) in added:
+ continue
+ ns_name, name = self.split_ns(name)
+ ns_uri = self.namespaces[ns_name]
+ if not entity:
+ try:
+ entity = self.entities[ns_uri][typ][name]
+ except KeyError:
+ self.app.warn("Dependency %s not found in schemas" %
+ get_target_id(typ, ns_name, name))
+ continue
+ doc = self.get_documentor(entity, name=name, ns_uri=ns_uri)
+ rv.extend(doc.document())
+ added.append((typ, name))
+ return rv
+
+ def document_schema(self):
+ element = self.entity.find("xs:element", namespaces=NSMAP)
+ if element is not None:
+ ns, name = self.split_ns(element.get("name"))
+ doc = self.get_documentor(element, name=name,
+ ns_uri=self.namespaces[ns])
+ return doc.document()
+ else:
+ # no top-level element or group -- just a list of
+ # (abstract) complexTypes?
+ rv = []
+ for ctype in self.entity.findall("xs:complexType",
+ namespaces=NSMAP):
+ ns, name = self.split_ns(ctype.get("name"))
+ doc = self.get_documentor(ctype, name=name,
+ ns_uri=self.namespaces[ns])
+ rv.extend(doc.document())
+ return rv
+
+ def document_group(self):
+ rv = nodes.definition_list()
+ try:
+ (children, groups) = \
+ self.get_child_elements(self.entity, nodeclass=nodes.paragraph)
+ except TypeError:
+ return [build_paragraph(nodes.strong("Any", "Any"),
+ " arbitrary element allowed")]
+
+ append_node(rv, nodes.term, text("Elements:"))
+ append_node(rv, nodes.definition, *children)
+ if len(groups):
+ append_node(rv, nodes.term, text("Element groups:"))
+ append_node(rv, nodes.definition, *groups)
+ return rv
+
+ def document_element(self):
+ fqtype = self.entity.get("type")
+ if fqtype:
+ (etype_ns, etype) = self.split_ns(fqtype)
+ ns_uri = self.get_namespace_uri(etype_ns)
+ values = self.get_values_from_type()
+ if values != "Any":
+ return [build_paragraph(
+ self.tname,
+ " takes only text content, which may be the ",
+ "following values: ",
+ values)]
+ elif etype in self.entities[ns_uri]["complexType"]:
+ if ((self.options['linktotype'] is True or
+ self.name in self.options['linktotype'] or
+ etype in self.options['linktotype'] or
+ fqtype in self.options['linktotype']) and
+ self.name not in self.options['inlinetypes'] and
+ etype not in self.options['inlinetypes']):
+ self.add_dep('complexType', fqtype, None)
+ return [build_paragraph("Type: ",
+ get_xref("type", fqtype))]
+
+ typespec = self.entities[ns_uri]["complexType"][etype]
+ doc = self.get_documentor(typespec,
+ name=self.entity.get("name"))
+ rv = [self.target_node("complexType", etype_ns, etype)]
+ if self.include['doc'] and not self.get_doc(self.entity):
+ rv.append(self.get_doc(typespec))
+ rv.extend(doc.document_complexType())
+ return rv
+ else:
+ self.app.error("Unknown element type %s" % fqtype)
+ else:
+ rv = []
+ typespec = self.entity.find("xs:complexType", namespaces=NSMAP)
+ if self.include['doc'] and not self.get_doc(self.entity):
+ rv.append(self.get_doc(typespec))
+ if typespec is not None:
+ rv = [self.target_node("complexType", self.ns_name, self.name)]
+ doc = self.get_documentor(typespec)
+ rv.extend(doc.document_complexType())
+ return rv
+
+ def document_complexType(self):
+ rv = nodes.definition_list()
+
+ ##### ATTRIBUTES #####
+ table, tbody = self.get_attr_table()
+ attrs = self.get_attrs(self.entity)
+ if attrs:
+ tbody.extend(attrs)
+
+ foreign_attr_groups = nodes.bullet_list()
+ for agroup in self.entity.xpath("xs:attributeGroup",
+ namespaces=NSMAP):
+ # if the attribute group is in another namespace, just
+ # link to it
+ ns, name = self.split_ns(agroup.get('ref'))
+ if ns != self.ns_name:
+ append_node(
+ foreign_attr_groups,
+ nodes.list_item,
+ build_paragraph(get_xref(tag2type("attributeGroup"),
+ ":".join([ns, name]))))
+ else:
+ tbody.extend(self.get_attrs(
+ self.entities['attributeGroup'][name]))
+
+ if len(tbody):
+ append_node(rv, nodes.term, text("Attributes:"))
+ append_node(rv, nodes.definition, table)
+ if self.include['attributegroups'] and len(foreign_attr_groups):
+ append_node(rv, nodes.term, text("Attribute groups:"))
+ append_node(rv, nodes.definition, foreign_attr_groups)
+
+ ##### ELEMENTS #####
+ if self.include['children']:
+ # todo: distinguish between elements that may occur and
+ # elements that must occur
+ try:
+ (children, groups) = self.get_child_elements(self.entity)
+ except TypeError:
+ children = None
+ groups = None
+ rv.append(build_paragraph(nodes.strong("Any", "Any"),
+ " arbitrary child elements allowed"))
+ if children:
+ append_node(rv, nodes.term, text("Child elements:"))
+ append_node(rv, nodes.definition,
+ build_node(nodes.bullet_list, *children))
+
+ if groups:
+ append_node(rv, nodes.term, text("Element groups:"))
+ append_node(rv, nodes.definition, *groups)
+
+ ##### TEXT CONTENT #####
+ if (self.include['text'] and
+ self.entity.get("mixed", "false").lower() == "true"):
+ append_node(rv, nodes.term, text("Text content:"))
+ append_node(rv, nodes.definition,
+ build_paragraph(self.get_values_from_simpletype()))
+ return [rv]
+
+ def document_attributeGroup(self):
+ attrs = self.get_attrs(self.entity)
+ if attrs:
+ table, tbody = self.get_attr_table()
+ tbody.extend(attrs)
+ return [table]
+ else:
+ return []
+
+ def get_attr_table(self):
+ atable = nodes.table()
+ atgroup = build_node(nodes.tgroup('', cols=5),
+ nodes.colspec(colwidth=10),
+ nodes.colspec(colwidth=50),
+ nodes.colspec(colwidth=20),
+ nodes.colspec(colwidth=10),
+ nodes.colspec(colwidth=10),
+ nodes.thead('',
+ build_table_row("Name", "Description",
+ "Values", "Required",
+ "Default")))
+ atable.append(atgroup)
+ atable_body = nodes.tbody()
+ atgroup.append(atable_body)
+ return (atable, atable_body)
+
+ def get_child_elements(self, el, nodeclass=None):
+ """ returns a tuple of (child element nodes, element group
+ nodes). HOWEVER, if _any_ child is allowed, returns True. """
+ children = []
+ groups = []
+ if nodeclass is None:
+ nodeclass = nodes.list_item
+
+ if el.find("xs:any", namespaces=NSMAP) is not None:
+ return True
+
+ for child in el.findall("xs:element", namespaces=NSMAP):
+ node = nodeclass()
+ if child.get('ref'):
+ node.append(build_paragraph(get_xref('element',
+ child.get('ref'))))
+ else:
+ # child element given inline
+ doc = self.get_documentor(child, name=child.get('name'))
+ node.extend(doc.document())
+ children.append(node)
+
+ for group in el.findall("xs:group", namespaces=NSMAP):
+ if group.get('ref'):
+ name = group.get('ref')
+ node = nodeclass()
+ node.append(build_paragraph(get_xref('group', name)))
+ self.add_dep('group', name, None)
+ groups.append(node)
+ else:
+ rv = self.get_child_elements(group, nodeclass=nodeclass)
+ try:
+ children.extend(rv[0])
+ groups.extend(rv[1])
+ except TypeError:
+ return rv
+
+ for container in el.xpath("xs:all|xs:choice|xs:sequence",
+ namespaces=NSMAP):
+ rv = self.get_child_elements(container, nodeclass=nodeclass)
+ try:
+ children.extend(rv[0])
+ groups.extend(rv[1])
+ except TypeError:
+ return rv
+ return (children, groups)
+
+ def get_documentor(self, entity, name=None, ns_uri=None):
+ if name is None:
+ name = self.name
+ if ns_uri is None:
+ ns_uri = self.ns_uri
+ return XMLDocumentor(entity, self.env, self.state, name=name,
+ ns_uri=ns_uri, parent=self, options=self.options,
+ include=self.include)
+
+ def get_attrs(self, el, context=None):
+ cnode = el
+ while context is None and cnode is not None:
+ context = cnode.get('name')
+ cnode = cnode.getparent()
+
+ rows = []
+ for attr in el.xpath("xs:attribute[@name]", namespaces=NSMAP):
+ name = attr.get("name")
+ if self.ns_name:
+ fqname = "%s:%s" % (self.ns_name, name)
+ else:
+ fqname = name
+ if (self.options['onlyattrs'] and
+ name not in self.options['onlyattrs'] and
+ fqname not in self.options['onlyattrs']):
+ continue
+ tag = attr.tag[len(XS_NS):]
+ row = [build_paragraph(self.target_node(tag, self.ns_name, context,
+ name),
+ nodes.literal(fqname, fqname))]
+ row.append(self.get_doc(attr))
+ if attr.get("type") is not None:
+ row.append(build_paragraph(
+ self.get_values_from_type(entity=attr)))
+ else:
+ atype = attr.find("xs:simpleType", namespaces=NSMAP)
+ if atype:
+ row.append(self.get_values_from_simpletype(atype))
+ else:
+ # todo: warn about no type found
+ pass
+ reqd = 0
+ if (name in self.options['requiredattrs'] or
+ attr.get("use", "optional") == "required"):
+ row.append("Yes")
+ reqd = 1
+ else:
+ row.append("No")
+ default = attr.get("default")
+ if default is None:
+ row.append("None")
+ else:
+ row.append(nodes.literal(default, default))
+ # we record name and required separately to make sorting
+ # easier
+ rows.append((name, reqd, build_table_row(*row)))
+ rows.sort(key=operator.itemgetter(0))
+ rows.sort(key=operator.itemgetter(1), reverse=True)
+ if not self.options['onlyattrs'] or '*' in self.options['onlyattrs']:
+ anyattr = el.find("xs:anyAttribute", namespaces=NSMAP)
+ if anyattr is not None:
+ rows.append((None, None,
+ build_table_row('*', self.get_doc(anyattr),
+ "Any", "No", "None")))
+ return [r[2] for r in rows]
+
+ def get_values_from_type(self, entity=None, typeattr='type'):
+ if entity is None:
+ entity = self.entity
+ ns_name, name = self.split_ns(entity.get(typeattr))
+ ns_uri = self.get_namespace_uri(ns_name, entity=entity)
+ if ns_uri == XS:
+ return self.get_builtin_type(name)
+ elif name in self.entities[ns_uri]['simpleType']:
+ return self.get_values_from_simpletype(
+ self.entities[ns_uri]['simpleType'][name])
+ else:
+ return "Any"
+
+ def get_builtin_type(self, vtype):
+ if vtype == "boolean":
+ return get_value_list(["true", "false"])
+ else:
+ return get_datatype_ref(vtype, vtype,
+ self.app.config.xmlschema_datatype_url)
+
+ def get_doc(self, el):
+ try:
+ return self.parse(el.xpath("xs:annotation/xs:documentation",
+ namespaces=NSMAP)[0].text)
+ except IndexError:
+ return build_paragraph('')
+
+ def parse(self, text):
+ node = nodes.paragraph()
+ vl = ViewList()
+ for line in text.splitlines():
+ vl.append(line, '<xmlschema>')
+ nested_parse_with_titles(self.state, vl, node)
+ try:
+ return node[0]
+ except IndexError:
+ return build_paragraph(text)
+
+ def split_ns(self, name):
+ try:
+ (ns, name) = name.split(":")
+ except ValueError:
+ ns = self.ns_name
+ return (ns, name)
+
+ def get_values_from_simpletype(self, entity=None):
+ if entity is None:
+ entity = self.entity
+ # todo: xs:union, xs:list
+ restriction = entity.find("xs:restriction", namespaces=NSMAP)
+ if restriction is None:
+ return "Any"
+ doc = self.get_doc(restriction)
+ if len(doc) == 1 and len(doc[0]) == 0:
+ # if get_doc returns a paragraph node with an empty Text
+ # node
+ enum = [e.get("value")
+ for e in restriction.findall("xs:enumeration",
+ namespaces=NSMAP)]
+ if len(enum):
+ return get_value_list(enum)
+ else:
+ return self.get_values_from_type(entity=restriction,
+ typeattr='base')
+ else:
+ return doc
+
+ def add_dep(self, typ, name, entity):
+ try:
+ if name in self.options['noautodep']:
+ return
+ except TypeError:
+ if self.options['noautodep']:
+ return
+ self.dependencies.append((typ, name, entity))
+
+ def target_node(self, tag, ns, *extra):
+ targetid = get_target_id(tag, ns, *extra)
+ fqname = targetid[len(tag) + 1:]
+ rv = nodes.target('', '', ids=[targetid])
+ self.add_domain_data(tag2type(tag), fqname,
+ (self.env.docname, targetid))
+ return rv
+
+ def add_domain_data(self, typ, key, data):
+ if key not in self.env.domaindata['xml'][typ]:
+ self.env.domaindata['xml'][typ][key] = data
+
+ def get_namespace_uri(self, ns_name, entity=None):
+ if entity is None:
+ entity = self.entity
+ xs_ns = get_xs_ns(entity)
+ if ns_name == xs_ns:
+ return XS
+ else:
+ return self.namespaces[ns_name]
+
+
+def tag2type(tag):
+ if tag in ['complexType', 'simpleType']:
+ return 'type'
+ elif tag == 'attributeGroup':
+ return 'attributegroup'
+ return tag
+
+
+def text(txt):
+ return nodes.Text(txt, txt)
+
+
+def append_node(parent, cls_or_node, *contents):
+ parent.append(build_node(cls_or_node, *contents))
+
+
+def build_node(cls_or_node, *contents):
+ if isinstance(cls_or_node, type):
+ rv = cls_or_node()
+ else:
+ rv = cls_or_node
+ rv.extend(contents)
+ return rv
+
+
+def get_xref(typ, target, title=None):
+ if title is None:
+ title = target
+ ref = addnodes.pending_xref(title,
+ reftype=typ,
+ refdomain="xml",
+ reftarget=target)
+ ref.append(nodes.literal(title, title))
+ return ref
+
+
+def build_table_row(*vals):
+ rv = nodes.row('')
+ for val in vals:
+ if isinstance(val, nodes.Node):
+ node = val
+ else:
+ node = nodes.paragraph(val, val)
+ rv.append(nodes.entry(node, node))
+ return rv
+
+
+def build_paragraph(*args):
+ """ convenience method to build a paragraph node """
+ rv = nodes.paragraph()
+ for content in args:
+ if isinstance(content, nodes.Node):
+ rv.append(content)
+ else:
+ rv.append(text(content))
+ return rv
+
+
+def get_target_id(etype, ns_name, *extra):
+ if ns_name:
+ return ":".join([etype, ns_name] + list(extra))
+ else:
+ return ":".join([etype] + list(extra))
+
+
+def get_value_list(vals):
+ rv = nodes.paragraph()
+ if vals:
+ rv.append(nodes.literal(vals[0], vals[0]))
+ for i in range(1, len(vals)):
+ rv.append(text(" | "))
+ rv.append(nodes.literal(vals[i], vals[i]))
+ return rv
+
+
+def get_xs_ns(el):
+ return get_namespace_name(el, XS)
+
+
+def get_namespace_name(el, ns_uri):
+ for name, ns in el.nsmap.items():
+ if ns == ns_uri:
+ return name
+ return None
+
+
+def get_datatype_ref(title, target, baseurl):
+ return build_node(nodes.reference('', '', refuri=baseurl % target),
+ nodes.literal(title, title))
+
+
+class XMLDatatypeRole(object):
+ def __init__(self, baseurl):
+ self.baseurl = baseurl
+
+ def __call__(self, name, rawtext, text, lineno, inliner, options={},
+ content=[]):
+ has_explicit_title, title, target = split_explicit_title(text)
+ return [get_datatype_ref(title, target, self.baseurl)], []
+
+
+class XMLXRefRole(roles.XRefRole):
+ def __init__(self, typ, **kwargs):
+ roles.XRefRole.__init__(self, **kwargs)
+ self.type = typ
+
+ def process_link(self, env, refnode, has_explicit_title, title, target):
+ if (self.type == 'attribute' and
+ not has_explicit_title and
+ ':' in title):
+ title = title.split(':')[-1]
+ return roles.XRefRole.process_link(self, env, refnode,
+ has_explicit_title, title, target)
+
+
+class XMLDomain(Domain):
+ name = "xml"
+ label = "XML"
+
+ types = dict(schema=['schema'],
+ type=['complexType', 'simpleType'],
+ group=['group'],
+ attributegroup=['attributeGroup'],
+ element=['element'],
+ attribute=None)
+
+ object_types = dict([(t, ObjType("XML %s" % t.title(), t))
+ for t in types.keys()])
+ directives = dict([(t, XMLDirective(h))
+ for t, h in types.items() if h is not None])
+ roles = dict([(t, XMLXRefRole(t)) for t in types.keys()])
+ dangling_warnings = dict([(t, "unknown XML %s: %%(target)s" % t)
+ for t in types.keys()])
+ initial_data = dict([(t, dict()) for t in types.keys()])
+ data_version = 3
+
+ def clear_doc(self, docname):
+ to_del = []
+ for dtype in self.types.keys():
+ for key, (doc, _) in self.data[dtype].iteritems():
+ if doc == docname:
+ to_del.append((dtype, key))
+ for dtype, key in to_del:
+ del self.data[dtype][key]
+
+ def resolve_xref(self, env, fromdocname, builder, typ, target, node,
+ contnode):
+ if target in self.data[typ]:
+ docname, labelid = self.data[typ][target]
+ else:
+ return None
+ return make_refnode(builder, fromdocname, docname,
+ labelid, contnode)
+
+ def get_objects(self):
+ for dtype in self.types.keys():
+ for name, (docname, tgtid) in self.data[dtype].iteritems():
+ yield (name, name, dtype, docname, tgtid,
+ self.object_types[dtype].attrs['searchprio'])
+
+
+def setup(app):
+ app.add_config_value('xmlschema_path', '.', False)
+ app.add_config_value('xmlschema_datatype_url',
+ 'http://www.w3.org/TR/xmlschema-2/#%s', False)
+ app.add_domain(XMLDomain)
+ app.connect('builder-inited', load_xml_schemas)
+ app.connect('builder-inited', add_xml_datatype_role)
+
+
+def add_xml_datatype_role(app):
+ app.add_role_to_domain('xml', 'datatype',
+ XMLDatatypeRole(app.config.xmlschema_datatype_url))
+
+
+def load_xml_schemas(app):
+ entities = dict()
+ namespaces = dict()
+ namespaces_by_uri = dict()
+ schemapath = os.path.abspath(os.path.join(app.builder.env.srcdir,
+ app.config.xmlschema_path))
+ for root, _, files in os.walk(schemapath):
+ for fname in files:
+ if not fname.endswith(".xsd"):
+ continue
+ path = os.path.join(root, fname)
+ relpath = path[len(schemapath):].strip("/")
+ schema = lxml.etree.parse(path).getroot()
+
+ ns = schema.get("targetNamespace")
+ ns_name = get_namespace_name(schema, ns)
+ if ns_name not in namespaces:
+ namespaces[ns_name] = ns
+ if ns not in namespaces_by_uri:
+ namespaces_by_uri[ns] = ns_name
+
+ if ns not in entities:
+ entities[ns] = dict(schema=dict(),
+ group=dict(),
+ attributeGroup=dict(),
+ element=dict(),
+ simpleType=dict(),
+ complexType=dict())
+ # schemas don't require namespaces to be identified
+ # uniquely, but we let the user identify them either with
+ # or without the namespace
+ entities[None]['schema'][relpath] = schema
+ entities[ns]['schema'][relpath] = schema
+ for entity in schema.xpath("//xs:*[@name]", namespaces=NSMAP):
+ tag = entity.tag[len(XS_NS):]
+ if tag in entities[ns]:
+ entities[ns][tag][entity.get("name")] = entity
+ app.builder.env.xmlschema_namespaces = namespaces
+ app.builder.env.xmlschema_namespaces_by_uri = namespaces_by_uri
+ app.builder.env.xmlschema_entities = entities
diff --git a/doc/server/genshi-xml.txt b/doc/server/genshi-xml.txt
new file mode 100644
index 000000000..3216cc00d
--- /dev/null
+++ b/doc/server/genshi-xml.txt
@@ -0,0 +1,24 @@
+.. -*- mode: rst -*-
+
+.. _xml-genshi-reference:
+
+===============================
+ Genshi XML Template Reference
+===============================
+
+Genshi's XML templating language is used in
+:ref:`server-plugins-structures-bundler-index` for templated bundles.
+The language is described in depth at `Genshi
+<http://genshi.edgewall.org>`_. The XML schema reference follows.
+
+Genshi Tags
+===========
+
+.. xml:group:: genshiElements
+ :namespace: py
+
+Genshi Attributes
+=================
+
+.. xml:attributegroup:: genshiAttrs
+ :namespace: py
diff --git a/doc/server/index.txt b/doc/server/index.txt
index b02b5def8..2ccc9c923 100644
--- a/doc/server/index.txt
+++ b/doc/server/index.txt
@@ -33,3 +33,4 @@ clients.
database
caching
encryption
+ genshi-xml
diff --git a/doc/server/info.txt b/doc/server/info.txt
index 6b74df2ac..b4d1f7113 100644
--- a/doc/server/info.txt
+++ b/doc/server/info.txt
@@ -18,38 +18,13 @@ for owner, read only for group and other). These options, and a few
others, can be overridden through use of ``info.xml`` files. Each
config file directory can have a ``info.xml`` file if needed.
-An ``info.xml`` file consists of a ``<FileInfo>`` tag containing an
-``<Info>`` tag; the following attributes are allowed on the ``<Info>`` tag:
-
-+------------+-----------------+------------------------------------+---------+
-| Field | Possible values | Description | Default |
-+============+=================+====================================+=========+
-| encoding | ascii | base64 | Encoding of the file. Use 'base64' | ascii |
-| | | for binary files | |
-+------------+-----------------+------------------------------------+---------+
-| owner | Any valid user | Sets owner of the file | root |
-+------------+-----------------+------------------------------------+---------+
-| group | Any valid group | Sets group of the file | root |
-+------------+-----------------+------------------------------------+---------+
-| mode | Octal file mode | Sets the mode of the file (or | 0644 |
-| | | 'inherit' | inherits from the files on disk | |
-| | | if set to 'inherit'; deprecated) | |
-+------------+-----------------+------------------------------------+---------+
-| secontext | SELinux context | Sets the SELinux context of the | default |
-| | | '__default__' | file, or sets to the default | |
-| | | context set by policy if set to | |
-| | | '__default__' | |
-+------------+-----------------+------------------------------------+---------+
-| important | true | false | Important entries are installed | false |
-| | | first during client execution | |
-+------------+-----------------+------------------------------------+---------+
-| paranoid | true | false | Backup file before replacement? | true |
-+------------+-----------------+------------------------------------+---------+
-| sensitive | true | false | The contents of sensitive entries | false |
-| | | aren't included in reports | |
-+------------+-----------------+------------------------------------+---------+
-
-A sample info file for CGI script on a web server might look like:
+.. xml:schema:: info.xsd
+ :linktotype:
+ :inlinetypes: InfoType
+ :noautodep: ACLType
+
+A sample ``info.xml`` file for CGI script on a web server might look
+like:
.. code-block:: xml
@@ -57,73 +32,38 @@ A sample info file for CGI script on a web server might look like:
<Info owner="www" group="www" mode="0755"/>
</FileInfo>
-Back to the fstab example again, our final ``Cfg/etc/fstab/`` directory
-might look like::
-
- info.xml
- fstab
- fstab.G50_server
- fstab.G99_fileserver
- fstab.H_host.example.com
-
-See :ref:`server-selinux` for more information on the ``secontext``
-attribute and managing SELinux in general.
-
-``info.xml`` files also have the ability to specify different sets of
-file metadata on a group by group or host by host basis, or by path
-(for files using :ref:`altsrc
-<server-plugins-structures-altsrc>`). These files are XML, and work
-similarly to those used by :ref:`Rules
-<server-plugins-generators-rules>` or :ref:`Bundler
-<server-plugins-structures-bundler-index>`.
-
-The following specifies a different global set of permissions
-(root/sys/0651) than on clients in group webserver or named
-"foo.example.com" (root/root/0652)::
-
- <FileInfo>
- <Client name='foo.example.com'>
- <Info owner='root' group='root' mode='0652'/>
- </Client>
- <Group name='webserver'>
- <Info owner='root' group='root' mode='0652'/>
- </Group>
- <Info owner='root' group='sys' mode='0651'/>
- </FileInfo>
-
-.. versionadded:: 1.2.0
+A more complex example for a template that generates both
+``bcfg2.conf`` and ``bcfg2-web.conf`` might look like this:
-You can also use the ``<Path>`` directive to specify a different set
-of permissions depending on the path of the file::
+.. code-block:: xml
<FileInfo>
<Path name="/etc/bcfg2-web.conf">
<Info owner="root" group="apache" mode="0640"/>
</Path>
<Path name="/etc/bcfg2-web.conf" negate="true">
- <Info owner="root" group="root" mode="0600"/>
+ <Group name="bcfg2-server">
+ <Info owner="bcfg2" group="bcfg2" mode="0600"/>
+ </Group>
+ <Group name="bcfg2-server" negate="true">
+ <Info owner="root" group="root" mode="0600"/>
+ </Group>
</Path>
</FileInfo>
-.. versionadded:: 1.3.0
-
-You can also specify ACLs as children of ``<Info>`` tags in
-``info.xml``. See :ref:`server-plugins-generators-rules-acls` for
-more information on the formatting of ACL tags.
+See :ref:`server-selinux` for more information on the ``secontext``
+attribute and managing SELinux in general.
:info and info files
====================
+.. deprecated:: 1.3.0
+
Historically, Bcfg2 also accepted the use of ``:info`` and ``info``
files, which function the same as ``info.xml``, but are not XML. They
lack the ability to specify different permissions based on client,
group, or path, and cannot be used to specify ACLs, either.
-.. note::
-
- ``:info`` and ``info`` files are deprecated and will be removed in
- a future release.
-
An example ``:info`` or ``info`` file would look like::
owner: www
diff --git a/doc/server/plugins/generators/packages.txt b/doc/server/plugins/generators/packages.txt
index 352c88f43..e45864ef9 100644
--- a/doc/server/plugins/generators/packages.txt
+++ b/doc/server/plugins/generators/packages.txt
@@ -18,14 +18,14 @@ through those channels.
Limiting sources to groups
==========================
-``Packages/sources.xml`` processes ``<Group>`` and ``<Client>`` tags
-just like Bundles. In addition to any groups or clients specified
-that way, clients must
-be a member of the appropriate architecture group as specified in a
-Source stanza. In total, in order for a source to be associated with
-a client, the client must be in one of the magic groups (debian,
-ubuntu, or nexenta), any explicit groups or clients specified in
-``sources.xml``, and any specified architecture groups.
+`sources.xml`_ processes ``<Group>`` and ``<Client>`` tags just like
+Bundles. In addition to any groups or clients specified that way,
+clients must be a member of the appropriate architecture group as
+specified in a Source stanza. In total, in order for a source to be
+associated with a client, the client must be in any explicit groups or
+clients specified in `sources.xml`_, and any specified architecture
+groups. If `"Magic Groups"`_ are enabled, then the client must be a
+member of a matching magic group as well.
Memberships in architecture groups is needed so that Packages can map
software sources to clients. There is no other way to handle this than
@@ -40,7 +40,7 @@ sources.
To recap, a client needs to be a member of the **Architecture**
group and any other groups defined in your
- ``Packages/sources.xml`` file in order for the client to be
+ `sources.xml`_ file in order for the client to be
associated to the proper sources. If you are using
:ref:`server-plugins-generators-packages-magic-groups`, then a
client must also be a member of the appropriate OS group.
@@ -50,8 +50,7 @@ sources.
"Magic Groups"
==============
-.. note:: Magic groups are deprecated in 1.3.0 and will be removed in
- a future release. They are disabled by default.
+.. deprecated:: 1.3.0
Packages has the ability to use a feature known as "magic groups"; it
is the only plugin to use that feature. Most plugins operate based on
@@ -98,70 +97,31 @@ Setup
Three basic steps are required for Packages to work properly.
-#. Create ``Packages/sources.xml``. This file should look
- approximately like the example below, and describes both which
- software repositories should be used, and which clients are eligible
- to use each one.
+#. Create Packages/`sources.xml`_. This file should look
+ approximately like the example below, and describes both which
+ software repositories should be used, and which clients are
+ eligible to use each one.
#. Ensure that clients are members of the proper groups. Each client
- should be a member of one of the magic groups listed above, all of
- the groups listed in the ``sources.xml`` (like ubuntu-intrepid or
- centos-5.2 in the following examples), and one of the architecture
- groups listed in the source configuration (i386, amd64 or x86_64 in
- the following examples). '''Failure to do this will result in the
- source either not applying to the client, or only architecture
- independent packages being made available to the client.'''
+ should be a member of all of the groups listed in the `sources.xml`
+ (like ubuntu-intrepid or centos-5.2 in the following examples), one
+ of the architecture groups listed in the source configuration
+ (i386, amd64 or x86_64 in the following examples), and one of the
+ magic groups listed above, if magic groups are enabled. '''Failure
+ to do this will result in the source either not applying to the
+ client, or only architecture independent packages being made
+ available to the client.'''
#. Add Package entries to bundles.
#. Sit back and relax, as dependencies are resolved, and automatically
added to client configurations.
-Prerequisite Resolution
-=======================
-
-Packages provides a prerequisite resolution mechanism which has no
-analogue in Pkgmgr. During configuration generation, all structures are
-processed. After this phase, but before entry binding, a list of packages
-and the client metadata instance is passed into Packages' resolver. This
-process determines a superset of packages that will fully satisfy
-dependencies of all package entries included in structures, and reports
-any prerequisites that cannot be satisfied. This facility should largely
-remove the need to use the :ref:`Base <server-plugins-structures-base>`
-plugin.
-
-Disabling dependency resolution
--------------------------------
-
-.. versionadded:: 1.1.0
-
-Dependency resolution can be disabled by adding the following setting
-to ``bcfg2.conf`` in the ``packages`` section::
-
- [packages]
- resolver=0
-
-All metadata processing can be disabled as well::
-
- [packages]
- metadata=0
-
-This setting implies disabling the resolver.
-
-Blacklisting faulty dependencies
---------------------------------
-
-If you encounter an issue with faulty dependency resolution due to
-Packages, please file a bug report so that we can fix the problem in
-future releases. In the meantime, you can work around this issue by
-blacklisting the offending Package in your Sources. The blacklist
-element should immediately follow the Component section of your source
-and should look like the following:
+sources.xml
+-----------
-.. code-block:: xml
+``sources.xml`` is where all package sources are configured for the
+Packages plugin. It processes ``<Group>`` and ``<Client>`` tags just like
+Bundles. The primary element in ``sources.xml`` is the Source tag:
- <Blacklist>unwanted-packagename</Blacklist>
-
-If you use the built-in :ref:`Yum config generator
-<generating-client-configs>`, blacklisted packages will be added to
-the ``exclude`` list for the source.
+.. xml:element:: Source
Handling GPG Keys
-----------------
@@ -172,7 +132,7 @@ If you have yum libraries installed, Packages can automatically handle
GPG signing keys for Yum and Pulp repositories. (You do not need to
use the native yum resolver; if yum libraries are available, GPG
signing keys can be handled automatically.) Simply specify the URL to
-the GPG key(s) for a repository in ``sources.xml``:
+the GPG key(s) for a repository with :xml:element:`GPGKey` elements:
.. code-block:: xml
@@ -201,8 +161,9 @@ You can specify arbitrary options to be added to the repository config
on the server side, if you are using the native yum libraries, and on
the client side if you are using the ability of Packages to
automatically generate your Yum config. To do this, add an
-``<Options>`` tag to a Source; all of its attributes will be added
-verbatim to the repository in the generated config. For instance:
+:xml:element:`Options` tag to a :xml:element:`Source`; all of its
+attributes will be added verbatim to the repository in the generated
+config. For instance:
.. code-block:: xml
@@ -212,11 +173,13 @@ verbatim to the repository in the generated config. For instance:
</Source>
If you are using native yum libraries and need to set options only on
-the Bcfg2 server, you can set the ``serveronly`` attribute to "true";
-or, if you need to set options only on the client, you can set the
-``clientonly`` attribute to "true". For instance, if your Bcfg2
-server needed to use a proxy to access a repo, and you wanted to
-expire metadata caches very quickly on the client, you could do:
+the Bcfg2 server, you can set the
+:xml:attribute:`RepoOptionsType:serveronly` attribute to "true"; or,
+if you need to set options only on the client, you can set the
+:xml:attribute:`RepoOptionsType:clientonly` attribute to "true". For
+instance, if your Bcfg2 server needed to use a proxy to access a repo,
+and you wanted to expire metadata caches very quickly on the client,
+you could do:
.. code-block:: xml
@@ -226,12 +189,61 @@ expire metadata caches very quickly on the client, you could do:
<Options clientonly="true" metadata_expire="0"/>
</Source>
+Prerequisite Resolution
+=======================
+
+Packages provides a prerequisite resolution mechanism which has no
+analogue in Pkgmgr. During configuration generation, all structures are
+processed. After this phase, but before entry binding, a list of packages
+and the client metadata instance is passed into Packages' resolver. This
+process determines a superset of packages that will fully satisfy
+dependencies of all package entries included in structures, and reports
+any prerequisites that cannot be satisfied. This facility should largely
+remove the need to use the :ref:`Base <server-plugins-structures-base>`
+plugin.
+
+Disabling dependency resolution
+-------------------------------
+
+.. versionadded:: 1.1.0
+
+Dependency resolution can be disabled by adding the following setting
+to ``bcfg2.conf`` in the ``packages`` section::
+
+ [packages]
+ resolver=0
+
+All metadata processing can be disabled as well::
+
+ [packages]
+ metadata=0
+
+This setting implies disabling the resolver.
+
+Blacklisting faulty dependencies
+--------------------------------
+
+If you encounter an issue with faulty dependency resolution due to
+Packages, please file a bug report so that we can fix the problem in
+future releases. In the meantime, you can work around this issue by
+blacklisting the offending Package in your Sources. The
+:xml:element:`Blacklist` element should immediately follow the
+Component section of your source and should look like the following:
+
+.. code-block:: xml
+
+ <Blacklist>unwanted-packagename</Blacklist>
+
+If you use the built-in :ref:`Yum config generator
+<generating-client-configs>`, blacklisted packages will be added to
+the ``exclude`` list for the source.
+
.. _packages-exampleusage:
Example usage
=============
-Create a ``sources.xml`` file in the Packages directory that looks
+Create a _`sources.xml` file in the Packages directory that looks
something like this:
.. code-block:: xml
@@ -254,12 +266,13 @@ something like this:
.. versionadded:: 1.1.0
The default behavior of the Packages plugin is to not make any
- assumptions about which packages you want to have added automatically
- [#f1]_. For that reason, neither **Recommended** nor **Suggested**
- packages are added as dependencies by default. You will notice
- that the default behavior for apt is to add Recommended packages as
- dependencies. You can configure the Packages plugin to add recommended
- packages by adding the ``recommended`` attribute, e.g.:
+ assumptions about which packages you want to have added
+ automatically [#f1]_. For that reason, neither **Recommended** nor
+ **Suggested** packages are added as dependencies by default. You
+ will notice that the default behavior for apt is to add
+ Recommended packages as dependencies. You can configure the
+ Packages plugin to add recommended packages by adding the
+ :xml:attribute:`SourceType:recommended` attribute, e.g.:
.. code-block:: xml
@@ -270,7 +283,8 @@ something like this:
.. [#f1] Bcfg2 will by default add **Essential** packages to the
client specification. You can disable this behavior by
- setting the ``essential`` attribute to *false*:
+ setting the :xml:attribute:`SourceType:essential`
+ attribute to *false*:
.. code-block:: xml
@@ -295,8 +309,8 @@ Yum sources can be similarly specified:
</Group>
</Sources>
-For sources with a **URL** attribute, the **Version** attribute is
-also necessary.
+For sources with a :xml:attribute:`SourceType:url` attribute, the
+:xml:attribute:`SourceType:version` attribute is also necessary.
:ref:`Pulp sources <pulp-source-support>` are very simple to specify
due to the amount of data that can be queried from Pulp itself:
@@ -388,8 +402,7 @@ download only missing sources.::
[0:3711] bcfg2-admin xcmd Packages.Reload
True
-This is done automatically any time ``Packages/sources.xml`` is
-updated.
+This is done automatically any time `sources.xml`_ is updated.
Availability
============
@@ -397,19 +410,11 @@ Availability
Support for clients using yum and apt is currently available. Support for
other package managers (Portage, Zypper, IPS, etc) remain to be added.
-Validation
-==========
-
-A schema for ``Packages/sources.xml`` is included; ``sources.xml`` can
-be validated using ``bcfg2-lint``.
-
-.. note:: The schema requires that elements be specified in the above order.
-
Package Checking and Verification
=================================
-In order to do disable per-package verification Pkgmgr style, you will
-need to use :ref:`BoundEntries <boundentries>`, e.g.:
+In order to do disable per-package verification, you will need to use
+:ref:`BoundEntries <boundentries>`, e.g.:
.. code-block:: xml
@@ -533,9 +538,9 @@ Package Groups
--------------
Yum package groups are supported by the native Yum libraries. To
-include a package group, use the ``group`` attribute of the
-``Package`` tag. You can use either the short group ID or the long
-group name:
+include a package group, use the :xml:attribute:`PackageType:group`
+attribute of the :xml:element:`Package` tag. You can use either the
+short group ID or the long group name:
.. code-block:: xml
@@ -544,7 +549,7 @@ group name:
By default, only those packages considered the "default" packages in a
group will be installed. You can change this behavior using the
-"type" attribute:
+:xml:attribute:`PackageStructure:type` attribute:
.. code-block:: xml
@@ -558,6 +563,8 @@ Valid values of "type" are:
* ``optional`` or ``all``: Install all packages in the group,
including mandatory, default, and optional packages.
+See :xml:element:`PackageStructure` for details.
+
You can view the packages in a group by category with the ``yum
groupinfo`` command. More information about the different levels can
be found at
@@ -580,7 +587,7 @@ Bcfg2 contains explicit support for repositories managed by Pulp
Due to the amount of data about a repository that can be retrieved
directly from Pulp, the only thing necessary to configure a Pulp repo
-is the repo ID:
+is the repo ID, in :xml:attribute:`SourceType:pulp_id`:
.. code-block:: xml
@@ -668,7 +675,6 @@ TODO list
* Zypper support
* Portage support
-* Explicit version pinning (a la Pkgmgr)
.. _configuration:
@@ -694,7 +700,7 @@ It understands the following directives:
| metadata | Enable metadata processing. Disabling ``metadata`` | Boolean | True |
| | implies disabling ``resolver`` as well. | | |
+-------------+------------------------------------------------------+----------+-----------------------------+
-| yum_config | The path at which to generate Yum configs. | String | /etc/yum.repos.d/bcfg2.repo |
+| yum_config | The path at which to generate Yum configs. | String | /etc/yum.repos.d/bcfg2.repo |
+-------------+------------------------------------------------------+----------+-----------------------------+
| apt_config | The path at which to generate APT configs. | String | /etc/apt/sources.d/bcfg2 |
+-------------+------------------------------------------------------+----------+-----------------------------+
diff --git a/doc/server/plugins/generators/pkgmgr.txt b/doc/server/plugins/generators/pkgmgr.txt
index 0d992685c..ace7c16ef 100644
--- a/doc/server/plugins/generators/pkgmgr.txt
+++ b/doc/server/plugins/generators/pkgmgr.txt
@@ -40,94 +40,9 @@ Group membership may be negated.
Tag Attributes in Pkgmgr
========================
-Package Tag
-^^^^^^^^^^^
-
-The package tag supports the name and pkg_checks attributes and
-requires the use of Instance tag entries.
-
-+------------+---------------------------------------+------------------------+
-| Attribute | Description | Values |
-+============+=======================================+========================+
-| name | Package name. | String |
-+------------+---------------------------------------+------------------------+
-| pkg_checks | Do the version and rpm verify checks. | true(default) or false |
-+------------+---------------------------------------+------------------------+
-
-Instance Tag and Attributes
-^^^^^^^^^^^^^^^^^^^^^^^^^^^
-
-The instance tag supports the following attributes:
-
-+---------------------+----------------------------+--------------------------+
-| Attribute | Description | Values |
-+=====================+============================+==========================+
-| simplefile | Package file name. | String (see Notes below) |
-+---------------------+----------------------------+--------------------------+
-| epoch | Package epoch. | String (numeric only) |
-| | | (optional) |
-+---------------------+----------------------------+--------------------------+
-| version | Package version. | String |
-+---------------------+----------------------------+--------------------------+
-| release | Package release. | String |
-+---------------------+----------------------------+--------------------------+
-| arch | Package architecture. | Architecture String e.g. |
-| | | (i386|i586|i686|x86_64) |
-+---------------------+----------------------------+--------------------------+
-| verify_flags | Comma separated list of | nodeps, nodigest, |
-| | rpm --verify options. See | nofiles, noscripts, |
-| | the rpm man page for their | nosignature, nolinkto, |
-| | details. | nomd5, nosize, nouser, |
-| | | nogroup, nomtime, |
-| | | nomode, nordev |
-+---------------------+----------------------------+--------------------------+
-| pkg_verify | Do the rpm verify | true(default) or false |
-+---------------------+----------------------------+--------------------------+
-| install_action | Install package instance | install(default) or none |
-| | if it is not installed. | |
-+---------------------+----------------------------+--------------------------+
-| version_fail_action | Upgrade package if the | upgrade(default) or none |
-| | incorrect version is | |
-| | installed. | |
-+---------------------+----------------------------+--------------------------+
-| verify_fail_action | Reinstall the package | reinstall(default) or |
-| | instance if the rpm verify | none |
-| | failed | |
-+---------------------+----------------------------+--------------------------+
-
-Pkgmgr Group Tag
-----------------
-
-The Pkgmgr Group Tag may have the following attributes:
-
-+--------+----------------------------------------------+------------+
-| Name | Description | Values |
-+========+==============================================+============+
-| name | Group Name | String |
-+--------+----------------------------------------------+------------+
-| negate | Negate group membership (is not a member of) | True|False |
-+--------+----------------------------------------------+------------+
-
-
-Client Tag
-----------
-
-The Client Tag is used in a PackageList for selecting the package entries
-to include in the clients literal configuration. Its function is similar
-to the Group tag in this context. It can be thought of as::
-
- if client is name then
- assign to literal config
-
-The Client Tag may have the following attributes:
-
-+--------+----------------------------------------------+------------+
-| Name | Description | Values |
-+========+==============================================+============+
-| name | Client Name | String |
-+--------+----------------------------------------------+------------+
-| negate | Negate client selection (if not client name) | True|False |
-+--------+----------------------------------------------+------------+
+.. xml:schema:: pkglist.xsd
+ :linktotype:
+ :noautodep: PackageType
Pkgmgr Directory
================
diff --git a/doc/server/plugins/generators/rules.txt b/doc/server/plugins/generators/rules.txt
index ba188ae5c..a3f29a803 100644
--- a/doc/server/plugins/generators/rules.txt
+++ b/doc/server/plugins/generators/rules.txt
@@ -12,6 +12,9 @@ The Rules plugin resolves the following Abstract Configuration Entities:
* Package
* Path
* Action
+* All SELinux entries
+* POSIXUser
+* POSIXGroup
to literal configuration entries suitable for the client drivers to
consume.
@@ -53,121 +56,27 @@ entry specified.
Rules Tag
---------
-The Rules Tag may have the following attributes:
-
-+----------+-------------------------------------+--------+
-| Name | Description | Values |
-+==========+=====================================+========+
-| priority | Sets the priority for Rules in this | String |
-| | Rules list.The higher value wins. | |
-+----------+-------------------------------------+--------+
-
-Group Tag
----------
-
-The Group Tag may have the following attributes:
-
-+--------+-------------------------+--------------+
-| Name | Description | Values |
-+========+=========================+==============+
-| name | Group Name | String |
-+--------+-------------------------+--------------+
-| negate | Negate group membership | (true|false) |
-| | (is not a member of) | |
-+--------+-------------------------+--------------+
-
-Client Tag
-----------
-
-The Client Tag is used in Rules for selecting the package entries to
-include in the clients literal configuration. Its function is similar
-to the Group tag in this context. It can be thought of as::
-
- if client is name then
- assign to literal config
-
-The Client Tag may have the following attributes:
-
-+--------+-------------------------+--------------+
-| Name | Description | Values |
-+========+=========================+==============+
-| name | Client Name | String |
-+--------+-------------------------+--------------+
-| negate | Negate client selection | (true|false) |
-| | (if not client name) | |
-+--------+-------------------------+--------------+
+.. xml:element:: Rules
+ :linktotype:
+ :noautodep:
+ :inlinetypes: PostInstall,RContainerType
Package Tag
-----------
-The Package Tag may have the following attributes:
-
-+------------+----------------------------------------------+----------+
-| Name | Description | Values |
-+============+==============================================+==========+
-| name | Package name | String |
-+------------+----------------------------------------------+----------+
-| version | Package Version or version='noverify' to | String |
-| | not do version checking in the Yum driver | |
-| | only (temporary work a round). | |
-+------------+----------------------------------------------+----------+
-| file | Package file name. Several other attributes | String |
-| | (name, version) can be automatically defined | |
-| | based on regular expressions defined in the | |
-| | Pkgmgr plugin. | |
-+------------+----------------------------------------------+----------+
-| simplefile | Package file name. No name parsing is | String |
-| | performed, so no extra fields get set | |
-+------------+----------------------------------------------+----------+
-| verify | verify='false' - do not do package | String |
-| | verification | |
-+------------+----------------------------------------------+----------+
-| multiarch | Comma separated list of the architectures of | String |
-| | this package that should be installed. | |
-+------------+----------------------------------------------+----------+
-| srcs | Filename creation rules for multiarch | String |
-| | packages. | |
-+------------+----------------------------------------------+----------+
-| type | Package type. (rpm, yum, apt,sysv,blast) | String |
-+------------+----------------------------------------------+----------+
+.. xml:type:: PackageType
Action Tag
----------
-See :ref:`client-tools-actions`
+.. xml:type:: ActionType
+
+See also :ref:`client-tools-actions`.
Service Tag
-----------
-+------------+-------------------------------+---------------------------------------------------------+
-| Name | Description | Values |
-+============+===============================+=========================================================+
-| restart | Whether to restart the | ( true | false | interactive ) |
-| | service when the bundle | |
-| | changes (new in 1.3; replaces | |
-| | "mode" attribute) | |
-+------------+-------------------------------+---------------------------------------------------------+
-| install | Whether to install the | ( true | false ) |
-| | service (new in 1.3; replaces | |
-| | "mode" attribute) | |
-+------------+-------------------------------+---------------------------------------------------------+
-| name | Service name | String |
-+------------+-------------------------------+---------------------------------------------------------+
-| status | Should the service be on or | (on | off | ignore) |
-| | off (default: off). | |
-+------------+-------------------------------+---------------------------------------------------------+
-| target | Service command for restart | String |
-| | (default: restart) | |
-+------------+-------------------------------+---------------------------------------------------------+
-| type | Driver to use on the client | (chkconfig | deb | rc-update | smf | upstart | |
-| | to manage this service. | systemd | freebsd | launchd ) |
-+------------+-------------------------------+---------------------------------------------------------+
-| sequence | Order for service startup | integer |
-| | (debian services only) | |
-+------------+-------------------------------+---------------------------------------------------------+
-| parameters | Pass parameters to service | String |
-| | (Upstart services only) | |
-+------------+-------------------------------+---------------------------------------------------------+
+.. xml:type:: ServiceType
Service mode specification
^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -175,7 +84,8 @@ Service mode specification
.. versionadded:: 1.3.0
In the 1.3.0 release, the "mode" attribute has been replaced by a pair
-of attributes, "restart" and "install," which control how a service is
+of attributes, :xml:attribute:`ServiceType:restart` and
+:xml:attribute:`ServiceType:install`, which control how a service is
handled more granularly than the old "mode" attribute. The old "mode"
attribute values are equivalent as follows:
@@ -197,21 +107,6 @@ Previously, "supervised" could be used to start a service during the
verification phase; this is no longer supported. Services that have
been stopped on a client will be started during the install phase.
-Service status descriptions
-^^^^^^^^^^^^^^^^^^^^^^^^^^^
-
-* on
-
- * start the service at boot time
-
-* off
-
- * don't start the service at boot time
-
-* ignore
-
- * Don't perform service status checks.
-
Path Tag
--------
@@ -227,106 +122,142 @@ the context of the file to the default set by policy. See
Attributes common to all Path tags:
-+----------+-------------+--------+
-| Name | Description | Values |
-+==========+=============+========+
-| name | Full path | String |
-+----------+-------------+--------+
+.. xml:type:: PathType
+ :nochildren:
+ :noattributegroups:
+ :nodoc:
+ :notext:
+ :onlyattrs: name,type
device
^^^^^^
-+-----------+---------------------+-------------------+
-| Name | Description | Values |
-+===========+=====================+===================+
-| dev_type | Type of device | (block|char|fifo) |
-+-----------+---------------------+-------------------+
-| owner | Device owner | String |
-+-----------+---------------------+-------------------+
-| group | Device group | String |
-+-----------+---------------------+-------------------+
-| mode | Mode for the device | String |
-+-----------+---------------------+-------------------+
-| secontext | SELinux context | String |
-+-----------+---------------------+-------------------+
-| major | Major number (block | integer |
-| | or char devices) | |
-+-----------+---------------------+-------------------+
-| minor | Minor number (block | integer |
-| | or char devices) | |
-+-----------+---------------------+-------------------+
+Manage devices.
+
+.. xml:type:: PathType
+ :nochildren:
+ :noattributegroups:
+ :nodoc:
+ :notext:
+ :onlyattrs: dev_type,owner,group,mode,secontext,major,minor
+ :requiredattrs: dev_type,owner,group,mode
directory
^^^^^^^^^
-+-----------+------------------------------+------------+
-| Name | Description | Values |
-+===========+==============================+============+
-| mode | File mode of the directory | String |
-+-----------+------------------------------+------------+
-| owner | Owner of the directory | String |
-+-----------+------------------------------+------------+
-| group | Group Owner of the directory | String |
-+-----------+------------------------------+------------+
-| secontext | SELinux context | String |
-+-----------+------------------------------+------------+
-| prune | prune unspecified entries | true|false |
-| | from the Directory | |
-+-----------+------------------------------+------------+
+Entry represents a directory. :xml:attribute:`PathType:prune` can be
+set to remove all contents from the directory that are not explicitly
+specified in Bcfg2.
+
+.. xml:type:: PathType
+ :nochildren:
+ :noattributegroups:
+ :nodoc:
+ :notext:
+ :onlyattrs: owner,group,mode,secontext,prune
+ :requiredattrs: owner,group,mode
+
+file
+^^^^
+
+Distribute an file with content explicitly specified in-line (i.e., as
+opposed to using :ref:`server-plugins-generators-cfg` for this file).
+If the file has no content, :xml:attribute:`PathType:empty` *must* be
+set to ``true``.
+
+.. xml:type:: PathType
+ :nochildren:
+ :noattributegroups:
+ :nodoc:
+ :onlyattrs: owner,group,mode,secontext,empty
+ :requiredattrs: owner,group,mode
hardlink
^^^^^^^^
-+-----------+------------------------------+--------+
-| Name | Description | Values |
-+===========+==============================+========+
-| to | File to link to | String |
-+-----------+------------------------------+--------+
-| owner | Owner of the directory | String |
-+-----------+------------------------------+--------+
-| group | Group Owner of the directory | String |
-+-----------+------------------------------+--------+
-| secontext | SELinux context | String |
-+-----------+------------------------------+--------+
+Manage a hard link.
+
+.. xml:type:: PathType
+ :nochildren:
+ :noattributegroups:
+ :nodoc:
+ :notext:
+ :onlyattrs: owner,group,mode,secontext,to
+ :requiredattrs: owner,group,mode,to
+
+.. _path-ignore:
+
+ignore
+^^^^^^
+
+``ignore`` lets you flag files that are distributed by system software
+packages, but have been modified locally, to be ignored by package
+verification routines. This is useful for, e.g., a package that
+installs an initial version of a file and then modifies it
+automatically.
+
+.. xml:type:: PathType
+ :nochildren:
+ :noattributegroups:
+ :nodoc:
+ :notext:
+ :onlyattrs: name
+ :requiredattrs: name
nonexistent
^^^^^^^^^^^
-+-----------+--------------------+-------------+
-| Name | Description | Values |
-+===========+====================+=============+
-| type | Type of file | nonexistent |
-+-----------+--------------------+-------------+
-| recursive | Recursively remove | Boolean |
-| | directory contents | |
-+-----------+--------------------+-------------+
+Remove the specified file or directory. If
+:xml:attribute:`PathType:recursive` is set, remove the directory
+recursively (i.e., ``rm -rf``).
+
+.. xml:type:: PathType
+ :nochildren:
+ :noattributegroups:
+ :nodoc:
+ :notext:
+ :onlyattrs: recursive
permissions
^^^^^^^^^^^
-+-----------+-----------------------------+---------+
-| Name | Description | Values |
-+===========+=============================+=========+
-| mode | Mode of the file | String |
-+-----------+-----------------------------+---------+
-| owner | Owner of the file | String |
-+-----------+-----------------------------+---------+
-| group | Group of the file | String |
-+-----------+-----------------------------+---------+
-| secontext | SELinux context | String |
-+-----------+-----------------------------+---------+
-| recursive | Recursively set permissions | Boolean |
-+-----------+-----------------------------+---------+
+Merely set permissions on the specified path, which is presumed to
+already exist.
+
+.. xml:type:: PathType
+ :nochildren:
+ :noattributegroups:
+ :nodoc:
+ :notext:
+ :onlyattrs: owner,group,mode,secontext,recursive
+ :requiredattrs: owner,group,mode
symlink
^^^^^^^
-+------+----------------------+--------+
-| Name | Description | Values |
-+======+======================+========+
-| to | File to link to | String |
-+------+----------------------+--------+
+Manage symlinks.
+
+.. xml:type:: PathType
+ :nochildren:
+ :noattributegroups:
+ :nodoc:
+ :notext:
+ :onlyattrs: to
+ :requiredattrs: to
+
+vcs
+^^^
+
+Check out the specified VCS repository to the given path.
+
+.. xml:type:: PathType
+ :nochildren:
+ :noattributegroups:
+ :nodoc:
+ :notext:
+ :onlyattrs: vcstype,revision,sourceurl
+ :requiredattrs: vcstype,revision,sourceurl
.. _server-plugins-generators-rules-acls:
@@ -346,31 +277,7 @@ child ``<ACL>`` tags. For instance:
<ACL type="default" scope="group" group="users" perms="rx"/>
</Path>
-The ACL tag has the following attributes:
-
-+-------+---------------------------------------------------+----------------+
-| Name | Description | Values |
-+=======+===================================================+================+
-| type | ACL type | default|access |
-+-------+---------------------------------------------------+----------------+
-| scope | ACL scope | user|group |
-+-------+---------------------------------------------------+----------------+
-| user | User the ACL applies to ``(with scope="user"``) | String |
-+-------+---------------------------------------------------+----------------+
-| group | Group the ACL applies to ``(with scope="group"``) | String |
-+-------+---------------------------------------------------+----------------+
-| perms | Permissions for the ACL | See below |
-+-------+---------------------------------------------------+----------------+
-
-The ``perms`` attribute can either be a single octal digit (e.g.,
-``6`` would indicate read and write, but not execute), or a symbolic
-mode including 'r', 'w', and 'x'. You can include '-' for operations
-that are not permitted, but it's not required. I.e., all of the
-following are identical::
-
- perms="5"
- perms="rx"
- perms="r-x"
+.. xml:element:: ACL
It is not currently possible to manually set an effective rights mask;
the mask will be automatically calculated from the given ACLs when
@@ -420,108 +327,49 @@ See :ref:`server-selinux` for more information.
SEBoolean Tag
^^^^^^^^^^^^^
-+-------+----------------------+---------+----------+
-| Name | Description | Values | Required |
-+=======+======================+=========+==========+
-| name | Name of the boolean | String | Yes |
-+-------+----------------------+---------+----------+
-| value | Value of the boolean | on|off | Yes |
-+-------+----------------------+---------+----------+
+.. xml:type:: SEBooleanType
SEPort Tag
^^^^^^^^^^
-+-------------+------------------------+---------------------------+----------+
-| Name | Description | Values | Required |
-+=============+========================+===========================+==========+
-| name | Port number or range | ``<port>/<proto>`` or | Yes |
-| | and protocol (tcp|udp) | ``<start>-<end>/<proto>`` | |
-+-------------+------------------------+---------------------------+----------+
-| selinuxtype | SELinux type to apply | String | Yes |
-| | to this port | | |
-+-------------+------------------------+---------------------------+----------+
+.. xml:type:: SEPortType
SEFcontext Tag
^^^^^^^^^^^^^^
-+-------------+-------------------------+---------------------+----------+
-| Name | Description | Values | Required |
-+=============+=========================+=====================+==========+
-| name | File specification | String | Yes |
-+-------------+-------------------------+---------------------+----------+
-| selinuxtype | SELinux type to apply | String | Yes |
-| | to files matching this | | |
-| | specification | | |
-+-------------+-------------------------+---------------------+----------+
-| filetype | File type to match. | (regular|directory| | No |
-| | Default: all | symlink|pipe|all| | |
-| | | socket|block|char) | |
-+-------------+-------------------------+---------------------+----------+
+.. xml:type:: SEFcontextType
SENode Tag
^^^^^^^^^^
-+-------------+------------------------------------+------------------+----------+
-| Name | Description | Values | Required |
-+=============+====================================+==================+==========+
-| name | IP address and netmask of node. | <addr>/<netmask> | Yes |
-| | Netmask can be numeric (/16) or | | |
-| | dotted-quad (/255.255.0.0) | | |
-+-------------+------------------------------------+------------------+----------+
-| selinuxtype | SELinux type to apply to this node | String | Yes |
-+-------------+------------------------------------+------------------+----------+
-| proto | Protocol | (ipv4|ipv6) | Yes |
-+-------------+------------------------------------+------------------+----------+
+.. xml:type:: SENodeType
SELogin Tag
^^^^^^^^^^^
-+-------------+-------------------------------+-----------+----------+
-| Name | Description | Values | Required |
-+=============+===============================+===========+==========+
-| name | Unix username | String | Yes |
-+-------------+-------------------------------+-----------+----------+
-| selinuxuser | SELinux username | String | Yes |
-+-------------+-------------------------------+-----------+----------+
+.. xml:type:: SELoginType
SEUser Tag
^^^^^^^^^^
-+-------------+-------------------------------+-----------+----------+
-| Name | Description | Values | Required |
-+=============+===============================+===========+==========+
-| name | SELinux username | String | Yes |
-+-------------+-------------------------------+-----------+----------+
-| roles | Space-separated list of roles | String | Yes |
-+-------------+-------------------------------+-----------+----------+
-| prefix | Home directory context prefix | String | Yes |
-+-------------+-------------------------------+-----------+----------+
+.. xml:type:: SEUserType
SEInterface Tag
^^^^^^^^^^^^^^^
-+-------------+-------------------------+-------------+----------+
-| Name | Description | Values | Required |
-+=============+=========================+=============+==========+
-| name | Interface name | String | Yes |
-+-------------+-------------------------+-------------+----------+
-| selinuxtype | SELinux type to apply | String | Yes |
-| | to this interface | | |
-+-------------+-------------------------+-------------+----------+
+.. xml:type:: SEInterfaceType
SEPermissive Tag
^^^^^^^^^^^^^^^^
-+-------------+------------------------------------+-------------+----------+
-| Name | Description | Values | Required |
-+=============+====================================+=============+==========+
-| name | SELinux type to make permissive | String | Yes |
-+-------------+------------------------------------+-------------+----------+
+.. xml:type:: SEPermissiveType
SEModule Tag
^^^^^^^^^^^^
-See :ref:`server-plugins-generators-semodules`
+.. xml:type:: SEModuleType
+
+See also :ref:`server-plugins-generators-semodules`.
POSIXUser Tag
-------------
@@ -534,39 +382,7 @@ POSIXUser Tag
1.3.0 since they require a client tool which is unavailable in
previous versions.
-The POSIXUser tag allows you to create users on client machines. It
-takes the following attributes:
-
-+-------+-----------------------+---------+-------------------------------+
-| Name | Description | Values | Default |
-+=======+=======================+=========+===============================+
-| name | Username | String | None |
-+-------+-----------------------+---------+-------------------------------+
-| uid | User ID number | Integer | The client sets the uid |
-+-------+-----------------------+---------+-------------------------------+
-| group | Name of the user's | String | The username |
-| | primary group | | |
-+-------+-----------------------+---------+-------------------------------+
-| gecos | Human-readable user | String | The username |
-| | name or comment | | |
-+-------+-----------------------+---------+-------------------------------+
-| home | User's home directory | String | /root (for "root"); |
-| | | | /home/<username> otherwise |
-+-------+-----------------------+---------+-------------------------------+
-| shell | User's shell | String | /bin/bash |
-+-------+-----------------------+---------+-------------------------------+
-
-The group specified will automatically be created if it does not
-exist, even if there is no `POSIXGroup Tag`_ for it. If you need to
-specify a particular GID for the group, you must specify that in a
-``POSIXGroup`` tag.
-
-If you with to change the default shell, you can do so with :ref:`the
-Defaults plugin <server-plugins-structures-defaults>`.
-
-Additionally, a user may be a member of supplementary groups. These
-can be specified with the ``MemberOf`` child tag of the ``POSIXUser``
-tag.
+.. xml:type:: POSIXUserType
For example:
@@ -579,6 +395,14 @@ For example:
<MemberOf>bin</MemberOf>
</BoundPOSIXUser>
+The group specified will automatically be created if it does not
+exist, even if there is no :xml:type:`POSIXGroup tag <POSIXGroupType>`
+for it. If you need to specify a particular GID for the group, you
+must specify that in a ``POSIXGroup`` tag.
+
+If you with to change the default shell, you can do so with :ref:`the
+Defaults plugin <server-plugins-structures-defaults>`.
+
See :ref:`client-tools-posixusers` for more information on managing
users and groups.
@@ -593,16 +417,7 @@ POSIXGroup Tag
1.3.0 since they require a client tool which is unavailable in
previous versions.
-The POSIXGroup tag allows you to create groups on client machines. It
-takes the following attributes:
-
-+-------+-------------------+---------+-------------------------+
-| Name | Description | Values | Default |
-+=======+===================+=========+=========================+
-| name | Name of the group | String | None |
-+-------+-------------------+---------+-------------------------+
-| gid | Group ID number | Integer | The client sets the gid |
-+-------+-------------------+---------+-------------------------+
+.. xml:type:: POSIXGroupType
See :ref:`client-tools-posixusers` for more information on managing
users and groups.
diff --git a/doc/server/plugins/generators/semodules.txt b/doc/server/plugins/generators/semodules.txt
index 4466738e6..04d72e139 100644
--- a/doc/server/plugins/generators/semodules.txt
+++ b/doc/server/plugins/generators/semodules.txt
@@ -37,24 +37,23 @@ For more information on this directory layout, see
Entries
=======
-SEModules handles ``<SELinux>`` entries with the ``module`` type. For
-instance:
+SEModules handles ``<SEModule>`` entries. For instance:
.. code-block:: xml
<Bundle name="foo">
- <SELinux type="module" name="foo.pp"/>
+ <SEModule name="foo.pp"/>
</Bundle>
The ``.pp`` extension is optional.
.. note::
- If you use a ``BoundSELinux`` tag, you must *not* include the
+ If you use a ``BoundSEModule`` tag, you must *not* include the
``.pp`` extension. This is not recommend, though.
You can also install a disabled module:
.. code-block:: xml
- <SELinux type="module" name="foo" disabled="true"/>
+ <SEModule name="foo" disabled="true"/>
diff --git a/doc/server/plugins/generators/sslca.txt b/doc/server/plugins/generators/sslca.txt
index cabb4d730..cab7eb233 100644
--- a/doc/server/plugins/generators/sslca.txt
+++ b/doc/server/plugins/generators/sslca.txt
@@ -81,7 +81,7 @@ that CA must contain full (not relative) paths.
something like
``/var/lib/bcfg2/SSLCA/etc/pki/tls/private/localhost.key``.
-#. Within that directory, create a ``key.xml`` file containing the
+#. Within that directory, create a `key.xml`_ file containing the
following:
.. code-block:: xml
@@ -95,7 +95,7 @@ that CA must contain full (not relative) paths.
keytype, or a different number of bits.
#. Similarly, create the matching directory structure for the
- certificate path, and a ``cert.xml`` containinng the following:
+ certificate path, and a `cert.xml`_ containing the following:
.. code-block:: xml
@@ -110,6 +110,8 @@ that CA must contain full (not relative) paths.
using the CA matching the ca attribute. ie. ca="default" will match
[sslca_default] in your ``/etc/bcfg2.conf``
+.. _sslca-configuration:
+
Configuration
=============
@@ -144,67 +146,14 @@ Only ``config`` is required.
cert.xml
--------
-``cert.xml`` is an XML document describing an SSL certificate
-generated from an SSL key that has also been generated by SSLCA. It
-honors ``Group`` and ``Client`` tags much like Bundler. It must have
-a top-level ``CertInfo`` tag and can contain two types of tags:
-
-Cert
-^^^^
-
-The ``Cert`` tag explains how the certificate should be generated.
-There should be at least one ``Cert`` tag, and at most one ``Cert``
-tag should apply to any given client.
-
-+--------------+------------------------------------------+---------+---------+
-| Attribute | Description | Values | Default |
-+==============+==========================================+=========+=========+
-| key | The full path to the key to use for this | String | None |
-| | certificate. This is the only required | | |
-| | attribute. | | |
-+--------------+------------------------------------------+---------+---------+
-| format | The format of cert to produce. Currently | 'pem' | 'pem' |
-| | only pem certificates are supported. | | |
-+--------------+------------------------------------------+---------+---------+
-| ca | The name of the CA (from ``bcfg2.conf``) | String | default |
-| | to use to generate this certificate. | | |
-+--------------+------------------------------------------+---------+---------+
-| days | Time (in days) the certificate should be | Integer | 365 |
-| | valid for | | |
-+--------------+------------------------------------------+---------+---------+
-| c | Override the country set in the CA | String | None |
-| | config | | |
-+--------------+------------------------------------------+---------+---------+
-| l | Override the location set in the CA | String | None |
-| | config | | |
-+--------------+------------------------------------------+---------+---------+
-| st | Override the state set in the CA config | String | None |
-+--------------+------------------------------------------+---------+---------+
-| ou | Override the organizational unit set in | String | None |
-| | the CA config | | |
-+--------------+------------------------------------------+---------+---------+
-| o | Override the organization set in the CA | String | None |
-| | config | | |
-+--------------+------------------------------------------+---------+---------+
-| emailaddress | Override the email address set in the CA | String | None |
-| | config | | |
-+--------------+------------------------------------------+---------+---------+
-| append_chain | Append the CA chain certificate to the | Boolean | False |
-| | certificate (e.g., to produce a cert in | | |
-| | the format required by Nginx) | | |
-+--------------+------------------------------------------+---------+---------+
-
-SubjectAltName
-^^^^^^^^^^^^^^
-
-The ``SubjectAltName`` tag contains text giving a subject alternative
-name for the certificate. Any number of ``SubjectAltName`` tags may
-be used.
+.. xml:schema:: sslca-cert.xsd
+ :linktotype:
+ :inlinetypes: CertType
Example
^^^^^^^
-.. code-block: xml
+.. code-block:: xml
<CertInfo>
<SubjectAltName>test.example.com</SubjectAltName>
@@ -220,29 +169,14 @@ Example
key.xml
-------
-``key.xml`` is an XML document describing an SSL key. It also honors
-``Group`` and ``Client`` tags. It contains a top-level ``KeyInfo``
-tag that contains at least one ``Key`` tag.
-
-Key
-^^^
-
-The ``Cert`` tag explains how the certificate should be generated.
-There should be at least one ``Cert`` tag, and at most one ``Cert``
-tag should apply to any given client.
-
-+--------------+------------------------------------------+---------+---------+
-| Attribute | Description | Values | Default |
-+==============+==========================================+=========+=========+
-| type | The key type | rsa|dsa | 'rsa' |
-+--------------+------------------------------------------+---------+---------+
-| bits | The key length | Integer | 2048 |
-+--------------+------------------------------------------+---------+---------+
+.. xml:schema:: sslca-key.xsd
+ :linktotype:
+ :inlinetypes: KeyType
Example
^^^^^^^
-.. code-block: xml
+.. code-block:: xml
<KeyInfo>
<Group name="fast">
diff --git a/doc/server/plugins/grouping/metadata.txt b/doc/server/plugins/grouping/metadata.txt
index ae4ebfe32..a6ed37f8e 100644
--- a/doc/server/plugins/grouping/metadata.txt
+++ b/doc/server/plugins/grouping/metadata.txt
@@ -10,27 +10,28 @@ The metadata mechanism has two types of information, client metadata
and group metadata. The client metadata describes which top level
group a client is associated with.The group metadata describes groups
in terms of what bundles and other groups they include. Group data and
-clients' memberships are reflected in the ``Metadata/groups.xml`` and
-``Metadata/clients.xml`` files, respectively.
+clients' memberships are reflected in the `groups.xml`_ and
+`clients.xml`_ files, respectively.
Usage of Groups in Metadata
===========================
-Clients are assigned membership of groups in the Metadata descriptions.
-Clients can be directly assigned to *'profile'* or *'public'* groups.
-Client membership of all other groups is by those groups being
-associated with the profile or public groups. This file can be indirectly
-modified from clients through use of the ``-p`` flag to ``bcfg2``.
+Clients are assigned membership of groups in the Metadata
+descriptions. Clients can be directly assigned to *'profile'* or
+*'public'* groups. Client membership of all other groups is by those
+groups being associated with the profile or public groups. This file
+can be indirectly modified from clients through use of the ``-p`` flag
+to ``bcfg2``.
-Clients are associated with profile groups in ``Metadata/clients.xml`` as
-shown below.
+Clients are associated with profile groups in `clients.xml`_
+as shown below.
.. _server-plugins-grouping-metadata-clients-xml:
-Metadata/clients.xml
-====================
+clients.xml
+===========
-The ``Metadata/clients.xml`` file contains the mappings of Profile Groups
+The ``clients.xml`` file contains the mappings of Profile Groups
to clients. The file is just a series of *<Client />* tags, each of which
describe one host. A sample file is below:
@@ -46,63 +47,7 @@ describe one host. A sample file is below:
</Client>
</Clients>
-Clients Tag
------------
-
-The Clients tag has the following possible attributes:
-
-+---------+-----------------------+--------+
-| Name | Description | Values |
-+=========+=======================+========+
-| version | Client schema version | String |
-+---------+-----------------------+--------+
-
-Client Tag
-----------
-
-Each entry in ``clients.xml`` **must** have the following properties:
-
-+---------+---------------------------------------+--------+
-| Name | Description | Values |
-+=========+=======================================+========+
-| name | Host name of client. This needs to be | String |
-| | the name (possibly a FQDN) returned | |
-| | by a reverse lookup on the connecting | |
-| | IP address. | |
-+---------+---------------------------------------+--------+
-| profile | Profile group name to associate this | String |
-| | client with. | |
-+---------+---------------------------------------+--------+
-
-Additionally, the following properties can be specified:
-
-+----------+----------------------------------------+----------------+
-| Name | Description | Values |
-+==========+========================================+================+
-| Alias | Alternative name and address for the | XML Element |
-| | client. | |
-+----------+----------------------------------------+----------------+
-| address | Establishes an extra IP address that | ip address |
-| | resolves to this client. | |
-+----------+----------------------------------------+----------------+
-| floating | Allows requests to come from any IP, | true|false |
-| | rather than requiring requests to come | |
-| | from an IP associated with the client | |
-+----------+----------------------------------------+----------------+
-| password | Establishes a per-node password that | String |
-| | can be used instead of the global | |
-| | password. | |
-+----------+----------------------------------------+----------------+
-| secure | Requires the use of the per-client | true|false |
-| | password for this client. | |
-+----------+----------------------------------------+----------------+
-| uuid | Establishes a per-node name that can | String |
-| | be used to bypass dns-based client | |
-| | resolution. | |
-+----------+----------------------------------------+----------------+
-
-Floating can also be configured by setting ``location="floating"``,
-but that is deprecated.
+.. xml:schema:: clients.xsd
For detailed information on client authentication see
:ref:`appendix-guides-authentication`
@@ -110,47 +55,46 @@ For detailed information on client authentication see
.. _server-plugins-grouping-metadata-clients-database:
Clients Database
-~~~~~~~~~~~~~~~~
+----------------
.. versionadded:: 1.3.0
It is also possible to store client records in a database rather than
-writing back to ``clients.xml``. This provides several advantages:
+writing back to `clients.xml`_. This provides several advantages:
-* ``clients.xml`` will never be written by the server, removing an
+* `clients.xml`_ will never be written by the server, removing an
area of contention between the user and server.
-* ``clients.xml`` can be removed entirely for many sites.
+* `clients.xml`_ can be removed entirely for many sites.
* The Bcfg2 client list can be queried by other machines without
- obtaining and parsing ``clients.xml``.
+ obtaining and parsing `clients.xml`_.
* A single client list can be shared amongst multiple Bcfg2 servers.
In general, storing clients in the database works almost the same as
-``clients.xml``. ``groups.xml`` is parsed identically. If
-``clients.xml`` is present, it is parsed, but ``<Client>`` tags in
-``clients.xml`` *do not* assert client existence; they are only used
+`clients.xml`_. `groups.xml`_ is parsed identically. If
+`clients.xml`_ is present, it is parsed, but ``<Client>`` tags in
+`clients.xml`_ *do not* assert client existence; they are only used
to set client options *if* the client exists (in the database). That
-is, the two purposes of ``clients.xml`` -- to track which clients
+is, the two purposes of `clients.xml`_ -- to track which clients
exist, and to set client options -- have been separated.
-With the improvements in ``groups.xml`` parsing in 1.3, client groups
-can now be set directly in ``groups.xml`` with ``<Client>`` tags. (See
-:ref:`metadata-client-tag` for more details.) As a result,
-``clients.xml`` is only necessary if you need to set
-options (e.g., aliases, floating clients, per-client passwords, etc.)
-on clients.
+With the improvements in `groups.xml`_ parsing in 1.3, client groups
+can now be set directly in `groups.xml`_ with ``<Client>`` tags. (See
+:xml:type:`clientType` for more details.) As a result, `clients.xml`_
+is only necessary if you need to set options (e.g., aliases, floating
+clients, per-client passwords, etc.) on clients.
-To use the database backend instead of ``clients.xml``, set
+To use the database backend instead of `clients.xml`_, set
``use_database`` in the ``[metadata]`` section of ``bcfg2.conf`` to
``true``. You will also need to configure the :ref:`Global Server
Database Settings <server-database>`.
-The ``clients.xml``-based model remains the default.
+The `clients.xml`_-based model remains the default.
-Metadata/groups.xml
-===================
+groups.xml
+==========
-The ``Metadata/groups.xml`` file contains Group and Profile
-definitions. Here's a simple ``Metadata/groups.xml`` file:
+The ``groups.xml`` file contains Group and Profile definitions. Here's
+a simple ``groups.xml`` file:
.. code-block:: xml
@@ -197,8 +141,8 @@ groups; a RHEL 6 client that is a member of the ``mail-server``
profile group would be a member of the ``apache-server``,
``nfs-client``, ``server``, and ``postfix-server`` groups.
-Client tags in ``groups.xml`` allow you to supplement the profile
-group declarations in ``clients.xml`` and/or client group assignments
+Client tags in `groups.xml`_ allow you to supplement the profile
+group declarations in `clients.xml`_ and/or client group assignments
with the :ref:`server-plugins-grouping-grouppatterns` plugin. They
should be used sparingly. (They are more useful when you are using
the database backend for client records.)
@@ -235,101 +179,19 @@ groups:
Nested Group conditionals, Client tags, and negated Group tags are
all new in 1.3.0.
-Order of ``groups.xml`` does not matter.
-
-Groups describe clients in terms for abstract, disjoint aspects. Groups
-can be combined to form complex descriptions of clients that use
-configuration commonality and inheritance. Groups have several attributes,
-described below:
-
-
-Metadata Groups Tag
--------------------
-
-The Groups tag has the following possible attributes:
-
-+----------+---------------------------------+--------+
-| Name | Description | Values |
-+==========+=================================+========+
-| version | Group schema version | String |
-+----------+---------------------------------+--------+
-| origin | URL of master version | String |
-| | (for common repository) | |
-+----------+---------------------------------+--------+
-| revision | Master version control revision | String |
-+----------+---------------------------------+--------+
-
-Metadata Group Tag
-------------------
-
-The Group Tag has the following possible attributes:
-
-+----------+----------------------------------------------+--------------+
-| Name | Description | Values |
-+==========+==============================================+==============+
-| name | Name of the group | String |
-+----------+----------------------------------------------+--------------+
-| profile | If a client can be directly associated with | True|False |
-| | this group | |
-+----------+----------------------------------------------+--------------+
-| public | If a client can freely associate itself with | True|False |
-| | this group. For use with the ``bcfg2 -p`` | |
-| | option on the client. | |
-+----------+----------------------------------------------+--------------+
-| category | A group can only contain one instance of a | String |
-| | group in any one category. This provides the | |
-| | basis for representing groups which are | |
-| | conjugates of one another in a rigorous way. | |
-+----------+----------------------------------------------+--------------+
-| default | Set as the profile to use for clients that | True|False |
-| | are not associated with a profile in | |
-| | ``clients.xml`` | |
-+----------+----------------------------------------------+--------------+
-| comment | English text description of group | String |
-+----------+----------------------------------------------+--------------+
-| negate | When used as a conditional, only apply the | True|False |
-| | children if the named group does not match. | |
-| | When used as a declaration, do not apply | |
-| | the named group to matching clients. | |
-+----------+----------------------------------------------+--------------+
-
-The ``profile``, ``public``, ``category``, ``default``, and
-``comment`` attributes are only parsed if a Group tag either a) is the
-direct child of a Groups tag (i.e., at the top level of an XML file);
-or b) has no children. This matches legacy behavior in Bcfg2 1.2 and
-earlier.
-
-Groups can also contain other groups, clients, and bundles.
-
-.. _metadata-client-tag:
-
-Metadata Client Tag
--------------------
-
-The Client Tag has the following possible attributes:
-
-+----------+-----------------------------------------------+--------------+
-| Name | Description | Values |
-+==========+===============================================+==============+
-| name | Name of the client | String |
-+----------+-----------------------------------------------+--------------+
-| negate | Only apply the child tags if the named client | True|False |
-| | does not match. | |
-+----------+-----------------------------------------------+--------------+
-
-Clients can also contain groups, other clients (although that's likely
-nonsensical), and bundles.
-
-
-Use of XInclude
-===============
+.. xml:schema:: metadata.xsd
+
+
+XInclude
+========
+
+.. versionadded:: 0.9.0
`XInclude <http://www.w3.org/TR/xinclude/>`_ is a W3C specification
-for the inclusion of external XML documents into XML source
-files. Much like the use of ``#include`` in C, this allows complex
-definitions to be split into smaller, more manageable pieces. As of
-bcfg2-0.9.0pre1, the `Metadata`_ plugin supports the use of XInclude
-specifications to split the ``clients.xml`` and ``groups.xml``
+for the inclusion of external XML documents into XML source files,
+allowing complex definitions to be split into smaller, more manageable
+pieces. The `Metadata`_ plugin supports the use of XInclude
+specifications to split the `clients.xml`_ and `groups.xml`_
files. This mechanism allows the following specification to produce
useful results:
@@ -358,7 +220,7 @@ Metadata Caching
Client metadata can be cached in order to improve performance. This
is particularly important if you have lots of templates that use
-metadata from other clients (e.g., with the MetadataQuery interface
+metadata from other clients (e.g., with the `MetadataQuery`_ interface
described below. See :ref:`server-caching` for a full description of
the caching features available.
@@ -393,7 +255,7 @@ A special client metadata class is available to
+------------+------------------------------------------------+---------------+
| connectors | connector plugins known to this client | List |
+------------+------------------------------------------------+---------------+
-| query | MetadataQuery object | MetadataQuery |
+| query | `MetadataQuery`_ object | MetadataQuery |
+------------+------------------------------------------------+---------------+
diff --git a/doc/server/plugins/structures/bundler/index.txt b/doc/server/plugins/structures/bundler/index.txt
index 1cc287ebd..a19959e66 100644
--- a/doc/server/plugins/structures/bundler/index.txt
+++ b/doc/server/plugins/structures/bundler/index.txt
@@ -154,6 +154,8 @@ Several variables are pre-defined inside templates:
groups, you *must* use a Genshi conditional, not a ``<Group>``
tag. The same caveats apply to ``<Client>`` tags.
+See also the :ref:`xml-genshi-reference`.
+
Troubleshooting
---------------
diff --git a/doc/unsorted/writing_specification.txt b/doc/unsorted/writing_specification.txt
index 5a6eec231..700c1ab72 100644
--- a/doc/unsorted/writing_specification.txt
+++ b/doc/unsorted/writing_specification.txt
@@ -38,7 +38,6 @@ configuration is then used to generate the clients literal configuration.
For instance the above abstract configuration entry may generate a
literal configuration of
-
.. code-block:: xml
<Package name='bcfg2' version='0.9.2-0.1' type='yum'/>
@@ -243,105 +242,20 @@ can be used in bundles)
Bundle Tag
^^^^^^^^^^
-The Bundle Tag has the following possible attributes:
-
-+----------+-----------------------------------------+--------+
-| Name | Description | Values |
-+==========+=========================================+========+
-| name | The name of the bundle | String |
-+----------+-----------------------------------------+--------+
-| version | Bundle schema version | String |
-+----------+-----------------------------------------+--------+
-| origin | URL of master version (for common repo) | String |
-+----------+-----------------------------------------+--------+
-| revision | Master version control revision | String |
-+----------+-----------------------------------------+--------+
+.. xml:type:: BundleType
+ :nochildren:
As mentioned above the Configuration Entity Tags may only have the name
attribute in Bundle definitions.
-Abstract Group Tag
-^^^^^^^^^^^^^^^^^^
-
-In the Abstract Configuration plugins (Base and Bundle) the Group Tag
-may have the following attributes:
-
-+--------+------------------------------+---------------+
-| Name | Description | Values |
-+========+==============================+===============+
-| name | Name of group. | String |
-+--------+------------------------------+---------------+
-| negate | Negate the group association | (True|False*) |
-| | (is not a member of) | |
-+--------+------------------------------+---------------+
-
-An abstract group may contain any of the Configuration Entity types and other groups.
-
-Using Base
-^^^^^^^^^^
-
-The Base plugin provides a mechanism to add independent configuration
-entities to a client's abstract configuration. All files in the Base/
-subdirectory of the repository are processed, and all entries that fall
-within the scope of the client metadata are included in its abstract
-configuration.::
-
- $ ls Base/
- centos-4-x86.xml
- fedora-core-4-x86.xml
- rhel-as-4-x86.xml
- rhel-es-4-x86.xml
- rhel-ws-4-x86_64.xml
- rhel-ws-4-x86.xml
-
-.. code-block:: xml
-
- <Base>
- <Group name='Centos4.4-Standard'>
- <Package name='audit'/>
- <Package name='audit-libs'/>
- <Package name='basesystem'/>
- <Package name='bash'/>
- <Package name='bcfg2'/>
- <Package name='beecrypt'/>
- ....
- <Package name='yum'/>
- <Package name='zlib'/>
- <Group name='x86_64'>
- <Package name='systemimager-x86_64initrd_template'/>
- </Group>
- </Group>
- </Base>
-
-The format of the Base files are similar to those used by the Bundler.
-The majority of the elements are usually Packages, but Paths of any type
-may all be defined. A partial example is below:
-
-Base Tag
-^^^^^^^^
-
-The Base Tag has no attributes
-
-As mentioned above the Configuration Entity Tags contained in a Base
-definition may only have the name attribute in Base definitions.
-
-Abstract Group Tag
-^^^^^^^^^^^^^^^^^^
-
-In the Abstract Configuration plugins (Base and Bundle) the Group Tag
-may have the following attributes:
+Group and Client Tags
+^^^^^^^^^^^^^^^^^^^^^
-+--------+------------------------------+---------------+
-| Name | Description | Values |
-+========+==============================+===============+
-| name | Name of group. | String |
-+--------+------------------------------+---------------+
-| negate | Negate the group association | (True|False*) |
-| | (is not a member of) | |
-+--------+------------------------------+---------------+
+.. xml:type:: BundlerGroupType
+ :nochildren:
-An abstract group may contain any of the Configuration Entity types and
-other groups.
+An abstract group may contain any of the Configuration Entity types
+and other groups.
Literal Configuration (Generators)
==================================
diff --git a/schemas/bundle.xsd b/schemas/bundle.xsd
index 1fcf82c27..0fe61e838 100644
--- a/schemas/bundle.xsd
+++ b/schemas/bundle.xsd
@@ -139,7 +139,7 @@
</xsd:documentation>
</xsd:annotation>
</xsd:element>
- <xsd:element name='Group' type='GroupType'>
+ <xsd:element name='Group' type='BundlerGroupType'>
<xsd:annotation>
<xsd:documentation>
Elements within Group tags only apply to clients that are
@@ -148,7 +148,7 @@
</xsd:documentation>
</xsd:annotation>
</xsd:element>
- <xsd:element name='Client' type='GroupType'>
+ <xsd:element name='Client' type='BundlerGroupType'>
<xsd:annotation>
<xsd:documentation>
Elements within Client tags only apply to the named client
@@ -167,21 +167,34 @@
</xsd:choice>
</xsd:group>
- <xsd:complexType name='GroupType'>
+ <xsd:complexType name='BundlerGroupType'>
+ <xsd:annotation>
+ <xsd:documentation>
+ A **BundlerGroupType** is a tag used to provide logic. Child
+ entries of a BundlerGroupType tag only apply to machines that
+ match the condition specified -- either membership in a group,
+ or a matching client name.
+ :xml:attribute:`BundlerGroupType:negate` can be set to negate
+ the sense of the match.
+ </xsd:documentation>
+ </xsd:annotation>
<xsd:choice minOccurs='0' maxOccurs='unbounded'>
<xsd:group ref="bundleElements"/>
</xsd:choice>
<xsd:attribute type='xsd:string' name='name' use='required'>
<xsd:annotation>
- <xsd:documentation>The group name</xsd:documentation>
+ <xsd:documentation>
+ The group name
+ </xsd:documentation>
</xsd:annotation>
</xsd:attribute>
<xsd:attribute type='xsd:string' name='negate'>
<xsd:annotation>
<xsd:documentation>
- Negate the sense of this group; i.e., entries within this
- tag are only used on clients that are not members of the
- group
+ Negate the sense of this group or client; i.e., entries
+ within this tag are only used on clients that are not
+ members of the group, or that have hostnames that do not
+ match.
</xsd:documentation>
</xsd:annotation>
</xsd:attribute>
@@ -192,11 +205,42 @@
<xsd:choice minOccurs='0' maxOccurs='unbounded'>
<xsd:group ref="bundleElements"/>
</xsd:choice>
- <xsd:attribute type='xsd:string' name='description' />
- <xsd:attribute type='xsd:string' name='name'/>
- <xsd:attribute type='xsd:string' name='version'/>
- <xsd:attribute type='xsd:string' name='origin'/>
- <xsd:attribute type='xsd:string' name='revision'/>
+ <xsd:attribute type='xsd:string' name='description'>
+ <xsd:annotation>
+ <xsd:documentation>
+ Freeform description of the bundle.
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:attribute>
+ <xsd:attribute type='xsd:string' name='name' use='required'>
+ <xsd:annotation>
+ <xsd:documentation>
+ The name of the bundle. This must match the bundle
+ filename, minus the extension.
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:attribute>
+ <xsd:attribute type='xsd:string' name='version'>
+ <xsd:annotation>
+ <xsd:documentation>
+ Bundle schema version.
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:attribute>
+ <xsd:attribute type='xsd:anyURI' name='origin'>
+ <xsd:annotation>
+ <xsd:documentation>
+ URL of master version (for common repo)
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:attribute>
+ <xsd:attribute type='xsd:string' name='revision'>
+ <xsd:annotation>
+ <xsd:documentation>
+ Master version control revision.
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:attribute>
<xsd:attributeGroup ref="py:genshiAttrs"/>
<xsd:attribute ref="xml:base"/>
</xsd:complexType>
diff --git a/schemas/clients.xsd b/schemas/clients.xsd
index 3b98c5fc3..20a77b0dd 100644
--- a/schemas/clients.xsd
+++ b/schemas/clients.xsd
@@ -1,44 +1,169 @@
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xml:lang="en">
-
<xsd:annotation>
<xsd:documentation>
- client schema for bcfg2
- Narayan Desai, Argonne National Laboratory
+ Bcfg2 client list schema
</xsd:documentation>
</xsd:annotation>
<xsd:import namespace="http://www.w3.org/XML/1998/namespace"
schemaLocation="xml.xsd"/>
+ <xsd:simpleType name="MetadataAuthEnum">
+ <xsd:restriction base="xsd:token">
+ <xsd:enumeration value="cert+password"/>
+ <xsd:enumeration value="bootstrap"/>
+ <xsd:enumeration value="cert"/>
+ </xsd:restriction>
+ </xsd:simpleType>
+
<xsd:complexType name='ClientType'>
+ <xsd:annotation>
+ <xsd:documentation>
+ Describe a Bcfg2 client machine.
+ </xsd:documentation>
+ </xsd:annotation>
<xsd:choice minOccurs='0' maxOccurs='unbounded'>
<xsd:element name='Alias'>
+ <xsd:annotation>
+ <xsd:documentation>
+ **Alias** allows you to set alternative hostname and IP
+ address pairs that also resolve to this client.
+ </xsd:documentation>
+ </xsd:annotation>
<xsd:complexType>
- <xsd:attribute type='xsd:string' name='name' use='required'/>
- <xsd:attribute type='xsd:string' name='address'/>
+ <xsd:attribute type='xsd:string' name='name' use='required'>
+ <xsd:annotation>
+ <xsd:documentation>
+ Hostname of the alternative client name-address pair.
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:attribute>
+ <xsd:attribute type='xsd:string' name='address'>
+ <xsd:annotation>
+ <xsd:documentation>
+ IP address of the alternative client name-address pair.
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:attribute>
</xsd:complexType>
</xsd:element>
</xsd:choice>
- <xsd:attribute type='xsd:string' name='name' use='required'/>
- <xsd:attribute type='xsd:string' name='profile' use='required'/>
- <xsd:attribute type='xsd:string' name='pingable' use='optional'/>
- <xsd:attribute type='xsd:string' name='auth' use='optional'/>
- <xsd:attribute type='xsd:string' name='uuid'/>
- <xsd:attribute type='xsd:string' name='password'/>
- <xsd:attribute type='xsd:string' name='location'/>
- <xsd:attribute type='xsd:boolean' name='floating'/>
- <xsd:attribute type='xsd:boolean' name='secure'/>
- <xsd:attribute type='xsd:string' name='pingtime' use='optional'/>
- <xsd:attribute type='xsd:string' name='address'/>
- <xsd:attribute type='xsd:string' name='version'/>
+ <xsd:attribute type='xsd:string' name='name' use='required'>
+ <xsd:annotation>
+ <xsd:documentation>
+ Hostname of client. This needs to be the name (probably
+ FQDN) returned by a reverse lookup on the connecting IP
+ address.
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:attribute>
+ <xsd:attribute type='xsd:string' name='profile' use='required'>
+ <xsd:annotation>
+ <xsd:documentation>
+ Profile group naem to associate this client with.
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:attribute>
+ <xsd:attribute type='xsd:string' name='pingable'>
+ <xsd:annotation>
+ <xsd:documentation>
+ Deprecated.
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:attribute>
+ <xsd:attribute type='MetadataAuthEnum' name='auth' default="cert+password">
+ <xsd:annotation>
+ <xsd:documentation>
+ Authentication mode for the client. See
+ :ref:`appendix-guides-authentication` for details on the
+ values available.
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:attribute>
+ <xsd:attribute type='xsd:string' name='uuid'>
+ <xsd:annotation>
+ <xsd:documentation>
+ Establishes a name for this cilent that can be used to
+ bypass dns-based client resolution.
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:attribute>
+ <xsd:attribute type='xsd:string' name='password'>
+ <xsd:annotation>
+ <xsd:documentation>
+ Establishes a per-client password that can be used instead
+ of the global password.
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:attribute>
+ <xsd:attribute type='xsd:string' name='location'>
+ <xsd:annotation>
+ <xsd:documentation>
+ Deprecated. Use :xml:attribute:`ClientType:floating` instead.
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:attribute>
+ <xsd:attribute type='xsd:boolean' name='floating' default="false">
+ <xsd:annotation>
+ <xsd:documentation>
+ Allows requests to come from any IP address, rather than
+ requiring requests to come from an IP associated with this
+ client. Note that, since this forces the Bcfg2 server to
+ trust any connection that claims to be from this hostname,
+ it can introduce security issues.
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:attribute>
+ <xsd:attribute type='xsd:boolean' name='secure' default="false">
+ <xsd:annotation>
+ <xsd:documentation>
+ Requires the use of :xml:attribute:`ClientType:password` for
+ this client.
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:attribute>
+ <xsd:attribute type='xsd:string' name='pingtime'>
+ <xsd:annotation>
+ <xsd:documentation>
+ Deprecated.
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:attribute>
+ <xsd:attribute type='xsd:string' name='address'>
+ <xsd:annotation>
+ <xsd:documentation>
+ Establishes an extra IP address that resolves to this client.
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:attribute>
+ <xsd:attribute type='xsd:token' name='version'>
+ <xsd:annotation>
+ <xsd:documentation>
+ The version of the Bcfg2 client running on this machine.
+ You should not have to set this manually, but can let the
+ Bcfg2 server set it automatically.
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:attribute>
</xsd:complexType>
<xsd:complexType name='ClientsType'>
+ <xsd:annotation>
+ <xsd:documentation>
+ Metadata client list top-level tag
+ </xsd:documentation>
+ </xsd:annotation>
<xsd:choice minOccurs='0' maxOccurs='unbounded'>
<xsd:element name='Client' type='ClientType'/>
<xsd:element name='Clients' type='ClientsType'/>
</xsd:choice>
- <xsd:attribute name='version' type='xsd:string'/>
+ <xsd:attribute name='version' type='xsd:string'>
+ <xsd:annotation>
+ <xsd:documentation>
+ Client schema version
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:attribute>
<xsd:attribute ref="xml:base"/>
</xsd:complexType>
diff --git a/schemas/deps.xsd b/schemas/deps.xsd
index b1400c320..58d19f699 100644
--- a/schemas/deps.xsd
+++ b/schemas/deps.xsd
@@ -1,5 +1,4 @@
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xml:lang="en">
-
<xsd:annotation>
<xsd:documentation>
dependency schema for bcfg2
@@ -7,21 +6,21 @@
</xsd:documentation>
</xsd:annotation>
- <xsd:complexType name='StructureEntry'>
+ <xsd:complexType name='Dependency'>
<xsd:choice minOccurs='0' maxOccurs='unbounded'>
<xsd:element name='Package' type='PackageStructure'/>
- <xsd:element name='Service' type='StructureEntry'/>
- <xsd:element name='Path' type='StructureEntry'/>
+ <xsd:element name='Service' type='Dependency'/>
+ <xsd:element name='Path' type='Dependency'/>
</xsd:choice>
<xsd:attribute type='xsd:string' name='name' use='required'/>
</xsd:complexType>
- <xsd:complexType name='GroupType'>
+ <xsd:complexType name='DepsGroupType'>
<xsd:choice minOccurs='0' maxOccurs='unbounded'>
<xsd:element name='Package' type='PackageStructure'/>
- <xsd:element name='Service' type='StructureEntry'/>
- <xsd:element name='Path' type='StructureEntry'/>
- <xsd:element name='Group' type='GroupType'/>
+ <xsd:element name='Service' type='Dependency'/>
+ <xsd:element name='Path' type='Dependency'/>
+ <xsd:element name='Group' type='DepsGroupType'/>
</xsd:choice>
<xsd:attribute type='xsd:string' name='name' use='required'/>
</xsd:complexType>
@@ -30,9 +29,9 @@
<xsd:complexType>
<xsd:choice minOccurs='0' maxOccurs='unbounded'>
<xsd:element name='Package' type='PackageStructure'/>
- <xsd:element name='Service' type='StructureEntry'/>
- <xsd:element name='Path' type='StructureEntry'/>
- <xsd:element name='Group' type='GroupType'/>
+ <xsd:element name='Service' type='Dependency'/>
+ <xsd:element name='Path' type='Dependency'/>
+ <xsd:element name='Group' type='DepsGroupType'/>
</xsd:choice>
<xsd:attribute type='xsd:string' name='priority' />
</xsd:complexType>
diff --git a/schemas/fileprobes.xsd b/schemas/fileprobes.xsd
index e10dc51dd..0dfb8cdd2 100644
--- a/schemas/fileprobes.xsd
+++ b/schemas/fileprobes.xsd
@@ -1,4 +1,4 @@
-<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xml:lang="en">
+<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xml:lang="en">
<xsd:annotation>
<xsd:documentation>
FileProbes plugin config schema for bcfg2
@@ -6,11 +6,11 @@
</xsd:documentation>
</xsd:annotation>
- <xsd:complexType name="GroupType">
+ <xsd:complexType name="FileProbesGroupType">
<xsd:choice minOccurs="1" maxOccurs="unbounded">
<xsd:element name="FileProbe" type="FileProbeType"/>
- <xsd:element name="Group" type="GroupType"/>
- <xsd:element name="Client" type="GroupType"/>
+ <xsd:element name="Group" type="FileProbesGroupType"/>
+ <xsd:element name="Client" type="FileProbesGroupType"/>
</xsd:choice>
<xsd:attribute type="xsd:string" name="name" use="required"/>
<xsd:attribute type="xsd:string" name="negate"/>
@@ -26,8 +26,8 @@
<xsd:complexType>
<xsd:choice minOccurs="1" maxOccurs="unbounded">
<xsd:element name="FileProbe" type="FileProbeType"/>
- <xsd:element name="Group" type="GroupType"/>
- <xsd:element name="Client" type="GroupType"/>
+ <xsd:element name="Group" type="FileProbesGroupType"/>
+ <xsd:element name="Client" type="FileProbesGroupType"/>
</xsd:choice>
</xsd:complexType>
</xsd:element>
diff --git a/schemas/genshi.xsd b/schemas/genshi.xsd
index 35d81e2f1..0131363be 100644
--- a/schemas/genshi.xsd
+++ b/schemas/genshi.xsd
@@ -6,67 +6,202 @@
elementFormDefault="qualified">
<xs:annotation>
<xs:documentation>
- Genshi schema
- Chris St. Pierre
+ Genshi XML templating language schema
</xs:documentation>
</xs:annotation>
<!-- genshi types -->
<xs:complexType name="forType" mixed="true">
+ <xs:annotation>
+ <xs:documentation>
+ `for directive
+ &lt;http://genshi.edgewall.org/wiki/Documentation/xml-templates.html#id3&gt;`_
+ </xs:documentation>
+ </xs:annotation>
<xs:choice minOccurs="0" maxOccurs="unbounded">
<xs:any processContents="lax"/>
</xs:choice>
- <xs:attribute name="each" type="xs:string" use="required"/>
+ <xs:attribute name="each" type="xs:string" use="required">
+ <xs:annotation>
+ <xs:documentation>
+ The loop iterator
+ </xs:documentation>
+ </xs:annotation>
+ </xs:attribute>
</xs:complexType>
<xs:complexType name="ifType" mixed="true">
+ <xs:annotation>
+ <xs:documentation>
+ `if directive
+ &lt;http://genshi.edgewall.org/wiki/Documentation/xml-templates.html#id1&gt;`_
+ </xs:documentation>
+ </xs:annotation>
<xs:choice minOccurs="0" maxOccurs="unbounded">
<xs:any processContents="lax"/>
</xs:choice>
- <xs:attribute name="test" type="xs:string" use="required"/>
+ <xs:attribute name="test" type="xs:string" use="required">
+ <xs:annotation>
+ <xs:documentation>
+ The statement giving the value to test
+ </xs:documentation>
+ </xs:annotation>
+ </xs:attribute>
</xs:complexType>
<xs:complexType name="matchType" mixed="true">
+ <xs:annotation>
+ <xs:documentation>
+ `match directive
+ &lt;http://genshi.edgewall.org/wiki/Documentation/xml-templates.html#id5&gt;`_
+ </xs:documentation>
+ </xs:annotation>
<xs:choice minOccurs="0" maxOccurs="unbounded">
<xs:any processContents="lax"/>
</xs:choice>
- <xs:attribute name="path" type="xs:string" use="required"/>
- <xs:attribute name="once" type="xs:boolean" default="false"/>
- <xs:attribute name="buffer" type="xs:boolean" default="true"/>
- <xs:attribute name="recursive" type="xs:boolean" default="true"/>
+ <xs:attribute name="path" type="xs:string" use="required">
+ <xs:annotation>
+ <xs:documentation>
+ XPath expression to search for in the template.
+ </xs:documentation>
+ </xs:annotation>
+ </xs:attribute>
+ <xs:attribute name="once" type="xs:boolean" default="false">
+ <xs:annotation>
+ <xs:documentation>
+ Whether the engine should stop looking for more matching
+ elements after the first match. Use this on match templates
+ that match elements that can only occur once in the stream,
+ such as the &lt;head&gt; or &lt;body&gt; elements in an HTML
+ template, or elements with a specific ID.
+ </xs:documentation>
+ </xs:annotation>
+ </xs:attribute>
+ <xs:attribute name="buffer" type="xs:boolean" default="true">
+ <xs:annotation>
+ <xs:documentation>
+ Whether the matched content should be buffered in
+ memory. Buffering can improve performance a bit at the cost
+ of needing more memory during rendering. Buffering is
+ *required* for match templates that contain more than one
+ invocation of the ``select()`` function. If there is only
+ one call, and the matched content can potentially be very
+ long, consider disabling buffering to avoid excessive memory
+ use.
+ </xs:documentation>
+ </xs:annotation>
+ </xs:attribute>
+ <xs:attribute name="recursive" type="xs:boolean" default="true">
+ <xs:annotation>
+ <xs:documentation>
+ Whether the match template should be applied to its own
+ output. Note that once implies non-recursive behavior, so
+ this attribute only needs to be set for match templates that
+ don't also have once set.
+ </xs:documentation>
+ </xs:annotation>
+ </xs:attribute>
</xs:complexType>
<xs:complexType name="defType" mixed="true">
+ <xs:annotation>
+ <xs:documentation>
+ `def directive
+ &lt;http://genshi.edgewall.org/wiki/Documentation/xml-templates.html#id4&gt;`_
+ </xs:documentation>
+ </xs:annotation>
<xs:choice minOccurs="0" maxOccurs="unbounded">
<xs:any processContents="lax"/>
</xs:choice>
- <xs:attribute name="function" type="xs:string" use="required"/>
+ <xs:attribute name="function" type="xs:string" use="required">
+ <xs:annotation>
+ <xs:documentation>
+ The function prototype
+ </xs:documentation>
+ </xs:annotation>
+ </xs:attribute>
</xs:complexType>
<xs:complexType name="withType" mixed="true">
+ <xs:annotation>
+ <xs:documentation>
+ `with directive
+ &lt;http://genshi.edgewall.org/wiki/Documentation/xml-templates.html#py-with&gt;`_
+ </xs:documentation>
+ </xs:annotation>
<xs:choice minOccurs="0" maxOccurs="unbounded">
<xs:any processContents="lax"/>
</xs:choice>
- <xs:attribute name="vars" type="xs:string" use="required"/>
+ <xs:attribute name="vars" type="xs:string" use="required">
+ <xs:annotation>
+ <xs:documentation>
+ A semicolon-delimited list of variables to define and their
+ values.
+ </xs:documentation>
+ </xs:annotation>
+ </xs:attribute>
</xs:complexType>
<xs:complexType name="replaceType" mixed="true">
+ <xs:annotation>
+ <xs:documentation>
+ `replace directive
+ &lt;http://genshi.edgewall.org/wiki/Documentation/xml-templates.html#id8&gt;`_
+ </xs:documentation>
+ </xs:annotation>
<xs:choice minOccurs="0" maxOccurs="unbounded">
<xs:any processContents="lax"/>
</xs:choice>
- <xs:attribute name="value" type="xs:string" use="required"/>
+ <xs:attribute name="value" type="xs:string" use="required">
+ <xs:annotation>
+ <xs:documentation>
+ The value to replace the contents with.
+ </xs:documentation>
+ </xs:annotation>
+ </xs:attribute>
</xs:complexType>
<xs:complexType name="chooseType" mixed="true">
+ <xs:annotation>
+ <xs:documentation>
+ `choose directive
+ &lt;http://genshi.edgewall.org/wiki/Documentation/xml-templates.html#id2&gt;`_
+ </xs:documentation>
+ </xs:annotation>
<xs:sequence>
- <xs:element name="when" type="py:ifType" maxOccurs="unbounded"/>
+ <xs:element name="when" type="py:ifType" maxOccurs="unbounded">
+ <xs:annotation>
+ <xs:documentation>
+ The ``when`` directive is used inside
+ :xml:type:`py:chooseType` or
+ :xml:attribute:`py:genshiAttrs:choose` to handle a single
+ specific condition.
+ </xs:documentation>
+ </xs:annotation>
+ </xs:element>
<xs:element name="otherwise" type="py:otherwiseType"
- minOccurs="0"/>
+ minOccurs="0"/>
</xs:sequence>
- <xs:attribute name="test" type="xs:string" use="required"/>
+ <xs:attribute name="test" type="xs:string" use="required">
+ <xs:annotation>
+ <xs:documentation>
+ If ``test`` is set, the child :xml:element:`py:when`
+ directives are tested for equality to the value of the
+ expression.
+ </xs:documentation>
+ </xs:annotation>
+ </xs:attribute>
</xs:complexType>
<xs:complexType name="otherwiseType" mixed="true">
+ <xs:annotation>
+ <xs:documentation>
+ The ``otherwise`` directive is used inside
+ :xml:type:`py:chooseType` or
+ :xml:attribute:`py:genshiAttrs:choose` to handle all
+ conditions not handled by a :xml:element:`py:when`.
+ </xs:documentation>
+ </xs:annotation>
<xs:choice minOccurs="0" maxOccurs="unbounded">
<xs:any processContents="lax"/>
</xs:choice>
@@ -74,6 +209,13 @@
<!-- genshi tags -->
<xs:group name="genshiElements">
+ <xs:annotation>
+ <xs:documentation>
+ Most Genshi templating directives can be used either as
+ standalone elements or as attributes on existing elements.
+ This element group defines the standalone tags.
+ </xs:documentation>
+ </xs:annotation>
<xs:choice>
<xs:element name="with" type="py:withType"/>
<xs:element name="replace" type="py:replaceType"/>
@@ -87,17 +229,113 @@
<!-- genshi attributes -->
<xs:attributeGroup name="genshiAttrs">
- <xs:attribute name="if" type="xs:string" form="qualified"/>
- <xs:attribute name="choose" type="xs:string" form="qualified"/>
- <xs:attribute name="when" type="xs:string" form="qualified"/>
- <xs:attribute name="otherwise" type="xs:string" form="qualified"/>
- <xs:attribute name="for" type="xs:string" form="qualified"/>
- <xs:attribute name="def" type="xs:string" form="qualified"/>
- <xs:attribute name="match" type="xs:string" form="qualified"/>
- <xs:attribute name="with" type="xs:string" form="qualified"/>
- <xs:attribute name="attrs" type="xs:string" form="qualified"/>
- <xs:attribute name="content" type="xs:string" form="qualified"/>
- <xs:attribute name="replace" type="xs:string" form="qualified"/>
- <xs:attribute name="strip" type="xs:string" form="qualified"/>
+ <xs:annotation>
+ <xs:documentation>
+ Most Genshi templating directives can be used either as
+ standalone elements or as attributes on existing elements.
+ This attribute group defines the attribute directives.
+ </xs:documentation>
+ </xs:annotation>
+ <xs:attribute name="if" type="xs:string" form="qualified">
+ <xs:annotation>
+ <xs:documentation>
+ `if directive
+ &lt;http://genshi.edgewall.org/wiki/Documentation/xml-templates.html#id1&gt;`_
+
+ </xs:documentation>
+ </xs:annotation>
+ </xs:attribute>
+ <xs:attribute name="choose" type="xs:string" form="qualified">
+ <xs:annotation>
+ <xs:documentation>
+ `choose directive
+ &lt;http://genshi.edgewall.org/wiki/Documentation/xml-templates.html#id2&gt;`_
+ </xs:documentation>
+ </xs:annotation>
+ </xs:attribute>
+ <xs:attribute name="when" type="xs:string" form="qualified">
+ <xs:annotation>
+ <xs:documentation>
+ The ``when`` directive is used inside
+ :xml:type:`py:chooseType` or
+ :xml:attribute:`py:genshiAttrs:choose` to handle a single
+ specific condition.
+ </xs:documentation>
+ </xs:annotation>
+ </xs:attribute>
+ <xs:attribute name="otherwise" type="xs:string" form="qualified">
+ <xs:annotation>
+ <xs:documentation>
+ The ``otherwise`` directive is used inside
+ :xml:type:`py:chooseType` or
+ :xml:attribute:`py:genshiAttrs:choose` to handle all
+ conditions not handled by a :xml:element:`py:when`.
+ </xs:documentation>
+ </xs:annotation>
+ </xs:attribute>
+ <xs:attribute name="for" type="xs:string" form="qualified">
+ <xs:annotation>
+ <xs:documentation>
+ `for directive
+ &lt;http://genshi.edgewall.org/wiki/Documentation/xml-templates.html#id3&gt;`_
+ </xs:documentation>
+ </xs:annotation>
+ </xs:attribute>
+ <xs:attribute name="def" type="xs:string" form="qualified">
+ <xs:annotation>
+ <xs:documentation>
+ `def directive
+ &lt;http://genshi.edgewall.org/wiki/Documentation/xml-templates.html#id4&gt;`_
+ </xs:documentation>
+ </xs:annotation>
+ </xs:attribute>
+ <xs:attribute name="match" type="xs:string" form="qualified">
+ <xs:annotation>
+ <xs:documentation>
+ `match directive
+ &lt;http://genshi.edgewall.org/wiki/Documentation/xml-templates.html#id5&gt;`_
+ </xs:documentation>
+ </xs:annotation>
+ </xs:attribute>
+ <xs:attribute name="with" type="xs:string" form="qualified">
+ <xs:annotation>
+ <xs:documentation>
+ `with directive
+ &lt;http://genshi.edgewall.org/wiki/Documentation/xml-templates.html#py-with&gt;`_
+ </xs:documentation>
+ </xs:annotation>
+ </xs:attribute>
+ <xs:attribute name="attrs" type="xs:string" form="qualified">
+ <xs:annotation>
+ <xs:documentation>
+ `attrs directive
+ &lt;http://genshi.edgewall.org/wiki/Documentation/xml-templates.html#id6&gt;`_
+ </xs:documentation>
+ </xs:annotation>
+ </xs:attribute>
+ <xs:attribute name="content" type="xs:string" form="qualified">
+ <xs:annotation>
+ <xs:documentation>
+ `content directive
+ &lt;http://genshi.edgewall.org/wiki/Documentation/xml-templates.html#id7&gt;`_
+ </xs:documentation>
+ </xs:annotation>
+ </xs:attribute>
+ <xs:attribute name="replace" type="xs:string" form="qualified">
+ <xs:annotation>
+ <xs:documentation>
+ `replace directive
+ &lt;http://genshi.edgewall.org/wiki/Documentation/xml-templates.html#id8&gt;`_
+ </xs:documentation>
+ </xs:annotation>
+ </xs:attribute>
+ <xs:attribute name="strip" type="xs:string" form="qualified">
+ <xs:annotation>
+ <xs:documentation>
+ `strip directive
+ &lt;http://genshi.edgewall.org/wiki/Documentation/xml-templates.html#id9&gt;`_
+ </xs:documentation>
+ </xs:annotation>
+ </xs:attribute>
</xs:attributeGroup>
</xs:schema>
diff --git a/schemas/info.xsd b/schemas/info.xsd
index 83a8173d2..24538ffe3 100644
--- a/schemas/info.xsd
+++ b/schemas/info.xsd
@@ -1,8 +1,7 @@
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xml:lang="en">
-
<xsd:annotation>
<xsd:documentation>
- info.xml schema for bcfg2
+ ``info.xml`` schema for Bcfg2
</xsd:documentation>
</xsd:annotation>
@@ -10,39 +9,129 @@
<xsd:include schemaLocation="types.xsd"/>
<xsd:complexType name='InfoType'>
+ <xsd:annotation>
+ <xsd:documentation>
+ The Info tag specifies metadata (ownership, permissions, etc.)
+ for entries that are generated by various plugins.
+ </xsd:documentation>
+ </xsd:annotation>
<xsd:choice minOccurs='0' maxOccurs='unbounded'>
<xsd:element name='ACL' type='ACLType'/>
</xsd:choice>
- <xsd:attribute name='encoding' type='xsd:string'/>
- <xsd:attribute name='group' type='xsd:string'/>
- <xsd:attribute name='important' type='xsd:string'/>
- <xsd:attribute name='owner' type='xsd:string'/>
- <xsd:attribute name='mode' type='xsd:string'/>
- <xsd:attribute name='secontext' type='xsd:string'/>
- <xsd:attribute name='paranoid' type='xsd:boolean'/>
- <xsd:attribute name='sensitive' type='xsd:boolean'/>
+ <xsd:attribute name='encoding' type='xsd:token' default='ascii'>
+ <xsd:annotation>
+ <xsd:documentation>
+ Encoding of the file for tranfer to the client. Use
+ ``base64`` for binary files.
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:attribute>
+ <xsd:attribute name='group' type='xsd:token' default="root">
+ <xsd:annotation>
+ <xsd:documentation>
+ Sets group of the file.
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:attribute>
+ <xsd:attribute name='important' type='xsd:boolean' default="false">
+ <xsd:annotation>
+ <xsd:documentation>
+ Important entries are installed first during client
+ execution.
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:attribute>
+ <xsd:attribute name='owner' type='xsd:token' default="root">
+ <xsd:annotation>
+ <xsd:documentation>
+ Sets owner of the file.
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:attribute>
+ <xsd:attribute name='mode' type='xsd:string' default="0644">
+ <xsd:annotation>
+ <xsd:documentation>
+ Sets the mode of the file from the octal value given.
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:attribute>
+ <xsd:attribute name='secontext' type='xsd:token' default="__default__">
+ <xsd:annotation>
+ <xsd:documentation>
+ Sets the SELinux context of the file, or sets to the default
+ context for that path set by policy if set to the special
+ value ``__default__``.
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:attribute>
+ <xsd:attribute name='paranoid' type='xsd:boolean' default='true'>
+ <xsd:annotation>
+ <xsd:documentation>
+ If true, files that are replaced will be backed up first.
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:attribute>
+ <xsd:attribute name='sensitive' type='xsd:boolean' default="false">
+ <xsd:annotation>
+ <xsd:documentation>
+ The contents of sensitive entries aren't included in reports.
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:attribute>
</xsd:complexType>
- <xsd:complexType name='GroupType'>
+ <xsd:complexType name='InfoGroupType'>
+ <xsd:annotation>
+ <xsd:documentation>
+ An **InfoGroupType** is a ``info.xml`` tag used to provide
+ logic. Child entries of such a tag only apply to machines
+ that match the condition specified -- membership in a group, a
+ matching client name, or a matching path for the file being
+ generated. :xml:attribute:`InfoGroupType:negate` can be set
+ to negate the sense of the match.
+ </xsd:documentation>
+ </xsd:annotation>
<xsd:choice minOccurs='1' maxOccurs='1'>
<xsd:element name='Info' type='InfoType'/>
- <xsd:element name='Group' type='GroupType' minOccurs='0'
+ <xsd:element name='Group' type='InfoGroupType' minOccurs='0'
maxOccurs='unbounded'/>
- <xsd:element name='Client' type='GroupType' minOccurs='0'
+ <xsd:element name='Client' type='InfoGroupType' minOccurs='0'
maxOccurs='unbounded'/>
- <xsd:element name='Path' type='GroupType' minOccurs='0'
+ <xsd:element name='Path' type='InfoGroupType' minOccurs='0'
maxOccurs='unbounded'/>
</xsd:choice>
- <xsd:attribute type='xsd:string' name='name' use='required'/>
- <xsd:attribute type='xsd:boolean' name='negate' />
+ <xsd:attribute type='xsd:string' name='name' use='required'>
+ <xsd:annotation>
+ <xsd:documentation>
+ The name of the client or group, or the full path to match
+ on. Child entries will only apply to this client or group
+ (unless :xml:attribute:`InfoGroupType:negate` is set).
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:attribute>
+ <xsd:attribute type='xsd:boolean' name='negate' default="false">
+ <xsd:annotation>
+ <xsd:documentation>
+ Negate the sense of the match, so that child entries only
+ apply to a client if it is not a member of the given group,
+ does not have the given client name, or the path names do
+ not match.
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:attribute>
</xsd:complexType>
<xsd:element name='FileInfo'>
+ <xsd:annotation>
+ <xsd:documentation>
+ Top-level tag for ``info.xml``.
+ </xsd:documentation>
+ </xsd:annotation>
<xsd:complexType>
<xsd:choice minOccurs='0' maxOccurs='unbounded'>
- <xsd:element name='Group' type='GroupType'/>
- <xsd:element name='Client' type='GroupType'/>
- <xsd:element name='Path' type='GroupType'/>
+ <xsd:element name='Group' type='InfoGroupType'/>
+ <xsd:element name='Client' type='InfoGroupType'/>
+ <xsd:element name='Path' type='InfoGroupType'/>
<xsd:element name='Info' type='InfoType'/>
</xsd:choice>
</xsd:complexType>
diff --git a/schemas/metadata.xsd b/schemas/metadata.xsd
index 84d7436c9..8e81c837e 100644
--- a/schemas/metadata.xsd
+++ b/schemas/metadata.xsd
@@ -3,8 +3,8 @@
<xsd:annotation>
<xsd:documentation>
- metadata schema for bcfg2
- Narayan Desai, Argonne National Laboratory
+ Bcfg2 schema for declaring groups and associating groups with
+ bundles.
</xsd:documentation>
</xsd:annotation>
@@ -14,47 +14,170 @@
schemaLocation="xinclude.xsd"/>
<xsd:complexType name='bundleDeclaration'>
- <xsd:attribute type='xsd:string' name='name' use='required'/>
+ <xsd:annotation>
+ <xsd:documentation>
+ Declaration of a bundle as a member of a group.
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:attribute type='xsd:string' name='name' use='required'>
+ <xsd:annotation>
+ <xsd:documentation>
+ The bundle name
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:attribute>
</xsd:complexType>
- <xsd:complexType name='groupType'>
+ <xsd:complexType name='MetadataGroupType'>
+ <xsd:annotation>
+ <xsd:documentation>
+ The Group tag serves two purposes:
+
+ * If it is at the top level of ``groups.xml`` (i.e., its
+ direct parent is :xml:element:`Groups`), or if it has no
+ children, then it is considered to declare a new group, and
+ :xml:attribute:`MetadataGroupType:profile`,
+ :xml:attribute:`MetadataGroupType:public`,
+ :xml:attribute:`MetadataGroupType:category`, and
+ :xml:attribute:`MetadataGroupType:default` are parsed.
+
+ * If it is not at the top level of ``groups.xml`` *and* it has
+ children, then it is considered to be a conditional; its
+ children only apply to clients that are already members in
+ the group. The attributes listed above are not parsed.
+ </xsd:documentation>
+ </xsd:annotation>
<xsd:choice minOccurs='0' maxOccurs='unbounded'>
<xsd:element name='Bundle' type='bundleDeclaration'/>
- <xsd:element name='Group' type='groupType'/>
+ <xsd:element name='Group' type='MetadataGroupType'/>
<xsd:element name='Client' type='clientType'/>
<xsd:element name='Groups' type='groupsType'/>
</xsd:choice>
- <xsd:attribute type='xsd:string' name='name' use='required'/>
- <xsd:attribute type='xsd:boolean' name='profile'/>
- <xsd:attribute type='xsd:boolean' name='public'/>
- <xsd:attribute type='xsd:boolean' name='default'/>
- <xsd:attribute type='xsd:string' name='auth'/>
- <xsd:attribute type='xsd:string' name='category'/>
- <xsd:attribute type='xsd:string' name='comment'/>
- <xsd:attribute type='xsd:string' name='negate'/>
+ <xsd:attribute type='xsd:string' name='name' use='required'>
+ <xsd:annotation>
+ <xsd:documentation>
+ Name of the group
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:attribute>
+ <xsd:attribute type='xsd:boolean' name='profile' default='false'>
+ <xsd:annotation>
+ <xsd:documentation>
+ Mark the group as a profile, which allows a client to be
+ directly associated with this group in
+ :ref:`server-plugins-grouping-metadata-clients-xml`.
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:attribute>
+ <xsd:attribute type='xsd:boolean' name='public' default='false'>
+ <xsd:annotation>
+ <xsd:documentation>
+ Mark the group as public, which allows any client to assert
+ membership in the group with ``bcfg2 -p``.
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:attribute>
+ <xsd:attribute type='xsd:boolean' name='default' default='false'>
+ <xsd:annotation>
+ <xsd:documentation>
+ Set as the profile to use for clients that are not
+ associated with any profile explicitly in
+ :ref:`server-plugins-grouping-metadata-clients-xml`.
+ Setting ``default`` to ``true`` requires setting
+ :xml:attribute:`MetadataGroupType:profile` to ``true`` as
+ well.
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:attribute>
+ <xsd:attribute type='xsd:string' name='category'>
+ <xsd:annotation>
+ <xsd:documentation>
+ Assign the group to the given category. A client can only
+ be a member of one group in a given category.
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:attribute>
+ <xsd:attribute type='xsd:boolean' name='negate' default="false">
+ <xsd:annotation>
+ <xsd:documentation>
+ When the Group tag is used as a conditional, only apply the
+ child elements if the named group does not match. When the
+ Group tag is used as a declaration, do not apply the named
+ group to matching clients.
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:attribute>
</xsd:complexType>
<xsd:complexType name='clientType'>
+ <xsd:annotation>
+ <xsd:documentation>
+ Client tags are conditionals, and can be used to set
+ per-client groups and bundles.
+ </xsd:documentation>
+ </xsd:annotation>
<xsd:choice minOccurs='0' maxOccurs='unbounded'>
<xsd:element name='Bundle' type='bundleDeclaration'/>
- <xsd:element name='Group' type='groupType'/>
+ <xsd:element name='Group' type='MetadataGroupType'/>
<xsd:element name='Client' type='clientType'/>
<xsd:element name='Groups' type='groupsType'/>
</xsd:choice>
- <xsd:attribute type='xsd:string' name='name' use='required'/>
- <xsd:attribute type='xsd:string' name='negate'/>
+ <xsd:attribute type='xsd:string' name='name' use='required'>
+ <xsd:annotation>
+ <xsd:documentation>
+ The name of the client.
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:attribute>
+ <xsd:attribute type='xsd:boolean' name='negate' default='false'>
+ <xsd:annotation>
+ <xsd:documentation>
+ Only apply the child tags if the named client does not
+ match.
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:attribute>
</xsd:complexType>
<xsd:complexType name='groupsType'>
+ <xsd:annotation>
+ <xsd:documentation>
+ Metadata group list top-level tag
+ </xsd:documentation>
+ </xsd:annotation>
<xsd:choice minOccurs='0' maxOccurs='unbounded'>
- <xsd:element name='Group' type='groupType'/>
+ <xsd:element name='Group' type='MetadataGroupType'/>
<xsd:element name='Client' type='clientType'/>
- <xsd:element name='Groups' type='groupsType'/>
+ <xsd:element name='Groups' type='groupsType'>
+ <xsd:annotation>
+ <xsd:documentation>
+ Nested ``Groups`` tags allowed to support XInclude
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:element>
<xsd:element ref="xi:include"/>
</xsd:choice>
- <xsd:attribute name='version' type='xsd:string'/>
- <xsd:attribute name='origin' type='xsd:string'/>
- <xsd:attribute name='revision' type='xsd:string'/>
+ <xsd:attribute name='version' type='xsd:string'>
+ <xsd:annotation>
+ <xsd:documentation>
+ Group schema version
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:attribute>
+ <xsd:attribute name='origin' type='xsd:anyURI'>
+ <xsd:annotation>
+ <xsd:documentation>
+ URI of master version (for common repository)
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:attribute>
+ <xsd:attribute name='revision' type='xsd:string'>
+ <xsd:annotation>
+ <xsd:documentation>
+ Master version control revision
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:attribute>
<xsd:attribute ref='xml:base'/>
</xsd:complexType>
diff --git a/schemas/nagiosgen.xsd b/schemas/nagiosgen.xsd
index 080994cd1..99d6b91c6 100644
--- a/schemas/nagiosgen.xsd
+++ b/schemas/nagiosgen.xsd
@@ -1,4 +1,4 @@
-<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xml:lang="en">
+<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xml:lang="en">
<xsd:annotation>
<xsd:documentation>
NagiosGen config schema for bcfg2
@@ -6,11 +6,11 @@
</xsd:documentation>
</xsd:annotation>
- <xsd:complexType name="GroupType">
+ <xsd:complexType name="NagiosGenGroupType">
<xsd:choice minOccurs="1" maxOccurs="unbounded">
<xsd:element name="Option" type="OptionType"/>
- <xsd:element name="Group" type="GroupType"/>
- <xsd:element name="Client" type="GroupType"/>
+ <xsd:element name="Group" type="NagiosGenGroupType"/>
+ <xsd:element name="Client" type="NagiosGenGroupType"/>
</xsd:choice>
<xsd:attribute type="xsd:string" name="name" use="required"/>
<xsd:attribute type="xsd:string" name="negate"/>
@@ -23,8 +23,8 @@
<xsd:element name="NagiosGen">
<xsd:complexType>
<xsd:choice minOccurs="1" maxOccurs="unbounded">
- <xsd:element name="Group" type="GroupType"/>
- <xsd:element name="Client" type="GroupType"/>
+ <xsd:element name="Group" type="NagiosGenGroupType"/>
+ <xsd:element name="Client" type="NagiosGenGroupType"/>
</xsd:choice>
</xsd:complexType>
</xsd:element>
diff --git a/schemas/packages.xsd b/schemas/packages.xsd
index c4252194f..dbee2f31b 100644
--- a/schemas/packages.xsd
+++ b/schemas/packages.xsd
@@ -1,5 +1,4 @@
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xml:lang="en">
-
<xsd:annotation>
<xsd:documentation>
packages config schema for bcfg2
@@ -10,7 +9,7 @@
<xsd:import namespace="http://www.w3.org/XML/1998/namespace"
schemaLocation="xml.xsd"/>
- <xsd:simpleType name="sourceTypeEnum">
+ <xsd:simpleType name="SourceTypeEnum">
<xsd:restriction base="xsd:string">
<xsd:enumeration value="yum"/>
<xsd:enumeration value="apt"/>
@@ -19,50 +18,212 @@
</xsd:simpleType>
<xsd:complexType name="RepoOptionsType">
- <xsd:attribute type="xsd:boolean" name="serveronly"/>
- <xsd:attribute type="xsd:boolean" name="clientonly"/>
- <xsd:anyAttribute processContents="lax"/>
+ <xsd:annotation>
+ <xsd:documentation>
+ **RepoOptionsType** can be used to specify arbitrary
+ repository options.
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:attribute type="xsd:boolean" name="serveronly">
+ <xsd:annotation>
+ <xsd:documentation>
+ The options given in this tag will only be used on the Bcfg2
+ server, not on the clients.
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:attribute>
+ <xsd:attribute type="xsd:boolean" name="clientonly">
+ <xsd:annotation>
+ <xsd:documentation>
+ The options given in this tag will only be used on the Bcfg2
+ clients, not on the server.
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:attribute>
+ <xsd:anyAttribute processContents="lax">
+ <xsd:annotation>
+ <xsd:documentation>
+ All other (arbitrary) attributes will be added to the
+ repository configuration.
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:anyAttribute>
</xsd:complexType>
- <xsd:complexType name="sourceType">
+ <xsd:complexType name="SourceType">
+ <xsd:annotation>
+ <xsd:documentation>
+ **SourceType** elements are used to specify software sources
+ (i.e., repositories) for the Packages plugin.
+ </xsd:documentation>
+ </xsd:annotation>
<xsd:choice minOccurs="0" maxOccurs="unbounded">
- <xsd:element name="Component" type="xsd:string"/>
- <xsd:element name="Arch" type="xsd:string"/>
- <xsd:element name="GPGKey" type="xsd:string"/>
- <xsd:element name="Options" type="RepoOptionsType"/>
+ <xsd:element name="Component" type="xsd:string">
+ <xsd:annotation>
+ <xsd:documentation>
+ Components are used to build multiple repository URLs from
+ a single :xml:element:`Source` tag. This is only
+ meaningful if the :xml:attribute:`SourceType:url`
+ attribute is specified; see that attribute above for more
+ detail.
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:element>
+ <xsd:element name="Arch" type="xsd:string">
+ <xsd:annotation>
+ <xsd:documentation>
+ The architecture(s) of the repository. A client must be a
+ member of one of the listed architecture groups in order
+ for this source to apply to the client. Additionally, if
+ the :xml:attribute:`SourceType:url` attribute is
+ specified, the :xml:element:`Arch` tag is used to generate
+ URLs. See :xml:attribute:`the url attribute
+ &lt;SourceType:url&gt;` for more detail.
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:element>
+ <xsd:element name="GPGKey" type="xsd:string">
+ <xsd:annotation>
+ <xsd:documentation>
+ The GPG key(s) for the repository. This only applies to
+ sources with :xml:attribute:`SourceType:type` = ``yum``.
+ If GPG keys are specified, then GPG checking will be
+ automatically enabled for the repository, both on the
+ Bcfg2 server (if :ref:`yum libraries
+ &lt;native-yum-libraries&gt;` are in use) and on the Bcfg2
+ client (if you use
+ :ref:`server-plugins-generators-packages` to
+ :ref:`generate your Yum config
+ &lt;generating-client-configs&gt;`).
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:element>
+ <xsd:element name="Options" type="RepoOptionsType">
+ <xsd:annotation>
+ <xsd:documentation>
+ Arbitrary options to be used in the repository
+ configuration.
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:element>
<xsd:choice>
- <xsd:element name="Blacklist" type="xsd:string"/>
- <xsd:element name="Whitelist" type="xsd:string"/>
+ <xsd:element name="Blacklist" type="xsd:string">
+ <xsd:annotation>
+ <xsd:documentation>
+ Blacklist the given package(s) from the
+ :ref:`server-plugins-generators-packages` plugin. This
+ prevents them from being included in
+ automatically-resolved dependencies.
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:element>
+ <xsd:element name="Whitelist" type="xsd:string">
+ <xsd:annotation>
+ <xsd:documentation>
+ If **Whitelist** is specified, *only* packages listed
+ will be included by the
+ :ref:`server-plugins-generators-packages` plugin.
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:element>
</xsd:choice>
</xsd:choice>
- <xsd:attribute type="xsd:boolean" name="recommended"/>
- <xsd:attribute type="sourceTypeEnum" name="type"/>
- <xsd:attribute type="xsd:string" name="pulp_id"/>
- <xsd:attribute type="xsd:string" name="url"/>
- <xsd:attribute type="xsd:string" name="rawurl"/>
- <xsd:attribute type="xsd:string" name="version"/>
+ <xsd:attribute type="xsd:boolean" name="recommended" default="false">
+ <xsd:annotation>
+ <xsd:documentation>
+ Include packages recommended as dependencies by APT. This
+ only applies to sources with
+ :xml:attribute:`SourceType:type` = ``apt``. You must
+ regenerate the Packages cache after changing this attribute.
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:attribute>
+ <xsd:attribute type="xsd:boolean" name="essential" default="true">
+ <xsd:annotation>
+ <xsd:documentation>
+ Include essential packages from this repo by default (i.e.,
+ without needing to specify them in a bundle). This only
+ applies to sources with :xml:attribute:`SourceType:type` =
+ ``apt``.
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:attribute>
+ <xsd:attribute type="SourceTypeEnum" name="type" use="required">
+ <xsd:annotation>
+ <xsd:documentation>
+ The type of the repository. This corresponds to the
+ Packages plugin driver that will handle the source.
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:attribute>
+ <xsd:attribute type="xsd:string" name="pulp_id">
+ <xsd:annotation>
+ <xsd:documentation>
+ The :ref:`Pulp &lt;pulp-source-support&gt;` repository ID
+ for this repo. This only applies to sources with
+ :xml:attribute:`SourceType:type` = ``yum``. Due to the
+ amount of data that can be queried directly from Pulp,
+ there's rarely a need to supply other attributes.
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:attribute>
+ <xsd:attribute type="xsd:string" name="url">
+ <xsd:annotation>
+ <xsd:documentation>
+ The base URL to use when generating URLs for this source.
+ If :xml:attribute:`SourceType:url` is used, you must also
+ provide the :xml:element:`Arch` tag, at least one
+ :xml:element:`Component` tag, and the
+ :xml:attribute:`SourceType:version` attribute. You must not
+ specify :xml:attribute:`SourceType:rawurl`. For each
+ combination of component and Arch tag, a URL is created in
+ the format::
+
+ &lt;url&gt;/&lt;version&gt;/&lt;component&gt;/&lt;arch&gt;
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:attribute>
+ <xsd:attribute type="xsd:string" name="rawurl">
+ <xsd:annotation>
+ <xsd:documentation>
+ The raw URL to the (single) repository defined by this
+ source. :xml:element:`Component` and
+ :xml:attribute:`SourceType:version` are ignored if this is
+ given.
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:attribute>
+ <xsd:attribute type="xsd:string" name="version">
+ <xsd:annotation>
+ <xsd:documentation>
+ The OS version this source applies to. This is used to
+ generate URLs if the :xml:attribute:`SourceType:url`
+ attribute is given, and ignored otherwise.
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:attribute>
</xsd:complexType>
- <xsd:complexType name="groupType">
+ <xsd:complexType name="PackagesGroupType">
<xsd:choice minOccurs="1" maxOccurs="unbounded">
- <xsd:element name="Group" type="groupType"/>
- <xsd:element name="Client" type="groupType"/>
- <xsd:element name="Sources" type="sourcesType"/>
- <xsd:element name="Source" type="sourceType"/>
+ <xsd:element name="Group" type="PackagesGroupType"/>
+ <xsd:element name="Client" type="PackagesGroupType"/>
+ <xsd:element name="Sources" type="SourcesType"/>
+ <xsd:element name="Source" type="SourceType"/>
</xsd:choice>
<xsd:attribute type="xsd:string" name="name" use="required"/>
<xsd:attribute type="xsd:boolean" name="negate"/>
</xsd:complexType>
- <xsd:complexType name="sourcesType">
+ <xsd:complexType name="SourcesType">
<xsd:choice minOccurs="1" maxOccurs="unbounded">
- <xsd:element name="Group" type="groupType"/>
- <xsd:element name="Client" type="groupType"/>
- <xsd:element name="Source" type="sourceType"/>
- <xsd:element name="Sources" type="sourcesType"/>
+ <xsd:element name="Group" type="PackagesGroupType"/>
+ <xsd:element name="Client" type="PackagesGroupType"/>
+ <xsd:element name="Source" type="SourceType"/>
+ <xsd:element name="Sources" type="SourcesType"/>
</xsd:choice>
<xsd:attribute ref="xml:base"/>
</xsd:complexType>
- <xsd:element name="Sources" type="sourcesType"/>
+ <xsd:element name="Sources" type="SourcesType"/>
</xsd:schema>
diff --git a/schemas/pkglist.xsd b/schemas/pkglist.xsd
index c0d449f54..1f278d477 100644
--- a/schemas/pkglist.xsd
+++ b/schemas/pkglist.xsd
@@ -1,36 +1,104 @@
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xml:lang="en">
-
+
<xsd:annotation>
<xsd:documentation>
package list schema for bcfg2
Narayan Desai, Argonne National Laboratory
</xsd:documentation>
</xsd:annotation>
-
+
<xsd:include schemaLocation="pkgtype.xsd"/>
<xsd:include schemaLocation="types.xsd"/>
<xsd:complexType name='PackageContainerType'>
+ <xsd:annotation>
+ <xsd:documentation>
+ An **PackageContainerType** is a tag used to provide logic.
+ Child entries of an PackageContainerType tag only apply to
+ machines that match the condition specified -- either
+ membership in a group, or a matching client name.
+ :xml:attribute:`PackageContainerType:negate` can be set to
+ negate the sense of the match.
+ </xsd:documentation>
+ </xsd:annotation>
<xsd:choice minOccurs='0' maxOccurs='unbounded'>
<xsd:element name='Package' type='PackageType'/>
<xsd:element name='Group' type='PackageContainerType'/>
<xsd:element name='Client' type='PackageContainerType'/>
</xsd:choice>
- <xsd:attribute name='name' type='xsd:string' use='required'/>
- <xsd:attribute name='negate' type='xsd:string'/>
+ <xsd:attribute name='name' type='xsd:string'>
+ <xsd:annotation>
+ <xsd:documentation>
+ The name of the client or group to match on. Child entries
+ will only apply to this client or group (unless
+ :xml:attribute:`PackageContainerType:negate` is set).
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:attribute>
+ <xsd:attribute name='negate' type='xsd:boolean'>
+ <xsd:annotation>
+ <xsd:documentation>
+ Negate the sense of the match, so that child entries only
+ apply to a client if it is not a member of the given group
+ or does not have the given name.
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:attribute>
</xsd:complexType>
<xsd:element name='PackageList'>
+ <xsd:annotation>
+ <xsd:documentation>
+ The top-level tag in a :ref:`server-plugins-generators-pkgmgr`
+ XML package list.
+ </xsd:documentation>
+ </xsd:annotation>
<xsd:complexType>
<xsd:choice minOccurs='0' maxOccurs='unbounded'>
<xsd:element name='Group' type='PackageContainerType'/>
+ <xsd:element name='Client' type='PackageContainerType'/>
<xsd:element name='Package' type='PackageType'/>
</xsd:choice>
- <xsd:attribute name='priority' type='xsd:integer' use='required'/>
- <xsd:attribute name='type' use='optional' type='PackageTypeEnum' />
- <xsd:attribute name='uri' type='xsd:string' use='optional'/>
- <xsd:attribute type='xsd:string' name='multiarch'/>
- <xsd:attribute type='xsd:string' name='srcs'/>
+ <xsd:attribute name='priority' type='xsd:integer' use='required'>
+ <xsd:annotation>
+ <xsd:documentation>
+ Sets the priority for rules in this file for
+ :ref:`server-plugins-generators-rules`. The higher value
+ wins.
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:attribute>
+ <xsd:attribute name='type' type='PackageTypeEnum'>
+ <xsd:annotation>
+ <xsd:documentation>
+ The package type, which determines which client driver will
+ handle installation of packages in this package list.
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:attribute>
+ <xsd:attribute name='uri' type='xsd:string'>
+ <xsd:annotation>
+ <xsd:documentation>
+ The URI to the repository that data in this package list
+ file was parsed from.
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:attribute>
+ <xsd:attribute type='xsd:string' name='multiarch'>
+ <xsd:annotation>
+ <xsd:documentation>
+ Comma-separated list of architectures of packages in this
+ package list that should be installed.
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:attribute>
+ <xsd:attribute type='xsd:string' name='srcs'>
+ <xsd:annotation>
+ <xsd:documentation>
+ Filename creation rules for multiarch packages.
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:attribute>
</xsd:complexType>
</xsd:element>
</xsd:schema>
diff --git a/schemas/pkgtype.xsd b/schemas/pkgtype.xsd
index cbee6f317..18eda88ab 100644
--- a/schemas/pkgtype.xsd
+++ b/schemas/pkgtype.xsd
@@ -13,48 +13,304 @@
schemaLocation="genshi.xsd"/>
<xsd:complexType name="PackageStructure">
- <xsd:attribute type="xsd:string" name="name"/>
- <xsd:attribute type="xsd:string" name="group"/>
- <xsd:attribute type="xsd:string" name="verify" use="optional"/>
- <xsd:attribute type="PackageGroupTypeEnum" name="type"
- use="optional"/>
+ <xsd:annotation>
+ <xsd:documentation>
+ Abstract description of a package or package group to be
+ installed.
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:attribute type="xsd:string" name="name">
+ <xsd:annotation>
+ <xsd:documentation>
+ Install the named package. Either ``name`` or
+ :xml:attribute:`PackageStructure:group` must be specified.
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:attribute>
+ <xsd:attribute type="xsd:string" name="group">
+ <xsd:annotation>
+ <xsd:documentation>
+ Install the named package group. Package groups are only
+ supported for Yum :xml:element:`Source` repositories, and
+ only if the :ref:`yum libraries
+ &lt;native-yum-libraries&gt;` are in use. Either ``group``
+ or :xml:attribute:`PackageStructure:name` must be specified.
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:attribute>
+ <xsd:attribute type="xsd:boolean" name="verify" default="true">
+ <xsd:annotation>
+ <xsd:documentation>
+ Whether or not to verify the package.
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:attribute>
+ <xsd:attribute type="PackageGroupTypeEnum" name="type" default="default">
+ <xsd:annotation>
+ <xsd:documentation>
+ The package set to select from a given package group. Only
+ meaningful if :xml:attribute:`PackageStructure:group` is
+ specified.
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:attribute>
<xsd:attributeGroup ref="py:genshiAttrs"/>
</xsd:complexType>
<xsd:complexType name="PackageType">
+ <xsd:annotation>
+ <xsd:documentation>
+ Concrete specification of a package to be installed. A
+ package can be specified in one of two ways:
+
+ * A single Package tag that lists all of the attributes for
+ the single instance of the package that should be installed.
+
+ * A Package tag with any number of :xml:element:`Instance`
+ children, each of which lists the attributes of an instance
+ of the package that should be installed. In this case, the
+ Package tag should only have
+ :xml:attribute:`PackageType:name` and
+ :xml:attribute:`PackageType:type`.
+
+ Note that many of the attributes listed below are specific to
+ one or a few package drivers.
+ </xsd:documentation>
+ </xsd:annotation>
<xsd:choice minOccurs="0" maxOccurs="unbounded">
<xsd:element name="Instance">
+ <xsd:annotation>
+ <xsd:documentation>
+ An Instance element describes a single instance of a
+ package that may have several different versions, arches,
+ etc., installed at once.
+ </xsd:documentation>
+ </xsd:annotation>
<xsd:complexType>
- <xsd:attribute name="arch" type="xsd:string"/>
- <xsd:attribute name="epoch" type="xsd:string"/>
- <xsd:attribute name="version" type="xsd:string"/>
- <xsd:attribute name="release" type="xsd:string"/>
- <xsd:attribute name="simplefile" type="xsd:string"/>
- <xsd:attribute name="pkg_verify" type="xsd:boolean"/>
- <xsd:attribute name="verify_flags" type="xsd:string"/>
- <xsd:attribute name="installed_action" type="xsd:string"/>
- <xsd:attribute name="version_fail_action" type="xsd:string"/>
- <xsd:attribute name="verify_fail_action" type="xsd:string"/>
+ <xsd:attribute type="xsd:string" name="arch">
+ <xsd:annotation>
+ <xsd:documentation>
+ The architecture of the package to be installed.
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:attribute>
+ <xsd:attribute name="epoch" type="xsd:integer">
+ <xsd:annotation>
+ <xsd:documentation>
+ The epoch of the package to be installed.
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:attribute>
+ <xsd:attribute type="xsd:string" name="version">
+ <xsd:annotation>
+ <xsd:documentation>
+ The version of the package to be installed. See
+ :xml:attribute:`PackageType:version` for details.
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:attribute>
+ <xsd:attribute type="xsd:string" name="release">
+ <xsd:annotation>
+ <xsd:documentation>
+ The release of the package to be installed.
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:attribute>
+ <xsd:attribute type="xsd:string" name="simplefile">
+ <xsd:annotation>
+ <xsd:documentation>
+ Package file name. No name parsing is performed, so no
+ extra fields get set. This is only used for manual
+ maintenance of ``gpg-pubkey`` packages with the
+ :ref:`YUM, YUM24, or RPM &lt;client-tools-yum&gt;`
+ driver.
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:attribute>
+ <xsd:attribute name="pkg_verify" type="xsd:boolean">
+ <xsd:annotation>
+ <xsd:documentation>
+ Whether or not to perform full package verification (file
+ integrity, etc.) on this package with the :ref:`YUM, YUM24,
+ or RPM &lt;client-tools-yum&gt;` driver.
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:attribute>
+ <xsd:attribute name="verify_flags" type="xsd:string">
+ <xsd:annotation>
+ <xsd:documentation>
+ Comma-separated list of flags to pass to the package
+ verification routines of the :ref:`YUM, YUM24, or RPM
+ &lt;client-tools-yum&gt;` driver. See ``man rpm`` for
+ details on the flags.
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:attribute>
+ <xsd:attribute name="installed_action" type="xsd:string"
+ default="install">
+ <xsd:annotation>
+ <xsd:documentation>
+ If this is set to any value other than "install",
+ package installation will be suppressed with the
+ :ref:`YUM24 and RPM &lt;client-tools-yum&gt;` drivers.
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:attribute>
+ <xsd:attribute name="version_fail_action" type="xsd:string"
+ default="upgrade">
+ <xsd:annotation>
+ <xsd:documentation>
+ If this is set to any value other than "upgrade", a
+ package that has the incorrect version installed will
+ not be fixed with the :ref:`YUM24 and RPM
+ &lt;client-tools-yum&gt;` drivers. Note that
+ "upgrade" is misleading; if a package is installed
+ that is newer than the desired version, it will not be
+ downgraded if this attribute is set to anything other
+ than "upgrade".
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:attribute>
+ <xsd:attribute name="verify_fail_action" type="xsd:string">
+ <xsd:annotation>
+ <xsd:documentation>
+ If this is set to any value other than "reinstall", a
+ package that fails package verification will not be
+ reinstalled with the :ref:`YUM24 and RPM
+ &lt;client-tools-yum&gt;` drivers.
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:attribute>
<xsd:attributeGroup ref="py:genshiAttrs"/>
</xsd:complexType>
</xsd:element>
<xsd:group ref="py:genshiElements"/>
</xsd:choice>
- <xsd:attribute type="xsd:string" name="name"/>
- <xsd:attribute type="xsd:string" name="group"/>
- <xsd:attribute type="xsd:string" name="arch"/>
- <xsd:attribute type="xsd:string" name="version"/>
- <xsd:attribute type="xsd:string" name="release"/>
- <xsd:attribute type="xsd:string" name="file"/>
- <xsd:attribute type="xsd:boolean" name="verify"/>
- <xsd:attribute type="xsd:string" name="simplefile"/>
- <xsd:attribute type="xsd:string" name="multiarch"/>
- <xsd:attribute type="xsd:string" name="srcs"/>
- <xsd:attribute type="PackageTypeEnum" name="type"/>
- <xsd:attribute type="xsd:string" name="bname"/>
- <xsd:attribute name="pkg_checks" type="xsd:boolean"/>
- <xsd:attribute name="pkg_verify" type="xsd:boolean"/>
- <xsd:attribute name="verify_flags" type="xsd:string"/>
+ <xsd:attribute type="xsd:string" name="name" use="required">
+ <xsd:annotation>
+ <xsd:documentation>
+ Package name.
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:attribute>
+ <xsd:attribute type="xsd:string" name="arch">
+ <xsd:annotation>
+ <xsd:documentation>
+ The architecture of the package to be installed.
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:attribute>
+ <xsd:attribute type="xsd:string" name="version">
+ <xsd:annotation>
+ <xsd:documentation>
+ The version of the package to be installed. This should
+ *only* be the version, i.e., not the release. Release should
+ be specified in :xml:attribute:`PackageType:release`, and it
+ is an error to append the release to this.
+
+ This can also be one of two "special" values:
+
+ * ``auto`` will select the newest version of the package
+ available.
+ * ``any`` will select any version of the package, and can be
+ used to ensure that a package is installed without
+ requiring any particular version.
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:attribute>
+ <xsd:attribute type="xsd:string" name="release">
+ <xsd:annotation>
+ <xsd:documentation>
+ The release of the package to be installed.
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:attribute>
+ <xsd:attribute type="xsd:string" name="file">
+ <xsd:annotation>
+ <xsd:documentation>
+ Package file name. Several other attributes (name, version)
+ can be automatically defined based on regular expressions
+ defined in the :ref:`server-plugins-generators-pkgmgr`
+ plugin, which is the only plugin with which this is useful.
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:attribute>
+ <xsd:attribute type="xsd:boolean" name="verify" default="false">
+ <xsd:annotation>
+ <xsd:documentation>
+ Whether or not to perform package verification. This is not
+ supported by the :ref:`YUM &lt;client-tools-yum&gt;` driver.
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:attribute>
+ <xsd:attribute type="xsd:string" name="simplefile">
+ <xsd:annotation>
+ <xsd:documentation>
+ Package file name. No name parsing is performed, so no extra
+ fields get set. This is only used for some edge cases with
+ :ref:`server-plugins-generators-pkgmgr`.
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:attribute>
+ <xsd:attribute type="xsd:string" name="multiarch">
+ <xsd:annotation>
+ <xsd:documentation>
+ Comma-separated list of architectures of this package that
+ should be installed. This is only used by the
+ :ref:`server-plugins-generators-pkgmgr` plugin.
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:attribute>
+ <xsd:attribute type="xsd:string" name="srcs">
+ <xsd:annotation>
+ <xsd:documentation>
+ Filename creation rules for multiarch packages. This is only
+ used by the :ref:`server-plugins-generators-pkgmgr` plugin.
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:attribute>
+ <xsd:attribute type="PackageTypeEnum" name="type" use="required">
+ <xsd:annotation>
+ <xsd:documentation>
+ The package type, which determines which client driver will
+ handle installation of this package.
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:attribute>
+ <xsd:attribute type="xsd:string" name="bname">
+ <xsd:annotation>
+ <xsd:documentation>
+ The name of the package for installing (as opposed to the
+ name when verifying) with the Blast and OpenCSW drivers.
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:attribute>
+ <xsd:attribute name="pkg_checks" type="xsd:boolean">
+ <xsd:annotation>
+ <xsd:documentation>
+ Whether or not to perform basic package checks (version,
+ release, etc.) on this package with the :ref:`YUM, YUM24, or
+ RPM &lt;client-tools-yum&gt;` driver.
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:attribute>
+ <xsd:attribute name="pkg_verify" type="xsd:boolean" default="true">
+ <xsd:annotation>
+ <xsd:documentation>
+ Whether or not to perform full package verification (file
+ integrity, etc.) on this package with the :ref:`YUM, YUM24,
+ or RPM &lt;client-tools-yum&gt;` driver.
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:attribute>
+ <xsd:attribute name="verify_flags" type="xsd:string">
+ <xsd:annotation>
+ <xsd:documentation>
+ Flags to pass to the package verification routines of the
+ :ref:`YUM, YUM24, or RPM &lt;client-tools-yum&gt;` driver.
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:attribute>
<xsd:attributeGroup ref="py:genshiAttrs"/>
</xsd:complexType>
</xsd:schema>
diff --git a/schemas/rules.xsd b/schemas/rules.xsd
index 241ffe5bf..ddfb7ad0d 100644
--- a/schemas/rules.xsd
+++ b/schemas/rules.xsd
@@ -1,6 +1,5 @@
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:py="http://genshi.edgewall.org/" xml:lang="en">
-
<xsd:annotation>
<xsd:documentation>
string enumeration definitions for bcfg2
@@ -50,10 +49,66 @@
</xsd:documentation>
</xsd:annotation>
</xsd:element>
- <xsd:element name='SELinux' type='SELinuxType'>
+ <xsd:element name='SEBoolean' type='SEBooleanType'>
+ <xsd:annotation>
+ <xsd:documentation>
+ Fully bound description of an SELinux boolean entry.
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:element>
+ <xsd:element name='SEPort' type='SEPortType'>
<xsd:annotation>
<xsd:documentation>
- Fully bound description of an SELinux entry.
+ Fully bound description of an SELinux port entry.
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:element>
+ <xsd:element name='SEFcontext' type='SEFcontextType'>
+ <xsd:annotation>
+ <xsd:documentation>
+ Fully bound description of an SELinux file context entry.
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:element>
+ <xsd:element name='SENode' type='SENodeType'>
+ <xsd:annotation>
+ <xsd:documentation>
+ Fully bound description of an SELinux node entry.
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:element>
+ <xsd:element name='SELogin' type='SELoginType'>
+ <xsd:annotation>
+ <xsd:documentation>
+ Fully bound description of an SELinux login entry.
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:element>
+ <xsd:element name='SEUser' type='SEUserType'>
+ <xsd:annotation>
+ <xsd:documentation>
+ Fully bound description of an SELinux user entry.
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:element>
+ <xsd:element name='SEInterface' type='SEInterfaceType'>
+ <xsd:annotation>
+ <xsd:documentation>
+ Fully bound description of an SELinux interface entry.
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:element>
+ <xsd:element name='SEPermissive' type='SEPermissiveType'>
+ <xsd:annotation>
+ <xsd:documentation>
+ Fully bound description of an SELinux permissive domain entry.
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:element>
+ <xsd:element name='SEModule' type='SEModuleType'>
+ <xsd:annotation>
+ <xsd:documentation>
+ Fully bound description of an SELinux module entry.
</xsd:documentation>
</xsd:annotation>
</xsd:element>
@@ -84,8 +139,8 @@
<xsd:annotation>
<xsd:documentation>
Elements within Group tags only apply to clients that are
- members of that group (or vice-versa; see #element_negate
- below)
+ members of that group (or vice-versa, if
+ :xml:attribute:`RContainerType:negate` is set)
</xsd:documentation>
</xsd:annotation>
</xsd:element>
@@ -93,7 +148,8 @@
<xsd:annotation>
<xsd:documentation>
Elements within Client tags only apply to the named client
- (or vice-versa; see #element_negate below)
+ (or vice-versa, if :xml:attribute:`RContainerType:negate`
+ is set)
</xsd:documentation>
</xsd:annotation>
</xsd:element>
@@ -101,20 +157,60 @@
</xsd:group>
<xsd:complexType name='RContainerType'>
+ <xsd:annotation>
+ <xsd:documentation>
+ An **RContainerType** is a Rules tag used to provide logic.
+ Child entries of an RContainerType tag only apply to machines
+ that match the condition specified -- either membership in a
+ group, or a matching client name.
+ :xml:attribute:`RContainerType:negate` can be set to negate
+ the sense of the match.
+ </xsd:documentation>
+ </xsd:annotation>
<xsd:choice minOccurs='0' maxOccurs='unbounded'>
<xsd:group ref="rulesElements"/>
</xsd:choice>
- <xsd:attribute name='name' type='xsd:string'/>
- <xsd:attribute name='negate' type='xsd:boolean'/>
+ <xsd:attribute name='name' type='xsd:string'>
+ <xsd:annotation>
+ <xsd:documentation>
+ The name of the client or group to match on. Child entries
+ will only apply to this client or group (unless
+ :xml:attribute:`RContainerType:negate` is set).
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:attribute>
+ <xsd:attribute name='negate' type='xsd:boolean' default="false">
+ <xsd:annotation>
+ <xsd:documentation>
+ Negate the sense of the match, so that child entries only
+ apply to a client if it is not a member of the given group
+ or does not have the given name.
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:attribute>
<xsd:attributeGroup ref="py:genshiAttrs"/>
</xsd:complexType>
<xsd:element name='Rules'>
+ <xsd:annotation>
+ <xsd:documentation>
+ The top-level tag for concrete descriptions of entries in
+ :ref:`server-plugins-generators-rules`.
+ </xsd:documentation>
+ </xsd:annotation>
<xsd:complexType>
<xsd:choice minOccurs='0' maxOccurs='unbounded'>
<xsd:group ref="rulesElements"/>
</xsd:choice>
- <xsd:attribute name='priority' type='xsd:integer' use='required'/>
+ <xsd:attribute name='priority' type='xsd:integer' use='required'>
+ <xsd:annotation>
+ <xsd:documentation>
+ Sets the priority for rules in this file for
+ :ref:`server-plugins-generators-rules`. The higher value
+ wins.
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:attribute>
<xsd:attributeGroup ref="py:genshiAttrs"/>
</xsd:complexType>
</xsd:element>
diff --git a/schemas/selinux.xsd b/schemas/selinux.xsd
new file mode 100644
index 000000000..760953e34
--- /dev/null
+++ b/schemas/selinux.xsd
@@ -0,0 +1,302 @@
+<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ xmlns:py="http://genshi.edgewall.org/" xml:lang="en">
+
+ <xsd:annotation>
+ <xsd:documentation>
+ SELinux element definitions for bcfg2
+ </xsd:documentation>
+ </xsd:annotation>
+
+ <xsd:import namespace="http://genshi.edgewall.org/"
+ schemaLocation="genshi.xsd"/>
+
+ <xsd:simpleType name='SEFileTypeEnum'>
+ <xsd:restriction base='xsd:string'>
+ <xsd:enumeration value='all'/>
+ <xsd:enumeration value='regular'/>
+ <xsd:enumeration value='directory'/>
+ <xsd:enumeration value='symlink'/>
+ <xsd:enumeration value='pipe'/>
+ <xsd:enumeration value='socket'/>
+ <xsd:enumeration value='block'/>
+ <xsd:enumeration value='char'/>
+ </xsd:restriction>
+ </xsd:simpleType>
+
+ <xsd:simpleType name='SEBooleanValueEnum'>
+ <xsd:restriction base='xsd:string'>
+ <xsd:enumeration value='on'/>
+ <xsd:enumeration value='off'/>
+ </xsd:restriction>
+ </xsd:simpleType>
+
+ <xsd:complexType name="SELinuxStructure">
+ <xsd:attribute type='xsd:string' name='name' use='required'/>
+ <xsd:attribute type="xsd:boolean" name="disabled"/>
+ <xsd:attributeGroup ref="py:genshiAttrs"/>
+ </xsd:complexType>
+
+ <xsd:complexType name="SEBooleanType">
+ <xsd:annotation>
+ <xsd:documentation>
+ Concrete SELinux boolean entry
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:attribute type="xsd:string" name="name" use="required">
+ <xsd:annotation>
+ <xsd:documentation>
+ Name of the boolean
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:attribute>
+ <xsd:attribute type="SEBooleanValueEnum" name="value"
+ use="required">
+ <xsd:annotation>
+ <xsd:documentation>
+ Value of the boolean
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:attribute>
+ <xsd:attributeGroup ref="py:genshiAttrs"/>
+ </xsd:complexType>
+
+ <xsd:complexType name="SEPortType">
+ <xsd:annotation>
+ <xsd:documentation>
+ Concrete SELinux port entry
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:attribute type="SEPortNamePattern" name="name" use="required">
+ <xsd:annotation>
+ <xsd:documentation>
+ Port number or range and protocol
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:attribute>
+ <xsd:attribute type="xsd:token" name="selinuxtype" use="required">
+ <xsd:annotation>
+ <xsd:documentation>
+ SELinux type to apply to this port
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:attribute>
+ <xsd:attributeGroup ref="py:genshiAttrs"/>
+ </xsd:complexType>
+
+ <xsd:simpleType name="SEPortNamePattern">
+ <xsd:annotation>
+ <xsd:documentation>
+ Port number or range and protocol for SEPort entries.
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:restriction base="xsd:string">
+ <xsd:annotation>
+ <xsd:documentation>
+ ``&lt;port&gt;/&lt;proto&gt;`` or
+ ``&lt;start&gt;-&lt;end&gt;/&lt;proto&gt;``
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:pattern value="\d+(-\d+)?/(tcp|udp)"/>
+ </xsd:restriction>
+ </xsd:simpleType>
+
+ <xsd:complexType name="SEFcontextType">
+ <xsd:annotation>
+ <xsd:documentation>
+ Concrete SELinux file context ("fcontext") entry
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:attribute type="xsd:string" name="name" use="required">
+ <xsd:annotation>
+ <xsd:documentation>
+ Regular expression file specification
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:attribute>
+ <xsd:attribute type="xsd:token" name="selinuxtype" use="required">
+ <xsd:annotation>
+ <xsd:documentation>
+ SELinux type to apply to files matching this specification
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:attribute>
+ <xsd:attribute type="SEFileTypeEnum" name="filetype" default="all">
+ <xsd:annotation>
+ <xsd:documentation>
+ File type to match
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:attribute>
+ <xsd:attributeGroup ref="py:genshiAttrs"/>
+ </xsd:complexType>
+
+ <xsd:complexType name="SENodeType">
+ <xsd:annotation>
+ <xsd:documentation>
+ Concrete SELinux node entry
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:attribute type="SENodeNamePattern" name="name" use="required">
+ <xsd:annotation>
+ <xsd:documentation>
+ IP address and netmask of node
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:attribute>
+ <xsd:attribute type="xsd:token" name="selinuxtype" use="required">
+ <xsd:annotation>
+ <xsd:documentation>
+ SELinux type to apply to this node
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:attribute>
+ <xsd:attribute type="SENodeProtocolEnum" name="proto">
+ <xsd:annotation>
+ <xsd:documentation>
+ Protocol
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:attribute>
+ <xsd:attributeGroup ref="py:genshiAttrs"/>
+ </xsd:complexType>
+
+ <xsd:simpleType name="SENodeNamePattern">
+ <xsd:annotation>
+ <xsd:documentation>
+ IP address and netmask for SENode entries. Netmask can be
+ numeric or dotted-quad.
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:restriction base="xsd:string">
+ <xsd:annotation>
+ <xsd:documentation>
+ ``&lt;addr&gt;/&lt;netmask&gt;``. Netmask can be numeric
+ (``/16``) or dotted-quad (``/255.255.0.0``).
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:pattern value="(\d{1,3}\.){3}\d{1,3}/(\d\d?|\d{1,3}\.){3}\d{1,3}"/>
+ </xsd:restriction>
+ </xsd:simpleType>
+
+ <xsd:simpleType name='SENodeProtocolEnum'>
+ <xsd:restriction base='xsd:string'>
+ <xsd:enumeration value='ipv4'/>
+ <xsd:enumeration value='ipv6'/>
+ </xsd:restriction>
+ </xsd:simpleType>
+
+ <xsd:complexType name="SELoginType">
+ <xsd:annotation>
+ <xsd:documentation>
+ Concrete SELinux login entry
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:attribute type="xsd:token" name="name" use="required">
+ <xsd:annotation>
+ <xsd:documentation>
+ Unix username
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:attribute>
+ <xsd:attribute type="xsd:token" name="selinuxuser" use="required">
+ <xsd:annotation>
+ <xsd:documentation>
+ SELinux username
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:attribute>
+ <xsd:attributeGroup ref="py:genshiAttrs"/>
+ </xsd:complexType>
+
+ <xsd:complexType name="SEUserType">
+ <xsd:annotation>
+ <xsd:documentation>
+ Concrete SELinux user entry
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:attribute type="xsd:token" name="name" use="required">
+ <xsd:annotation>
+ <xsd:documentation>
+ SELinux username
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:attribute>
+ <xsd:attribute type="xsd:string" name="roles" use="required">
+ <xsd:annotation>
+ <xsd:documentation>
+ Space-separated list of rules
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:attribute>
+ <xsd:attribute type="xsd:token" name="prefix" use="required">
+ <xsd:annotation>
+ <xsd:documentation>
+ Home directory context prefix
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:attribute>
+ <xsd:attributeGroup ref="py:genshiAttrs"/>
+ </xsd:complexType>
+
+ <xsd:complexType name="SEInterfaceType">
+ <xsd:annotation>
+ <xsd:documentation>
+ Concrete SELinux interface entry
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:attribute type="xsd:token" name="name" use="required">
+ <xsd:annotation>
+ <xsd:documentation>
+ Interface name
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:attribute>
+ <xsd:attribute type="xsd:token" name="selinuxtype" use="required">
+ <xsd:annotation>
+ <xsd:documentation>
+ SELinux type to apply to this interface
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:attribute>
+ <xsd:attributeGroup ref="py:genshiAttrs"/>
+ </xsd:complexType>
+
+ <xsd:complexType name="SEPermissiveType">
+ <xsd:annotation>
+ <xsd:documentation>
+ Concrete SELinux permissive domain entry
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:attribute type="xsd:token" name="name" use="required">
+ <xsd:annotation>
+ <xsd:documentation>
+ SELinux type to make permissive
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:attribute>
+ <xsd:attributeGroup ref="py:genshiAttrs"/>
+ </xsd:complexType>
+
+ <xsd:complexType name="SEModuleType" mixed="true">
+ <xsd:annotation>
+ <xsd:documentation>
+ Concrete SELinux module entry
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:attribute type="xsd:string" name="name" use="required">
+ <xsd:annotation>
+ <xsd:documentation>
+ SELinux module name or filename
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:attribute>
+ <xsd:attribute type="xsd:boolean" name="disabled">
+ <xsd:annotation>
+ <xsd:documentation>
+ Disable this module
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:attribute>
+ <xsd:attributeGroup ref="py:genshiAttrs"/>
+ </xsd:complexType>
+</xsd:schema>
diff --git a/schemas/servicetype.xsd b/schemas/servicetype.xsd
index 7de847c7f..4d5ac7c31 100644
--- a/schemas/servicetype.xsd
+++ b/schemas/servicetype.xsd
@@ -1,6 +1,5 @@
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:py="http://genshi.edgewall.org/" xml:lang="en">
-
<xsd:annotation>
<xsd:documentation>
services schema for bcfg2
@@ -16,35 +15,88 @@
<xsd:restriction base='xsd:string'>
<xsd:enumeration value='true'/>
<xsd:enumeration value='false'/>
- <xsd:enumeration value='1'/>
- <xsd:enumeration value='0'/>
<xsd:enumeration value='interactive'/>
</xsd:restriction>
</xsd:simpleType>
<xsd:complexType name="ServiceType">
- <xsd:choice minOccurs="0" maxOccurs="unbounded">
- <xsd:element name="User">
- <xsd:complexType>
- <xsd:attribute name="address" type="xsd:string" use="required"/>
- <xsd:attribute name="mask" type="xsd:string" use="required"/>
- </xsd:complexType>
- </xsd:element>
- <xsd:group ref="py:genshiElements"/>
- </xsd:choice>
- <xsd:attribute name="name" type="xsd:string" use="required"/>
- <xsd:attribute name="status" type="StatusEnum"/>
- <xsd:attribute name="restart" type="RestartEnum"/>
- <xsd:attribute name="install" type="xsd:boolean"/>
- <xsd:attribute name="type" type="ServiceTypeEnum"/>
- <xsd:attribute name="port" type="xsd:string"/>
- <xsd:attribute name="protocol" type="xsd:string"/>
- <xsd:attribute name="custom" type="xsd:string"/>
- <xsd:attribute name="FMRI" type="xsd:string"/>
- <xsd:attribute name="sequence" type="xsd:string"/>
- <xsd:attribute name="target" type="xsd:string"/>
- <xsd:attribute name="parameters" type="xsd:string"/>
+ <xsd:annotation>
+ <xsd:documentation>
+ Concrete description of a service entry. Note that, due to
+ the great proliferation of init systems, many of the
+ attributes listed only apply to one or a few client tools.
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:attribute name="name" type="xsd:string" use="required">
+ <xsd:annotation>
+ <xsd:documentation>
+ The name of the service.
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:attribute>
+ <xsd:attribute name="status" type="StatusEnum" default="off">
+ <xsd:annotation>
+ <xsd:documentation>
+ Whether the service should start at boot. If this is set to
+ "ignore", then the boot-time status of the service will not
+ be checked.
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:attribute>
+ <xsd:attribute name="restart" type="RestartEnum" default="true">
+ <xsd:annotation>
+ <xsd:documentation>
+ Whether or not to restart the service when the bundle is
+ modified. (New in 1.3; replaces "mode" attribute.)
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:attribute>
+ <xsd:attribute name="install" type="xsd:boolean" default="true">
+ <xsd:annotation>
+ <xsd:documentation>
+ Whether or not to install the service initially. (New in
+ 1.3; replaces "mode" attribute.)
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:attribute>
+ <xsd:attribute name="type" type="ServiceTypeEnum">
+ <xsd:annotation>
+ <xsd:documentation>
+ Driver to use on the client to manage this service.
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:attribute>
+ <xsd:attribute name="FMRI" type="xsd:string">
+ <xsd:annotation>
+ <xsd:documentation>
+ The resource identifier for SMF services.
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:attribute>
+ <xsd:attribute name="sequence" type="xsd:string">
+ <xsd:annotation>
+ <xsd:documentation>
+ Order for service startup. Only meaningful for DebInit
+ services.
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:attribute>
+ <xsd:attribute name="target" type="xsd:string" default="restart">
+ <xsd:annotation>
+ <xsd:documentation>
+ Command to pass to the service management system when
+ restarting a service.
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:attribute>
+ <xsd:attribute name="parameters" type="xsd:string">
+ <xsd:annotation>
+ <xsd:documentation>
+ Parameters to pass to the service. Only meaningful for
+ Upstart services.
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:attribute>
<xsd:attributeGroup ref="py:genshiAttrs"/>
</xsd:complexType>
-
</xsd:schema>
diff --git a/schemas/sslca-cert.xsd b/schemas/sslca-cert.xsd
index 07baf3390..a9c01fb29 100644
--- a/schemas/sslca-cert.xsd
+++ b/schemas/sslca-cert.xsd
@@ -1,43 +1,166 @@
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xml:lang="en">
<xsd:annotation>
<xsd:documentation>
- SSLCA cert.xml schema for bcfg2
- Chris St. Pierre
+ Schema for :ref:`server-plugins-generators-sslca` ``cert.xml``
</xsd:documentation>
</xsd:annotation>
- <xsd:complexType name="GroupType">
+ <xsd:complexType name="SSLCACertGroupType">
+ <xsd:annotation>
+ <xsd:documentation>
+ An **SSLCACertGroupType** is a tag used to provide logic.
+ Child entries of an SSLCACertGroupType tag only apply to
+ machines that match the condition specified -- either
+ membership in a group, or a matching client name.
+ :xml:attribute:`SSLCACertGroupType:negate` can be set to negate
+ the sense of the match.
+ </xsd:documentation>
+ </xsd:annotation>
<xsd:choice minOccurs="1" maxOccurs="unbounded">
<xsd:element name="Cert" type="CertType"/>
- <xsd:element name="Group" type="GroupType"/>
- <xsd:element name="Client" type="GroupType"/>
- <xsd:element name="subjectAltName" type="xsd:string"/>
+ <xsd:element name="Group" type="SSLCACertGroupType"/>
+ <xsd:element name="Client" type="SSLCACertGroupType"/>
+ <xsd:element name="subjectAltName" type="SubjectAltNameType"/>
</xsd:choice>
- <xsd:attribute type="xsd:string" name="name" use="required"/>
- <xsd:attribute type="xsd:string" name="negate"/>
+ <xsd:attribute name='name' type='xsd:string'>
+ <xsd:annotation>
+ <xsd:documentation>
+ The name of the client or group to match on. Child entries
+ will only apply to this client or group (unless
+ :xml:attribute:`SSLCACertGroupType:negate` is set).
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:attribute>
+ <xsd:attribute name='negate' type='xsd:boolean'>
+ <xsd:annotation>
+ <xsd:documentation>
+ Negate the sense of the match, so that child entries only
+ apply to a client if it is not a member of the given group
+ or does not have the given name.
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:attribute>
</xsd:complexType>
+ <xsd:simpleType name="SSLCACertFormatEnum">
+ <xsd:annotation>
+ <xsd:documentation>
+ Available certificate formats
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:restriction base="xsd:string">
+ <xsd:enumeration value="pem"/>
+ </xsd:restriction>
+ </xsd:simpleType>
+
+ <xsd:simpleType name="SubjectAltNameType">
+ <xsd:annotation>
+ <xsd:documentation>
+ Explicitly specify subject alternative names for the generated
+ certificate.
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:restriction base="xsd:string"/>
+ </xsd:simpleType>
+
<xsd:complexType name="CertType">
- <xsd:attribute type="xsd:string" name="key" use="required"/>
- <xsd:attribute type="xsd:string" name="format"/>
- <xsd:attribute type="xsd:string" name="ca"/>
- <xsd:attribute type="xsd:integer" name="days"/>
- <xsd:attribute type="xsd:string" name="c"/>
- <xsd:attribute type="xsd:string" name="l"/>
- <xsd:attribute type="xsd:string" name="st"/>
- <xsd:attribute type="xsd:string" name="ou"/>
- <xsd:attribute type="xsd:string" name="o"/>
- <xsd:attribute type="xsd:string" name="emailaddress"/>
- <xsd:attribute type="xsd:string" name="append_chain"/>
+ <xsd:attribute type="xsd:string" name="key" use="required">
+ <xsd:annotation>
+ <xsd:documentation>
+ The full path to the key entry to use for this certificate.
+ This is the *client* path; e.g., for a key defined at
+ ``/var/lib/bcfg2/SSLCA/etc/pki/tls/private/foo.key/key.xml``,
+ **key** should be ``/etc/pki/tls/private/foo.key``.
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:attribute>
+ <xsd:attribute type="SSLCACertFormatEnum" name="format" default="pem">
+ <xsd:annotation>
+ <xsd:documentation>
+ The certificate format to produce.
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:attribute>
+ <xsd:attribute type="xsd:string" name="ca" default="default">
+ <xsd:annotation>
+ <xsd:documentation>
+ The name of the CA (from :ref:`bcfg2.conf
+ &lt;sslca-configuration&gt;`) to use to generate this
+ certificate.
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:attribute>
+ <xsd:attribute type="xsd:integer" name="days" default="365">
+ <xsd:annotation>
+ <xsd:documentation>
+ Time (in days) the certificate will be valid for.
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:attribute>
+ <xsd:attribute type="xsd:string" name="c">
+ <xsd:annotation>
+ <xsd:documentation>
+ Override the country set in the CA config
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:attribute>
+ <xsd:attribute type="xsd:string" name="l">
+ <xsd:annotation>
+ <xsd:documentation>
+ Override the location set in the CA config
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:attribute>
+ <xsd:attribute type="xsd:string" name="st">
+ <xsd:annotation>
+ <xsd:documentation>
+ Override the state set in the CA config
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:attribute>
+ <xsd:attribute type="xsd:string" name="ou">
+ <xsd:annotation>
+ <xsd:documentation>
+ Override the organizational unit set in the CA config
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:attribute>
+ <xsd:attribute type="xsd:string" name="o">
+ <xsd:annotation>
+ <xsd:documentation>
+ Override the organization set in the CA config
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:attribute>
+ <xsd:attribute type="xsd:string" name="emailaddress">
+ <xsd:annotation>
+ <xsd:documentation>
+ Override the email address set in the CA config
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:attribute>
+ <xsd:attribute type="xsd:boolean" name="append_chain" default="false">
+ <xsd:annotation>
+ <xsd:documentation>
+ Append the CA chain certificate to the generated certificate
+ (e.g., to produce a certificate in the format required by Nginx.)
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:attribute>
</xsd:complexType>
<xsd:element name="CertInfo">
+ <xsd:annotation>
+ <xsd:documentation>
+ Top-level tag for describing an SSLCA generated certificate.
+ </xsd:documentation>
+ </xsd:annotation>
<xsd:complexType>
<xsd:choice minOccurs="1" maxOccurs="unbounded">
<xsd:element name="Cert" type="CertType"/>
- <xsd:element name="Group" type="GroupType"/>
- <xsd:element name="Client" type="GroupType"/>
- <xsd:element name="subjectAltName" type="xsd:string"/>
+ <xsd:element name="Group" type="SSLCACertGroupType"/>
+ <xsd:element name="Client" type="SSLCACertGroupType"/>
+ <xsd:element name="subjectAltName" type="SubjectAltNameType"/>
</xsd:choice>
</xsd:complexType>
</xsd:element>
diff --git a/schemas/sslca-key.xsd b/schemas/sslca-key.xsd
index e807ea037..efd4abd58 100644
--- a/schemas/sslca-key.xsd
+++ b/schemas/sslca-key.xsd
@@ -1,32 +1,86 @@
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xml:lang="en">
<xsd:annotation>
<xsd:documentation>
- SSLCA key.xml schema for bcfg2
- Chris St. Pierre
+ Schema for :ref:`server-plugins-generators-sslca` ``key.xml``
</xsd:documentation>
</xsd:annotation>
- <xsd:complexType name="GroupType">
+ <xsd:complexType name="SSLCAKeyGroupType">
+ <xsd:annotation>
+ <xsd:documentation>
+ An **SSLCAKeyGroupType** is a tag used to provide logic.
+ Child entries of an SSLCAKeyGroupType tag only apply to
+ machines that match the condition specified -- either
+ membership in a group, or a matching client name.
+ :xml:attribute:`SSLCAKeyGroupType:negate` can be set to negate
+ the sense of the match.
+ </xsd:documentation>
+ </xsd:annotation>
<xsd:choice minOccurs="1" maxOccurs="unbounded">
<xsd:element name="Key" type="KeyType"/>
- <xsd:element name="Group" type="GroupType"/>
- <xsd:element name="Client" type="GroupType"/>
+ <xsd:element name="Group" type="SSLCAKeyGroupType"/>
+ <xsd:element name="Client" type="SSLCAKeyGroupType"/>
</xsd:choice>
- <xsd:attribute type="xsd:string" name="name" use="required"/>
- <xsd:attribute type="xsd:string" name="negate"/>
+ <xsd:attribute name='name' type='xsd:string'>
+ <xsd:annotation>
+ <xsd:documentation>
+ The name of the client or group to match on. Child entries
+ will only apply to this client or group (unless
+ :xml:attribute:`SSLCAKeyGroupType:negate` is set).
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:attribute>
+ <xsd:attribute name='negate' type='xsd:boolean'>
+ <xsd:annotation>
+ <xsd:documentation>
+ Negate the sense of the match, so that child entries only
+ apply to a client if it is not a member of the given group
+ or does not have the given name.
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:attribute>
</xsd:complexType>
+ <xsd:simpleType name="KeyTypeEnum">
+ <xsd:annotation>
+ <xsd:documentation>
+ Available generated key types
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:restriction base="xsd:token">
+ <xsd:enumeration value="rsa"/>
+ <xsd:enumeration value="dsa"/>
+ </xsd:restriction>
+ </xsd:simpleType>
+
<xsd:complexType name="KeyType">
- <xsd:attribute type="xsd:string" name="type"/>
- <xsd:attribute type="xsd:string" name="bits"/>
+ <xsd:attribute type="xsd:string" name="type" default='rsa'>
+ <xsd:annotation>
+ <xsd:documentation>
+ The key type
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:attribute>
+ <xsd:attribute type="xsd:nonNegativeInteger" name="bits" default="2048">
+ <xsd:annotation>
+ <xsd:documentation>
+ The key length
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:attribute>
</xsd:complexType>
<xsd:element name="KeyInfo">
+ <xsd:annotation>
+ <xsd:documentation>
+ Top-level tag for describing an SSLCA generated key.
+ </xsd:documentation>
+ </xsd:annotation>
<xsd:complexType>
<xsd:choice minOccurs="1" maxOccurs="unbounded">
<xsd:element name="Key" type="KeyType"/>
- <xsd:element name="Group" type="GroupType"/>
- <xsd:element name="Client" type="GroupType"/>
+ <xsd:element name="Group" type="SSLCAKeyGroupType"/>
+ <xsd:element name="Client" type="SSLCAKeyGroupType"/>
</xsd:choice>
</xsd:complexType>
</xsd:element>
diff --git a/schemas/types.xsd b/schemas/types.xsd
index a36693b2d..6262d9bb6 100644
--- a/schemas/types.xsd
+++ b/schemas/types.xsd
@@ -8,6 +8,7 @@
</xsd:documentation>
</xsd:annotation>
+ <xsd:include schemaLocation="selinux.xsd"/>
<xsd:import namespace="http://genshi.edgewall.org/"
schemaLocation="genshi.xsd"/>
@@ -91,12 +92,62 @@
</xsd:simpleType>
<xsd:complexType name='ActionType'>
- <xsd:attribute type='ActionTimingEnum' name='timing'/>
- <xsd:attribute type='ActionWhenEnum' name='when'/>
- <xsd:attribute type='ActionStatusEnum' name='status'/>
- <xsd:attribute type="xsd:boolean" name="build"/>
- <xsd:attribute type='xsd:string' name='name'/>
- <xsd:attribute type='xsd:string' name='command'/>
+ <xsd:annotation>
+ <xsd:documentation>
+ Action entries are external shell commands that are executed
+ either before bundle installation, after bundle installation
+ or both.
+ </xsd:documentation>
+ </xsd:annotation>
+
+ <xsd:attribute type='ActionTimingEnum' name='timing' use='required'>
+ <xsd:annotation>
+ <xsd:documentation>
+ When the action is run.
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:attribute>
+ <xsd:attribute type='ActionWhenEnum' name='when' use='required'>
+ <xsd:annotation>
+ <xsd:documentation>
+ If the action is always run, or is only run when a bundle
+ has been modified. Actions that run before bundle
+ installation ("pre" and "both") ignore the setting of
+ ``when`` and are always run regardless.
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:attribute>
+ <xsd:attribute type='ActionStatusEnum' name='status' use='required'>
+ <xsd:annotation>
+ <xsd:documentation>
+ Whether or not to check the return code of the action. If
+ this is "check", then a non-zero return code will result in
+ the entry being flagged as bad.
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:attribute>
+ <xsd:attribute type="xsd:boolean" name="build" default="true">
+ <xsd:annotation>
+ <xsd:documentation>
+ Also execute the action in build mode.
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:attribute>
+ <xsd:attribute type='xsd:string' name='name' use='required'>
+ <xsd:annotation>
+ <xsd:documentation>
+ The freeform name of the action.
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:attribute>
+ <xsd:attribute type='xsd:string' name='command' use='required'>
+ <xsd:annotation>
+ <xsd:documentation>
+ The command to run. The command is executed within a shell,
+ so flow control and other shell-specific things can be used.
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:attribute>
<xsd:attributeGroup ref="py:genshiAttrs"/>
</xsd:complexType>
@@ -123,118 +174,287 @@
</xsd:simpleType>
<xsd:complexType name="ACLType">
- <xsd:attribute type="ACLTypeEnum" name="type" use="required"/>
- <xsd:attribute type="ACLScopeEnum" name="scope"/>
- <xsd:attribute type="xsd:string" name="perms" use="required"/>
- <xsd:attribute type="xsd:string" name="user"/>
- <xsd:attribute type="xsd:string" name="group"/>
+ <xsd:annotation>
+ <xsd:documentation>
+ Define POSIX ACLs for a Path entry.
+ </xsd:documentation>
+ </xsd:annotation>
+
+ <xsd:attribute type="ACLTypeEnum" name="type" use="required">
+ <xsd:annotation>
+ <xsd:documentation>
+ ACL type
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:attribute>
+ <xsd:attribute type="ACLScopeEnum" name="scope">
+ <xsd:annotation>
+ <xsd:documentation>
+ ACL scope. This is omitted for
+ :xml:attribute:`ACLType:type` = ``default``.
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:attribute>
+ <xsd:attribute type="xsd:string" name="perms" use="required">
+ <xsd:annotation>
+ <xsd:documentation>
+ Permissions for the ACL. This can either be a single octal
+ digit (e.g., ``6`` would indicate read and write, but not
+ execute), or a symbolic mode including 'r', 'w', and 'x'.
+ You can include '-' for operations that are not permitted,
+ but it's not required. I.e., all of the following are
+ identical::
+
+ perms="5"
+ perms="rx"
+ perms="r-x"
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:attribute>
+ <xsd:attribute type="xsd:string" name="user">
+ <xsd:annotation>
+ <xsd:documentation>
+ User the ACL applies to (with :xml:attribute:`ACLType:scope`
+ = ``user``).
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:attribute>
+ <xsd:attribute type="xsd:string" name="group">
+ <xsd:annotation>
+ <xsd:documentation>
+ Group the ACL applies to (with
+ :xml:attribute:`ACLType:scope` = ``group``).
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:attribute>
<xsd:attributeGroup ref="py:genshiAttrs"/>
</xsd:complexType>
- <xsd:complexType name="PathType">
+ <xsd:complexType name="PathType" mixed="true">
+ <xsd:annotation>
+ <xsd:documentation>
+ Manage filesystem paths -- files, directories, symlinks, etc.
+ </xsd:documentation>
+ </xsd:annotation>
+
<xsd:choice minOccurs='0' maxOccurs='unbounded'>
<xsd:element name='ACL' type='ACLType'/>
</xsd:choice>
- <xsd:attribute type="PathTypeEnum" name="type"/>
- <xsd:attribute type="xsd:string" name="name" use="required"/>
- <xsd:attribute type="DeviceTypeEnum" name="dev_type"/>
- <xsd:attribute type="xsd:integer" name="major"/>
- <xsd:attribute type="xsd:integer" name="minor"/>
- <xsd:attribute type="xsd:integer" name="mode"/>
- <xsd:attribute type="xsd:string" name="owner"/>
- <xsd:attribute type="xsd:string" name="group"/>
- <xsd:attribute type="xsd:string" name="secontext"/>
- <xsd:attribute type="xsd:string" name="recursive"/>
- <xsd:attribute type="xsd:string" name="prune"/>
- <xsd:attribute type="xsd:string" name="to"/>
- <xsd:attribute type="xsd:string" name="vcstype"/>
- <xsd:attribute type="xsd:string" name="revision"/>
- <xsd:attribute type="xsd:string" name="sourceurl"/>
+ <xsd:attribute type="PathTypeEnum" name="type">
+ <xsd:annotation>
+ <xsd:documentation>
+ Type of path to manage.
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:attribute>
+ <xsd:attribute type="xsd:string" name="name" use="required">
+ <xsd:annotation>
+ <xsd:documentation>
+ Full path.
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:attribute>
+ <xsd:attribute type="DeviceTypeEnum" name="dev_type">
+ <xsd:annotation>
+ <xsd:documentation>
+ Type of device.
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:attribute>
+ <xsd:attribute type="xsd:nonNegativeInteger" name="major">
+ <xsd:annotation>
+ <xsd:documentation>
+ Major device number (``block`` and ``char`` devices only).
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:attribute>
+ <xsd:attribute type="xsd:nonNegativeInteger" name="minor">
+ <xsd:annotation>
+ <xsd:documentation>
+ Minor device number (``block`` and ``char`` devices only).
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:attribute>
+ <xsd:attribute type="xsd:nonNegativeInteger" name="mode">
+ <xsd:annotation>
+ <xsd:documentation>
+ Permissions mode in octal format.
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:attribute>
+ <xsd:attribute type="xsd:string" name="owner">
+ <xsd:annotation>
+ <xsd:documentation>
+ Owner username or UID number
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:attribute>
+ <xsd:attribute type="xsd:string" name="group">
+ <xsd:annotation>
+ <xsd:documentation>
+ Group name or GID number
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:attribute>
+ <xsd:attribute type="xsd:string" name="secontext" default="__default__">
+ <xsd:annotation>
+ <xsd:documentation>
+ SELinux context for the path. This should be a full
+ context, not just the type. E.g.,
+ ``system_u:object_r:etc_t:s0``, not just ``etc_t``. You can
+ also specify ``__default__``, which will restore the context
+ of the file to the default set by policy. See
+ :ref:`server-selinux` for more information.
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:attribute>
+ <xsd:attribute type="xsd:boolean" name="recursive">
+ <xsd:annotation>
+ <xsd:documentation>
+ Recursively remove files or set permissions, as appropriate.
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:attribute>
+ <xsd:attribute type="xsd:boolean" name="prune">
+ <xsd:annotation>
+ <xsd:documentation>
+ Remove entries that are not in the Bcfg2 specification from
+ the directory.
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:attribute>
+ <xsd:attribute type="xsd:string" name="to">
+ <xsd:annotation>
+ <xsd:documentation>
+ File to link to
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:attribute>
+ <xsd:attribute type="xsd:boolean" name="empty">
+ <xsd:annotation>
+ <xsd:documentation>
+ The file entry has no content. This must be set as a
+ safeguard against accidentally empty content.
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:attribute>
+ <xsd:attribute type="VCSTypeEnum" name="vcstype">
+ <xsd:annotation>
+ <xsd:documentation>
+ The VCS backend to checkout contents from.
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:attribute>
+ <xsd:attribute type="xsd:string" name="revision">
+ <xsd:annotation>
+ <xsd:documentation>
+ The revision to checkout.
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:attribute>
+ <xsd:attribute type="xsd:anyURI" name="sourceurl">
+ <xsd:annotation>
+ <xsd:documentation>
+ The VCS URL to checkout.
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:attribute>
<xsd:attributeGroup ref="py:genshiAttrs"/>
</xsd:complexType>
- <xsd:simpleType name='SELinuxTypeEnum'>
- <xsd:restriction base='xsd:string'>
- <xsd:enumeration value='boolean'/>
- <xsd:enumeration value='module'/>
- <xsd:enumeration value='port'/>
- <xsd:enumeration value='fcontext'/>
- <xsd:enumeration value='node'/>
- <xsd:enumeration value='login'/>
- <xsd:enumeration value='user'/>
- <xsd:enumeration value='interface'/>
- <xsd:enumeration value='permissive'/>
- </xsd:restriction>
- </xsd:simpleType>
-
- <xsd:simpleType name='SELinuxFileTypeEnum'>
- <xsd:restriction base='xsd:string'>
- <xsd:enumeration value='all'/>
- <xsd:enumeration value='regular'/>
- <xsd:enumeration value='directory'/>
- <xsd:enumeration value='symlink'/>
- <xsd:enumeration value='pipe'/>
- <xsd:enumeration value='socket'/>
- <xsd:enumeration value='block'/>
- <xsd:enumeration value='char'/>
- </xsd:restriction>
- </xsd:simpleType>
-
- <xsd:simpleType name='SELinuxBooleanValueEnum'>
- <xsd:restriction base='xsd:string'>
- <xsd:enumeration value='on'/>
- <xsd:enumeration value='off'/>
- </xsd:restriction>
- </xsd:simpleType>
-
- <xsd:simpleType name='SELinuxEntryTypeEnum'>
+ <xsd:simpleType name='VCSTypeEnum'>
<xsd:restriction base='xsd:string'>
- <xsd:enumeration value='boolean'/>
- <xsd:enumeration value='module'/>
- <xsd:enumeration value='port'/>
- <xsd:enumeration value='fcontext'/>
- <xsd:enumeration value='node'/>
- <xsd:enumeration value='login'/>
- <xsd:enumeration value='user'/>
- <xsd:enumeration value='interface'/>
- <xsd:enumeration value='permissive'/>
+ <xsd:enumeration value='svn'/>
+ <xsd:enumeration value='git'/>
</xsd:restriction>
</xsd:simpleType>
- <xsd:complexType name="SELinuxStructure">
- <xsd:attribute type='xsd:string' name='name' use='required'/>
- <xsd:attribute type="xsd:boolean" name="disabled"/>
- <xsd:attributeGroup ref="py:genshiAttrs"/>
- </xsd:complexType>
-
- <xsd:complexType name="SELinuxType">
- <xsd:attribute type="xsd:string" name="name" use="required"/>
- <xsd:attribute type="SELinuxEntryTypeEnum" name="type" use="required"/>
- <xsd:attribute type="SELinuxBooleanValueEnum" name="value"/>
- <xsd:attribute type="xsd:boolean" name="disabled"/>
- <xsd:attribute type="xsd:string" name="selinuxtype"/>
- <xsd:attribute type="SELinuxFileTypeEnum" name="filetype"/>
- <xsd:attribute type="xsd:string" name="proto"/>
- <xsd:attribute type="xsd:string" name="roles"/>
- <xsd:attribute type="xsd:string" name="prefix"/>
- <xsd:attribute type="xsd:string" name="selinuxuser"/>
- <xsd:attributeGroup ref="py:genshiAttrs"/>
- </xsd:complexType>
-
<xsd:complexType name="POSIXUserType">
+ <xsd:annotation>
+ <xsd:documentation>
+ The POSIXUser tag allows you to create users on client machines.
+ </xsd:documentation>
+ </xsd:annotation>
<xsd:choice minOccurs='0' maxOccurs='unbounded'>
- <xsd:element name='MemberOf' type='xsd:string'/>
+ <xsd:element name='MemberOf' type='xsd:token'>
+ <xsd:annotation>
+ <xsd:documentation>
+ Specify additional supplementary groups for the POSIXUser
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:element>
</xsd:choice>
- <xsd:attribute type="xsd:string" name="name" use="required"/>
- <xsd:attribute type="xsd:integer" name="uid"/>
- <xsd:attribute type="xsd:string" name="group"/>
- <xsd:attribute type="xsd:string" name="gecos"/>
- <xsd:attribute type="xsd:string" name="home"/>
- <xsd:attribute type="xsd:string" name="shell"/>
+ <xsd:attribute type="xsd:token" name="name" use="required">
+ <xsd:annotation>
+ <xsd:documentation>
+ Username
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:attribute>
+ <xsd:attribute type="xsd:integer" name="uid">
+ <xsd:annotation>
+ <xsd:documentation>
+ User ID number. If this is not specified, each client is
+ allowed to set the UID.
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:attribute>
+ <xsd:attribute type="xsd:token" name="group">
+ <xsd:annotation>
+ <xsd:documentation>
+ Name of the user's primary group. If this is not set, the
+ user's primary group will be the same as the username.
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:attribute>
+ <xsd:attribute type="xsd:string" name="gecos">
+ <xsd:annotation>
+ <xsd:documentation>
+ Human-readable user name or comment. If this is not set,
+ the GECOS will be the same as the username.
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:attribute>
+ <xsd:attribute type="xsd:string" name="home">
+ <xsd:annotation>
+ <xsd:documentation>
+ User's home directory. Default is ``/root`` for the root
+ user, ``/home/&lt;username&gt;`` otherwise.
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:attribute>
+ <xsd:attribute type="xsd:string" name="shell" default="/bin/bash">
+ <xsd:annotation>
+ <xsd:documentation>
+ User's shell
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:attribute>
+ <xsd:attributeGroup ref="py:genshiAttrs"/>
</xsd:complexType>
<xsd:complexType name="POSIXGroupType">
- <xsd:attribute type="xsd:string" name="name" use="required"/>
- <xsd:attribute type="xsd:integer" name="gid"/>
+ <xsd:annotation>
+ <xsd:documentation>
+ The POSIXGroup tag allows you to create groups on client
+ machines.
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:attribute type="xsd:token" name="name" use="required">
+ <xsd:annotation>
+ <xsd:documentation>
+ Username
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:attribute>
+ <xsd:attribute type="xsd:integer" name="gid">
+ <xsd:annotation>
+ <xsd:documentation>
+ Group ID number. If this is not specified, each client is
+ allowed to set the GID.
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:attribute>
+ <xsd:attributeGroup ref="py:genshiAttrs"/>
</xsd:complexType>
</xsd:schema>
diff --git a/schemas/xs3p.xsl b/schemas/xs3p.xsl
deleted file mode 100644
index b127948be..000000000
--- a/schemas/xs3p.xsl
+++ /dev/null
@@ -1,8503 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
-<!--
- Copyright (C) DSTC Pty Ltd (ACN 052 372 577) 2002
-
- The software contained on this media is the property of the
- DSTC Pty Ltd. Use of this software is strictly in accordance
- with the license agreement in the accompanying LICENSE file.
- If your distribution of this software does not contain a
- LICENSE file then you have no rights to use this software
- in any manner and should contact DSTC at the address below
- to determine an appropriate licensing arrangement.
-
- DSTC Pty Ltd
- Level 7, General Purpose South
- The University of Queensland
- QLD 4072 Australia
- Tel: +61 7 3365 4310
- Fax: +61 7 3365 4311
- Email: titanium_enquiries@dstc.edu.au
-
- This software is being provided "AS IS" without warranty of
- any kind. In no event shall DSTC Pty Ltd be liable for
- damage of any kind arising out of or in connection with
- the use or performance of this software.
--->
-<!--
- File:
- xs3p.xsl
- Description:
- Stylesheet that generates XHTML documentation, given an XML
- Schema document
- Assumptions:
- -Resulting documentation will only be displayed properly with
- the latest browsers that support XHTML and CSS. Older
- browsers are not supported.
- -Assumed that XSD document conforms to the XSD recommendation.
- No validity checking is done.
- Constraints:
- -Local schema components cannot contain two dashes in
- 'documentation' elements within their 'annotation' element.
- This is because the contents of those 'documentation'
- elements are displayed in a separate window using Javascript.
- This Javascript code is enclosed in comments, which do not
- allow two dashes inside themselves.
- Notes:
- -Javascript code is placed within comments, even though in
- strict XHTML, JavaScript code should be placed within CDATA
- sections. This is because current browsers generate a syntax
- error if the page contains CDATA sections. Placing Javascript
- code within comments means that the code cannot contain two
- dashes.
- (See 'PrintJSCode' named template.)
- Stylesheet Sections:
- -Global Parameters
- Specify parameters that can be set externally to customise
- stylesheet
- -Constants
- Constants used by the stylesheet
- -Main Document
- Templates to generate the overall document and the top-level
- sections within it
- -Hierarchy table
- Templates for displaying type hierarchy for simple and
- complex types, and substitution group hierarchy for elements
- -Properties table
- Templates for displaying the properties of top-level schema
- components
- -XML Instance Representation table
- Templates for displaying how an XML instance conforming to
- the schema component would look like
- -Schema Component Representation table
- Templates for displaying the XML representation of the schema
- component
- -XML Pretty Printer
- Templates for displaying arbitrary XML instances
- -Handling Schema Component References
- Templates for generating internal and external links
- -General Utility Templates
- General templates used by other templates in this stylesheet
- To Do List:
- -It is not clever when printing out element and attribute
- wildcards in the XML Instance Representation tables. It prints
- out all wildcards, rather than working out the actual wildcard
- is from multiple wildcard instances.
- -Same as above for simple type constraints, e.g. it doesn't
- summarise multiple pattern constraints.
--->
-<xsl:stylesheet
- xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
- xmlns="http://www.w3.org/1999/xhtml"
- xmlns:html="http://www.w3.org/1999/xhtml"
- xmlns:xsd="http://www.w3.org/2001/XMLSchema"
- xmlns:ppp="http://titanium.dstc.edu.au/xml/xs3p"
- version="1.0"
- exclude-result-prefixes="xsd ppp html">
-
- <xsl:output
- method="xml"
- encoding="ISO-8859-1"
- standalone="yes"
- version="1.0"
- doctype-public="-//W3C//DTD XHTML 1.0 Strict//EN"
- doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"
- indent="yes"/>
-
- <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" />
- <xsl:key name="complexType" match="/xsd:schema/xsd:complexType | /xsd:schema/xsd:redefine/xsd:complexType" use="@name" />
- <xsl:key name="simpleType" match="/xsd:schema/xsd:simpleType | /xsd:schema/xsd:redefine/xsd:simpleType" use="@name" />
- <xsl:key name="attributeGroup" match="/xsd:schema/xsd:attributeGroup | /xsd:schema/xsd:redefine/xsd:attributeGroup" use="@name" />
- <xsl:key name="group" match="/xsd:schema/xsd:group | /xsd:schema/xsd:redefine/xsd:group" use="@name" />
- <xsl:key name="attribute" match="/xsd:schema/xsd:attribute" use="@name" />
- <xsl:key name="element" match="/xsd:schema/xsd:element" use="@name" />
-
- <!-- ******** Global Parameters ******** -->
-
- <!-- Title of XHTML document. -->
- <xsl:param name="title"></xsl:param>
-
- <!-- If 'true', sorts the top-level schema components by type,
- then name. Otherwise, displays the components by the order that
- they appear in the schema. -->
- <xsl:param name="sortByComponent">true</xsl:param>
-
- <!-- If 'true', XHTML document uses JavaScript for added
- functionality, such as pop-up windows and information-
- hiding.
- Otherwise, XHTML document does not use JavaScript. -->
- <xsl:param name="useJavaScript">true</xsl:param>
-
- <!-- If 'true', prints all super-types in the
- type hierarchy box.
- Otherwise, prints the parent type only in the
- type hierarchy box. -->
- <xsl:param name="printAllSuperTypes">true</xsl:param>
-
- <!-- If 'true', prints all sub-types in the
- type hierarchy box.
- Otherwise, prints the direct sub-types only in the
- type hierarchy box. -->
- <xsl:param name="printAllSubTypes">true</xsl:param>
-
- <!-- If 'true', prints out the Glossary section. -->
- <xsl:param name="printGlossary">true</xsl:param>
-
- <!-- If 'true', prints out the Legend section. -->
- <xsl:param name="printLegend">true</xsl:param>
-
- <!-- If 'true', prints prefix matching namespace of schema
- components in XML Instance Representation tables. -->
- <xsl:param name="printNSPrefixes">true</xsl:param>
-
- <!-- If 'true', searches 'included' schemas for schema components
- when generating links and XML Instance Representation tables. -->
- <xsl:param name="searchIncludedSchemas">false</xsl:param>
-
- <!-- If 'true', searches 'imported' schemas for schema components
- when generating links and XML Instance Representation tables. -->
- <xsl:param name="searchImportedSchemas">false</xsl:param>
-
- <!-- File containing the mapping from file locations of external
- (e.g. included, imported, refined) schemas to file locations
- of their XHTML documentation. -->
- <xsl:param name="linksFile"></xsl:param>
-
- <!-- Set the base URL for resolving links. -->
- <xsl:param name="baseURL"></xsl:param>
-
- <!-- Uses an external CSS stylesheet rather than using
- internally-declared CSS properties. -->
- <xsl:param name="externalCSSURL"></xsl:param>
-
-
- <!-- ******** Constants ******** -->
-
- <!-- XML Schema Namespace -->
- <xsl:variable name="XSD_NS">http://www.w3.org/2001/XMLSchema</xsl:variable>
-
- <!-- XML Namespace -->
- <xsl:variable name="XML_NS">http://www.w3.org/XML/1998/namespace</xsl:variable>
-
- <!-- Number of 'em' to indent from parent element's start tag to
- child element's start tag -->
- <xsl:variable name="ELEM_INDENT">1.5</xsl:variable>
-
- <!-- Number of 'em' to indent from parent element's start tag to
- attribute's tag -->
- <xsl:variable name="ATTR_INDENT">0.5</xsl:variable>
-
- <!-- Title to use if none provided -->
- <xsl:variable name="DEFAULT_TITLE">XML Schema Documentation</xsl:variable>
-
- <!-- Prefixes used for anchor names -->
- <!-- Type definitions -->
- <xsl:variable name="TYPE_PREFIX">type_</xsl:variable>
- <!-- Attribute declarations -->
- <xsl:variable name="ATTR_PREFIX">attribute_</xsl:variable>
- <!-- Attribute group definitions -->
- <xsl:variable name="ATTR_GRP_PREFIX">attributeGroup_</xsl:variable>
- <!-- Complex type definitions -->
- <xsl:variable name="CTYPE_PREFIX" select="$TYPE_PREFIX"/>
- <!-- Element declarations -->
- <xsl:variable name="ELEM_PREFIX">element_</xsl:variable>
- <!-- Key definitions -->
- <xsl:variable name="KEY_PREFIX">key_</xsl:variable>
- <!-- Group definitions -->
- <xsl:variable name="GRP_PREFIX">group_</xsl:variable>
- <!-- Notations -->
- <xsl:variable name="NOTA_PREFIX">notation_</xsl:variable>
- <!-- Namespace declarations -->
- <xsl:variable name="NS_PREFIX">ns_</xsl:variable>
- <!-- Simple type definitions -->
- <xsl:variable name="STYPE_PREFIX" select="$TYPE_PREFIX"/>
- <!-- Glossary terms -->
- <xsl:variable name="TERM_PREFIX">term_</xsl:variable>
-
- <!-- The original schema needs to be stored because when
- calculating links for references, the links have to be
- relative to the original schema. See 'PrintCompRef'
- template. -->
- <xsl:variable name="ORIGINAL_SCHEMA" select="/xsd:schema"/>
-
- <!-- ******** Main Document ******** -->
-
- <!--
- Main template that starts the process
- -->
- <xsl:template match="/xsd:schema">
- <!-- Check that links file is provided if searching external
- schemas for components. -->
- <xsl:if test="$linksFile='' and (normalize-space(translate($searchIncludedSchemas, 'TRUE', 'true'))='true' or normalize-space(translate($searchImportedSchemas, 'TRUE', 'true'))='true')">
- <xsl:call-template name="HandleError">
- <xsl:with-param name="isTerminating">true</xsl:with-param>
- <xsl:with-param name="errorMsg">
-'linksFile' variable must be provided if either
-'searchIncludedSchemas' or 'searchImportedSchemas' is true.
- </xsl:with-param>
- </xsl:call-template>
- </xsl:if>
-
- <!-- Get title of document -->
- <xsl:variable name="actualTitle">
- <xsl:choose>
- <xsl:when test="$title != ''">
- <xsl:value-of select="$title"/>
- </xsl:when>
- <xsl:otherwise>
- <xsl:value-of select="$DEFAULT_TITLE"/>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:variable>
-
- <html>
- <head>
- <!-- Set title bar -->
- <title><xsl:value-of select="$actualTitle"/></title>
-
- <!-- Set content type -->
- <meta http-equiv="Content-Type" content="text/xml; charset=iso-8859-1"/>
-
- <!-- Set base URL to use in working out relative paths -->
- <xsl:if test="$baseURL != ''">
- <xsl:element name="base">
- <xsl:attribute name="href"><xsl:value-of select="$baseURL"/></xsl:attribute>
- </xsl:element>
- </xsl:if>
-
- <!-- Set CSS styles -->
- <style type="text/css">
- <xsl:choose>
- <!-- Use external CSS stylesheet -->
- <xsl:when test="$externalCSSURL != ''">
- <xsl:text>
-@import url(</xsl:text><xsl:value-of select="$externalCSSURL"/><xsl:text>);
-</xsl:text>
- </xsl:when>
- <!-- Use internal CSS styles -->
- <xsl:otherwise>
- <xsl:call-template name="DocumentCSSStyles"/>
- </xsl:otherwise>
- </xsl:choose>
- </style>
-
- <!-- Add Javascript code to make the collapseable boxes work -->
- <xsl:if test="normalize-space(translate($useJavaScript,'TRUE','true'))='true'">
- <xsl:call-template name="PrintJSCode">
- <xsl:with-param name="code">
- <xsl:call-template name="DocumentJSCode"/>
- </xsl:with-param>
- </xsl:call-template>
- </xsl:if>
- </head>
- <body>
- <!-- Title -->
- <h1><a name="top"><xsl:value-of select="$actualTitle"/></a></h1>
-
- <!-- Buttons for displaying printer-friendly version, and
- expanding and collapsing all boxes -->
- <xsl:call-template name="GlobalControlButtons"/>
-
- <!-- Section: Table of Contents -->
- <h2>Table of Contents</h2>
- <xsl:apply-templates select="." mode="toc"/>
- <xsl:call-template name="SectionFooter"/>
-
- <!-- Section: Schema Document Properties -->
- <h2><a name="SchemaProperties">Schema Document Properties</a></h2>
- <!-- Sub-section: Properties table -->
- <xsl:apply-templates select="." mode="properties"/>
- <!-- Sub-section: Namespace Legend -->
- <h3>Declared Namespaces</h3>
- <xsl:apply-templates select="." mode="namespaces"/>
- <!-- Sub-section: Schema Component Representation table -->
- <xsl:call-template name="SchemaComponentTable">
- <xsl:with-param name="component" select="."/>
- </xsl:call-template>
- <xsl:call-template name="SectionFooter"/>
-
- <!-- Section: Redefined Schema Components -->
- <xsl:if test="xsd:redefine">
- <h2><a name="Redefinitions">Redefined Schema Components</a></h2>
- <xsl:apply-templates select="xsd:redefine/xsd:simpleType | xsd:redefine/xsd:complexType | xsd:redefine/xsd:attributeGroup | xsd:redefine/xsd:group" mode="topSection"/>
- </xsl:if>
-
- <!-- Sections: Top-level Schema Components -->
- <xsl:choose>
- <!-- Sort schema components -->
- <xsl:when test="normalize-space(translate($sortByComponent,'TRUE','true'))='true'">
- <!-- Declarations -->
- <xsl:if test="xsd:attribute or xsd:element">
- <h2><a name="SchemaDeclarations">Global Declarations</a></h2>
- <xsl:apply-templates select="xsd:attribute | xsd:element" mode="topSection">
- <xsl:sort select="local-name(.)" order="ascending"/>
- <xsl:sort select="@name" order="ascending"/>
- </xsl:apply-templates>
- </xsl:if>
- <!-- Definitions -->
- <xsl:if test="xsd:attributeGroup or xsd:complexType or xsd:group or xsd:notation or xsd:simpleType">
- <h2><a name="SchemaDefinitions">Global Definitions</a></h2>
- <xsl:apply-templates select="xsd:attributeGroup | xsd:complexType | xsd:group | xsd:notation | xsd:simpleType" mode="topSection">
- <xsl:sort select="local-name(.)" order="ascending"/>
- <xsl:sort select="@name" order="ascending"/>
- </xsl:apply-templates>
- </xsl:if>
- </xsl:when>
- <!-- Display schema components as they occur -->
- <xsl:otherwise>
- <h2><a name="SchemaComponents">Global Schema Components</a></h2>
- <xsl:apply-templates select="xsd:attribute | xsd:attributeGroup | xsd:complexType | xsd:element | xsd:group | xsd:notation | xsd:simpleType" mode="topSection"/>
- </xsl:otherwise>
- </xsl:choose>
-
- <!-- Section: Legend -->
- <xsl:if test="normalize-space(translate($printLegend,'TRUE','true'))='true'">
- <div id="legend">
- <h2><a name="Legend">Legend</a></h2>
- <xsl:call-template name="Legend"/>
- <xsl:call-template name="SectionFooter"/>
- </div>
- </xsl:if>
-
- <!-- Section: Glossary -->
- <xsl:if test="normalize-space(translate($printGlossary,'TRUE','true'))='true'">
- <div id="glossary">
- <h2><a name="Glossary">Glossary</a></h2>
- <xsl:call-template name="Glossary"/>
- <xsl:call-template name="SectionFooter"/>
- </div>
- </xsl:if>
-
- <!-- Document Footer -->
- <p class="footer">
- <xsl:text>Generated by </xsl:text>
- <a href="http://xml.fiforms.org/xs3p/">xs3p</a> (<a href="http://titanium.dstc.edu.au/xml/xs3p">old link</a>)
- <xsl:text>.</xsl:text>
- <xsl:if test="normalize-space(translate($useJavaScript,'TRUE','true'))='true'">
- <xsl:text> Last modified: </xsl:text>
- <xsl:call-template name="PrintJSCode">
- <xsl:with-param name="code">document.write(document.lastModified);</xsl:with-param>
- </xsl:call-template>
- </xsl:if>
- </p>
- </body>
- </html>
- </xsl:template>
-
- <!--
- Prints out the table of Declared Namespaces for the
- current schema.
- -->
- <xsl:template match="xsd:schema" mode="namespaces">
- <table class="namespaces">
- <tr>
- <th>Prefix</th>
- <th>Namespace</th>
- </tr>
- <!-- Default namespace (no prefix) -->
- <xsl:if test="namespace::*[local-name(.)='']">
- <xsl:variable name="ns" select="namespace::*[local-name(.)='']"/>
- <tr>
- <td>
- <a name="{$NS_PREFIX}">Default namespace</a>
- </td>
- <td>
- <xsl:choose>
- <xsl:when test="/xsd:schema/@targetNamespace and $ns=normalize-space(/xsd:schema/@targetNamespace)">
- <span class="targetNS">
- <xsl:value-of select="$ns"/>
- </span>
- </xsl:when>
- <xsl:otherwise>
- <xsl:value-of select="$ns"/>
- </xsl:otherwise>
- </xsl:choose>
- </td>
- </tr>
- </xsl:if>
- <!-- Namespaces with prefixes -->
- <xsl:for-each select="namespace::*[local-name(.)!='']">
- <xsl:variable name="prefix" select="local-name(.)"/>
- <xsl:variable name="ns" select="."/>
- <tr>
- <td>
- <a name="{concat($NS_PREFIX, $prefix)}">
- <xsl:value-of select="$prefix"/>
- </a>
- </td>
- <td>
- <xsl:choose>
- <xsl:when test="/xsd:schema/@targetNamespace and $ns=normalize-space(/xsd:schema/@targetNamespace)">
- <span class="targetNS">
- <xsl:value-of select="$ns"/>
- </span>
- </xsl:when>
- <xsl:otherwise>
- <xsl:value-of select="$ns"/>
- </xsl:otherwise>
- </xsl:choose>
- </td>
- </tr>
- </xsl:for-each>
- </table>
- </xsl:template>
-
- <!--
- Prints out the Table of Contents.
- -->
- <xsl:template match="xsd:schema" mode="toc">
- <ul>
- <!-- Section: Schema Document Properties -->
- <li>
- <a href="#SchemaProperties">Schema Document Properties</a>
- </li>
-
- <!-- Section: Redefined Schema Components -->
- <xsl:if test="xsd:redefine">
- <li>
- <a href="#Redefinitions">Redefined Schema Components</a>
- </li>
- </xsl:if>
-
- <!-- Sections: Top-level Schema Components -->
- <xsl:choose>
- <!-- Sort schema components -->
- <xsl:when test="normalize-space(translate($sortByComponent,'TRUE','true'))='true'">
- <!-- Declarations -->
- <xsl:if test="xsd:attribute or xsd:element">
- <li><a href="#SchemaDeclarations">Global Declarations</a>
- <ul>
- <xsl:apply-templates select="xsd:attribute | xsd:element" mode="toc">
- <xsl:sort select="local-name(.)" order="ascending"/>
- <xsl:sort select="@name" order="ascending"/>
- </xsl:apply-templates>
- </ul>
- </li>
- </xsl:if>
- <!-- Definitions -->
- <xsl:if test="xsd:attributeGroup or xsd:complexType or xsd:group or xsd:notation or xsd:simpleType">
- <li><a href="#SchemaDefinitions">Global Definitions</a>
- <ul>
- <xsl:apply-templates select="xsd:attributeGroup | xsd:complexType | xsd:group | xsd:notation | xsd:simpleType" mode="toc">
- <xsl:sort select="local-name(.)" order="ascending"/>
- <xsl:sort select="@name" order="ascending"/>
- </xsl:apply-templates>
- </ul>
- </li>
- </xsl:if>
- </xsl:when>
- <!-- Display schema components in order as they appear in schema -->
- <xsl:otherwise>
- <li><a href="#SchemaComponents">Global Schema Components</a>
- <ul>
- <xsl:apply-templates select="xsd:attribute | xsd:attributeGroup | xsd:complexType | xsd:element | xsd:group | xsd:notation | xsd:simpleType" mode="toc"/>
- </ul>
- </li>
- </xsl:otherwise>
- </xsl:choose>
- </ul>
-
- <!-- Section: Legend -->
- <xsl:if test="normalize-space(translate($printLegend,'TRUE','true'))='true'">
- <ul id="legendTOC" style="margin-top: 0em">
- <li><a href="#Legend">Legend</a></li>
- </ul>
- </xsl:if>
-
- <!-- Section: Glossary -->
- <xsl:if test="normalize-space(translate($printGlossary,'TRUE','true'))='true'">
- <ul id="glossaryTOC" style="margin-top: 0em">
- <li><a href="#Glossary">Glossary</a></li>
- </ul>
- </xsl:if>
- </xsl:template>
-
- <!--
- Prints out a link to a top-level schema component section in the
- Table of Contents.
- -->
- <xsl:template match="xsd:*[@name]" mode="toc">
- <xsl:variable name="componentID">
- <xsl:call-template name="GetComponentID">
- <xsl:with-param name="component" select="."/>
- </xsl:call-template>
- </xsl:variable>
-
- <li>
- <a href="#{$componentID}">
- <xsl:call-template name="GetComponentDescription">
- <xsl:with-param name="component" select="."/>
- </xsl:call-template>
- <xsl:text>: </xsl:text>
- <strong><xsl:value-of select="@name"/></strong>
- </a>
- </li>
- </xsl:template>
-
- <!--
- Prints out the section for a top-level schema component.
- -->
- <xsl:template match="xsd:*[@name]" mode="topSection">
- <!-- Header -->
- <xsl:call-template name="ComponentSectionHeader">
- <xsl:with-param name="component" select="."/>
- </xsl:call-template>
-
- <!-- Hierarchy table (for types and elements) -->
- <xsl:apply-templates select="." mode="hierarchy"/>
-
- <!-- Properties table -->
- <xsl:apply-templates select="." mode="properties"/>
-
- <!-- XML Instance Representation table -->
- <xsl:call-template name="SampleInstanceTable">
- <xsl:with-param name="component" select="."/>
- </xsl:call-template>
-
- <!-- Schema Component Representation table -->
- <xsl:call-template name="SchemaComponentTable">
- <xsl:with-param name="component" select="."/>
- </xsl:call-template>
-
- <!-- Footer -->
- <xsl:call-template name="SectionFooter"/>
- </xsl:template>
-
- <!--
- Prints out the buttons that can expand and collapse all boxes in
- this page.
- -->
- <xsl:template name="GlobalControlButtons">
- <xsl:if test="normalize-space(translate($useJavaScript,'TRUE','true'))='true'">
- <div style="float: right;">
- <!-- Printer-friendly Version -->
- <div id="printerControls" style="display:none;">
- <input type="checkbox" onclick="displayMode(this.checked)"/>
- <xsl:text>Printer-friendly Version</xsl:text>
- </div>
- <xsl:call-template name="PrintJSCode">
- <xsl:with-param name="code">
-var pc = getElementObject("printerControls");
-if (pc != null) {
- pc.style.display="block";
-}
- </xsl:with-param>
- </xsl:call-template>
-
- <!-- Expand/Collapse All buttons -->
- <div id="globalControls" style="display:none">
- <strong>XML Instance Representation:</strong><br/>
- <span style="margin-left: 1em; white-space: nowrap">
- <xsl:text>[ </xsl:text>
- <a href="javascript:void(0)" onclick="expandAll(xiBoxes)">Expand All</a>
- <xsl:text> | </xsl:text>
- <a href="javascript:void(0)" onclick="collapseAll(xiBoxes)">Collapse All</a>
- <xsl:text> ]</xsl:text>
- </span><br/><br/>
- <strong>Schema Component Representation:</strong><br/>
- <span style="margin-left: 1em; white-space: nowrap">
- <xsl:text>[ </xsl:text>
- <a href="javascript:void(0)" onclick="expandAll(scBoxes)">Expand All</a>
- <xsl:text> | </xsl:text>
- <a href="javascript:void(0)" onclick="collapseAll(scBoxes)">Collapse All</a>
- <xsl:text> ]</xsl:text>
- </span>
- </div>
- <xsl:call-template name="PrintJSCode">
- <xsl:with-param name="code">
-var gc = getElementObject("globalControls");
-if (gc != null) {
- gc.style.display="block";
-}
- </xsl:with-param>
- </xsl:call-template>
- </div>
- </xsl:if>
- </xsl:template>
-
- <!--
- Prints out the section header of a top-level schema component.
- Param(s):
- component (Node) required
- Top-level schema component
- -->
- <xsl:template name="ComponentSectionHeader">
- <xsl:param name="component"/>
-
- <xsl:variable name="componentID">
- <xsl:call-template name="GetComponentID">
- <xsl:with-param name="component" select="$component"/>
- </xsl:call-template>
- </xsl:variable>
- <xsl:variable name="componentDescription">
- <xsl:call-template name="GetComponentDescription">
- <xsl:with-param name="component" select="$component"/>
- </xsl:call-template>
- </xsl:variable>
- <xsl:variable name="componentTermRef">
- <xsl:call-template name="GetComponentTermRef">
- <xsl:with-param name="component" select="$component"/>
- </xsl:call-template>
- </xsl:variable>
-
- <h3>
- <!-- Description -->
- <xsl:choose>
- <xsl:when test="$componentTermRef != ''">
- <xsl:call-template name="PrintGlossaryTermRef">
- <xsl:with-param name="code" select="$componentTermRef"/>
- <xsl:with-param name="term" select="$componentDescription"/>
- </xsl:call-template>
- </xsl:when>
- <xsl:otherwise>
- <xsl:value-of select="$componentDescription"/>
- </xsl:otherwise>
- </xsl:choose>
- <xsl:text>: </xsl:text>
- <!-- Name -->
- <a name="{$componentID}" class="name">
- <xsl:value-of select="$component/@name"/>
- </a>
- </h3>
- </xsl:template>
-
- <!--
- Prints out footer for top-level sections.
- -->
- <xsl:template name="SectionFooter">
- <!-- Link to top of page-->
- <div style="text-align: right; clear: both;"><a href="#top">top</a></div>
- <hr/>
- </xsl:template>
-
- <!--
- Java Script code required by the entire HTML document.
- -->
- <xsl:template name="DocumentJSCode">
- <!-- Get all IDs of XML Instance Representation boxes
- and place them in an array. -->
- <xsl:text>/* IDs of XML Instance Representation boxes */
-</xsl:text>
- <xsl:text>var xiBoxes = new Array(</xsl:text>
- <xsl:for-each select="/xsd:schema/xsd:*[@name]">
- <xsl:if test="position()!=1">
- <xsl:text>, </xsl:text>
- </xsl:if>
- <xsl:text>'</xsl:text>
- <xsl:call-template name="GetComponentID">
- <xsl:with-param name="component" select="."/>
- </xsl:call-template>
- <xsl:text>_xibox'</xsl:text>
- </xsl:for-each>
- <xsl:text>);
-</xsl:text>
- <!-- Get all IDs of Schema Component Representation boxes
- and place them in an array. -->
- <xsl:text>/* IDs of Schema Component Representation boxes */
-</xsl:text>
- <xsl:text>var scBoxes = new Array('schema_scbox'</xsl:text>
- <xsl:for-each select="/xsd:schema/xsd:*[@name]">
- <xsl:text>, '</xsl:text>
- <xsl:call-template name="GetComponentID">
- <xsl:with-param name="component" select="."/>
- </xsl:call-template>
- <xsl:text>_scbox'</xsl:text>
- </xsl:for-each>
- <xsl:text>);
-</xsl:text>
- <!-- Functions -->
- <xsl:text>
-/**
- * Can get the ID of the button controlling
- * a collapseable box by concatenating
- * this string onto the ID of the box itself.
- */
-var B_SFIX = "_button";
-
-/**
- * Counter of documentation windows
- * Used to give each window a unique name
- */
-var windowCount = 0;
-
-/**
- * Returns an element in the current HTML document.
- *
- * @param elementID Identifier of HTML element
- * @return HTML element object
- */
-function getElementObject(elementID) {
- var elemObj = null;
- if (document.getElementById) {
- elemObj = document.getElementById(elementID);
- }
- return elemObj;
-}
-
-/**
- * Closes a collapseable box.
- *
- * @param boxObj Collapseable box
- * @param buttonObj Button controlling box
- */
-function closeBox(boxObj, buttonObj) {
- if (boxObj == null || buttonObj == null) {
- // Box or button not found
- } else {
- // Change 'display' CSS property of box
- boxObj.style.display="none";
-
- // Change text of button
- if (boxObj.style.display=="none") {
- buttonObj.value=" + ";
- }
- }
-}
-
-/**
- * Opens a collapseable box.
- *
- * @param boxObj Collapseable box
- * @param buttonObj Button controlling box
- */
-function openBox(boxObj, buttonObj) {
- if (boxObj == null || buttonObj == null) {
- // Box or button not found
- } else {
- // Change 'display' CSS property of box
- boxObj.style.display="block";
-
- // Change text of button
- if (boxObj.style.display=="block") {
- buttonObj.value=" - ";
- }
- }
-}
-
-/**
- * Sets the state of a collapseable box.
- *
- * @param boxID Identifier of box
- * @param open If true, box is "opened",
- * Otherwise, box is "closed".
- */
-function setState(boxID, open) {
- var boxObj = getElementObject(boxID);
- var buttonObj = getElementObject(boxID+B_SFIX);
- if (boxObj == null || buttonObj == null) {
- // Box or button not found
- } else if (open) {
- openBox(boxObj, buttonObj);
- // Make button visible
- buttonObj.style.display="inline";
- } else {
- closeBox(boxObj, buttonObj);
- // Make button visible
- buttonObj.style.display="inline";
- }
-}
-
-/**
- * Switches the state of a collapseable box, e.g.
- * if it's opened, it'll be closed, and vice versa.
- *
- * @param boxID Identifier of box
- */
-function switchState(boxID) {
- var boxObj = getElementObject(boxID);
- var buttonObj = getElementObject(boxID+B_SFIX);
- if (boxObj == null || buttonObj == null) {
- // Box or button not found
- } else if (boxObj.style.display=="none") {
- // Box is closed, so open it
- openBox(boxObj, buttonObj);
- } else if (boxObj.style.display=="block") {
- // Box is opened, so close it
- closeBox(boxObj, buttonObj);
- }
-}
-
-/**
- * Closes all boxes in a given list.
- *
- * @param boxList Array of box IDs
- */
-function collapseAll(boxList) {
- var idx;
- for (idx = 0; idx &lt; boxList.length; idx++) {
- var boxObj = getElementObject(boxList[idx]);
- var buttonObj = getElementObject(boxList[idx]+B_SFIX);
- closeBox(boxObj, buttonObj);
- }
-}
-
-/**
- * Open all boxes in a given list.
- *
- * @param boxList Array of box IDs
- */
-function expandAll(boxList) {
- var idx;
- for (idx = 0; idx &lt; boxList.length; idx++) {
- var boxObj = getElementObject(boxList[idx]);
- var buttonObj = getElementObject(boxList[idx]+B_SFIX);
- openBox(boxObj, buttonObj);
- }
-}
-
-/**
- * Makes all the control buttons of boxes appear.
- *
- * @param boxList Array of box IDs
- */
-function viewControlButtons(boxList) {
- var idx;
- for (idx = 0; idx &lt; boxList.length; idx++) {
- buttonObj = getElementObject(boxList[idx]+B_SFIX);
- if (buttonObj != null) {
- buttonObj.style.display = "inline";
- }
- }
-}
-
-/**
- * Makes all the control buttons of boxes disappear.
- *
- * @param boxList Array of box IDs
- */
-function hideControlButtons(boxList) {
- var idx;
- for (idx = 0; idx &lt; boxList.length; idx++) {
- buttonObj = getElementObject(boxList[idx]+B_SFIX);
- if (buttonObj != null) {
- buttonObj.style.display = "none";
- }
- }
-}
-
-/**
- * Sets the page for either printing mode
- * or viewing mode. In printing mode, the page
- * is made to be more readable when printing it out.
- * In viewing mode, the page is more browsable.
- *
- * @param isPrinterVersion If true, display in
- * printing mode; otherwise,
- * in viewing mode
- */
-function displayMode(isPrinterVersion) {
- var obj;
- if (isPrinterVersion) {
- // Hide global control buttons
- obj = getElementObject("globalControls");
- if (obj != null) {
- obj.style.visibility = "hidden";
- }
- // Hide Legend
- obj = getElementObject("legend");
- if (obj != null) {
- obj.style.display = "none";
- }
- obj = getElementObject("legendTOC");
- if (obj != null) {
- obj.style.display = "none";
- }
- // Hide Glossary
- obj = getElementObject("glossary");
- if (obj != null) {
- obj.style.display = "none";
- }
- obj = getElementObject("glossaryTOC");
- if (obj != null) {
- obj.style.display = "none";
- }
-
- // Expand all XML Instance Representation tables
- expandAll(xiBoxes);
- // Expand all Schema Component Representation tables
- expandAll(scBoxes);
-
- // Hide Control buttons
- hideControlButtons(xiBoxes);
- hideControlButtons(scBoxes);
- } else {
- // View global control buttons
- obj = getElementObject("globalControls");
- if (obj != null) {
- obj.style.visibility = "visible";
- }
- // View Legend
- obj = getElementObject("legend");
- if (obj != null) {
- obj.style.display = "block";
- }
- obj = getElementObject("legendTOC");
- if (obj != null) {
- obj.style.display = "block";
- }
- // View Glossary
- obj = getElementObject("glossary");
- if (obj != null) {
- obj.style.display = "block";
- }
- obj = getElementObject("glossaryTOC");
- if (obj != null) {
- obj.style.display = "block";
- }
-
- // Expand all XML Instance Representation tables
- expandAll(xiBoxes);
- // Collapse all Schema Component Representation tables
- collapseAll(scBoxes);
-
- // View Control buttons
- viewControlButtons(xiBoxes);
- viewControlButtons(scBoxes);
- }
-}
-
-/**
- * Opens up a window displaying the documentation
- * of a schema component in the XML Instance
- * Representation table.
- *
- * @param compDesc Description of schema component
- * @param compName Name of schema component
- * @param docTextArray Array containing the paragraphs
- * of the new document
- */
-function viewDocumentation(compDesc, compName, docTextArray) {
- var width = 400;
- var height = 200;
- var locX = 100;
- var locY = 200;
-
- /* Generate content */
- var actualText = "&lt;html>";
- actualText += "&lt;head>&lt;title>";
- actualText += compDesc;
- if (compName != '') {
- actualText += ": " + compName;
- }
- actualText += "&lt;/title>&lt;/head>";
- actualText += "&lt;body bgcolor=\"#FFFFEE\">";
- // Title
- actualText += "&lt;p style=\"font-family: Arial, sans-serif; font-size: 12pt; font-weight: bold; letter-spacing:1px;\">";
- actualText += compDesc;
- if (compName != '') {
- actualText += ": &lt;span style=\"color:#006699\">" + compName + "&lt;/span>";
- }
- actualText += "&lt;/p>";
- // Documentation
- var idx;
- for (idx = 0; idx &lt; docTextArray.length; idx++) {
- actualText += "&lt;p style=\"font-family: Arial, sans-serif; font-size: 10pt;\">" + docTextArray[idx] + "&lt;/p>";
- }
- // Link to close window
- actualText += "&lt;a href=\"javascript:void(0)\" onclick=\"window.close();\" style=\"font-family: Arial, sans-serif; font-size: 8pt;\">Close&lt;/a>";
- actualText += "&lt;/body>&lt;/html>";
-
- /* Display window */
- windowCount++;
- 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);
- docWindow.document.write(actualText);
-}
-</xsl:text>
- </xsl:template>
-
- <!--
- CSS properties for the entire HTML document.
- -->
- <xsl:template name="DocumentCSSStyles">
- <xsl:text>
-/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
-/* More-configurable styles */
-
-/******** General ********/
-
-/* Document body */
-body {
- color: Black;
- background-color: White;
- font-family: Arial, sans-serif;
- font-size: 10pt;
-}
-/* Horizontal rules */
-hr {
- color: black;
-}
-/* Document title */
-h1 {
- font-size: 18pt;
- letter-spacing: 2px;
- border-bottom: 1px #ccc solid;
- padding-top: 5px;
- padding-bottom: 5px;
-}
-/* Main section headers */
-h2 {
- font-size: 14pt;
- letter-spacing: 1px;
-}
-/* Sub-section headers */
-h3, h3 a, h3 span {
- font-size: 12pt;
- font-weight: bold;
- color: black;
-}
-/* Table displaying the properties of the schema components or the
- schema document itself */
-table.properties th, table.properties th a {
- color: black;
- background-color: #F99; /* Pink */
-}
-table.properties td {
- background-color: #eee; /* Gray */
-}
-
-
-/******** Table of Contents Section ********/
-
-/* Controls for switching between printing and viewing modes */
-div#printerControls {
- color: #963; /* Orange-brown */
-}
-/* Controls that can collapse or expand all XML Instance
- Representation and Schema Component Representation boxes */
-div#globalControls {
- border: 2px solid #999;
-}
-
-
-/******** Schema Document Properties Section ********/
-
-/* Table displaying the namespaces declared in the schema */
-table.namespaces th {
- background-color: #ccc;
-}
-table.namespaces td {
- background-color: #eee;
-}
-/* Target namespace of the schema */
-span.targetNS {
- color: #06C;
- font-weight: bold;
-}
-
-
-/******** Schema Components' Sections ********/
-
-/* Name of schema component */
-.name {
- color: #F93; /* Orange */
-}
-
-/* Hierarchy table */
-table.hierarchy {
- border: 2px solid #999; /* Gray */
-}
-
-/* XML Instance Representation table */
-div.sample div.contents {
- border: 2px dashed black;
-}
-
-/* Schema Component Representation table */
-div.schemaComponent div.contents {
- border: 2px black solid;
-}
-
-
-/******** Glossary Section ********/
-
-/* Glossary Terms */
-.glossaryTerm {
- color: #036; /* Blue */
-}
-
-
-/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
-/* Printer-version styles */
-
-@media print {
-
-/* Ensures that controls are hidden when printing */
-div#printerControls {
- visibility: hidden;
-}
-div#globalControls {
- visibility: hidden;
-}
-#legend {
- display: none;
-}
-#legendTOC {
- display: none;
-}
-#glossary {
- display: none;
-}
-#glossaryTOC {
- display: none;
-}
-
-}
-
-/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
-/* Base styles */
-
-/******** General ********/
-
-/* Unordered lists */
-ul {
- margin-left: 1.5em;
- margin-bottom: 0em;
-}
-/* Tables */
-table {
- margin-top: 10px;
- margin-bottom: 10px;
- margin-left: 2px;
- margin-right: 2px;
-}
-table th, table td {
- font-size: 10pt;
- vertical-align: top;
- padding-top: 3px;
- padding-bottom: 3px;
- padding-left: 10px;
- padding-right: 10px;
-}
-table th {
- font-weight: bold;
- text-align: left;
-}
-/* Table displaying the properties of the schema components or the
- schema document itself */
-table.properties {
- width: 90%;
-}
-table.properties th {
- width: 30%;
-}
-/* Boxes that can make its content appear and disappear*/
-div.box {
- margin: 1em;
-}
- /* Box caption */
-div.box span.caption {
- font-weight: bold;
-}
- /* Button to open and close the box */
-div.box input.control {
- width: 1.4em;
- height: 1.4em;
- text-align: center;
- vertical-align: middle;
- font-size: 11pt;
-}
- /* Box contents */
-div.box div.contents {
- margin-top: 3px;
-}
-
-
-/******** Table of Contents Section ********/
-
-/* Controls for switching between printing and viewing modes */
-div#printerControls {
- white-space: nowrap;
- font-weight: bold;
- padding: 5px;
- margin: 5px;
-}
-/* Controls that can collapse or expand all XML Instance
- Representation and Schema Component Representation boxes */
-div#globalControls {
- padding: 10px;
- margin: 5px;
-}
-
-
-/******** Schema Document Properties Section ********/
-
-/* Table displaying the namespaces declared in the schema */
-table.namespaces th {
-}
-table.namespaces td {
-}
-/* Target namespace of the schema */
-span.targetNS {
-}
-
-
-/******** Schema Components' Sections ********/
-
-/* Name of schema component */
-.name {
-}
-
-/* Hierarchy table */
-table.hierarchy {
- width: 90%;
-}
-table.hierarchy th {
- font-weight: normal;
- font-style: italic;
- width: 20%;
-}
-table.hierarchy th, table.hierarchy td {
- padding: 5px;
-}
-
-/* XML Instance Representation table */
-div.sample {
- width: 90%;
-}
-div.sample div.contents {
- padding: 5px;
- font-family: Courier New, sans-serif;
- font-size: 10pt;
-}
- /* Normal elements and attributes */
-div.sample div.contents, div.sample div.contents a {
- color: black;
-}
- /* Group Headers */
-div.sample div.contents .group, div.sample div.contents .group a {
- color: #999; /* Light gray */
-}
- /* Type Information */
-div.sample div.contents .type, div.sample div.contents .type a {
- color: #999; /* Light gray */
-}
- /* Occurrence Information */
-div.sample div.contents .occurs, div.sample div.contents .occurs a {
- color: #999; /* Light gray */
-}
- /* Fixed values */
-div.sample div.contents .fixed {
- color: #063; /* Green */
- font-weight: bold;
-}
- /* Simple type constraints */
-div.sample div.contents .constraint, div.sample div.contents .constraint a {
- color: #999; /* Light gray */
-}
- /* Elements and attributes inherited from base type */
-div.sample div.contents .inherited, div.sample div.contents .inherited a {
- color: #666; /* Dark gray */
-}
- /* Elements and attributes added to or changed from base type */
-div.sample div.contents .newFields {
- font-weight: bold;
-}
- /* Other type of information */
-div.sample div.contents .other, div.sample div.contents .other a {
- color: #369; /* Blue */
- font-style: italic;
-}
- /* Link to open up window displaying documentation */
-div.sample div.contents a.documentation {
- text-decoration: none;
- padding-left: 3px;
- padding-right: 3px;
- padding-top: 0px;
- padding-bottom: 0px;
- font-weight: bold;
- font-size: 11pt;
- background-color: #FFD;
- color: #069;
-}
- /* Invert colors when hovering over link to open up window
- displaying documentation */
-div.sample div.contents a.documentation:hover {
- color: #FFD;
- background-color: #069;
-}
-
-/* Schema Component Representation table */
-div.schemaComponent {
- width: 90%;
-}
-div.schemaComponent div.contents {
- font-family: Courier New, sans-serif;
- font-size: 10pt;
- padding: 5px;
-}
- /* Syntax characters */
-div.schemaComponent div.contents {
- color: #00f; /* blue */
-}
- /* Element and attribute tags */
-div.schemaComponent div.contents .scTag {
- color: #933; /* maroon */
-}
- /* Element and attribute content */
-div.schemaComponent div.contents .scContent, div.schemaComponent div.contents .scContent a {
- color: black;
- font-weight: bold;
-}
- /* Comments */
-div.schemaComponent div.contents .comment {
- color: #999; /* Light gray */
-}
-
-/******** Legend Section ********/
-
-div#legend table, div#legend div {
- margin-bottom: 3px;
-}
-div#legend div.hint {
- color: #999; /* Light gray */
- width: 90%;
- margin-left: 1em;
- margin-bottom: 2em;
-}
-
-
-/******** Glossary Section ********/
-
-/* Glossary Terms */
-.glossaryTerm {
- font-weight: bold;
-}
-
-
-/******** Footer ********/
-
-.footer {
- font-size: 8pt;
-}
-</xsl:text>
- </xsl:template>
-
- <!--
- Print outs a legend describing the meaning of colors, bold items,
- etc. in the top-level sections.
- -->
- <xsl:template name="Legend">
- <!-- Header -->
- <div style="float: left; width: 15em;">
- <h3 style="margin-bottom: 0px;">Complex Type:</h3>
- <div class="hint" style="margin-left: 0em;">Schema Component Type</div>
- </div>
- <div style="float: left; width: 15em;">
- <h3 style="margin-bottom: 0px;"><span class="name">AusAddress</span></h3>
- <div class="hint" style="margin-left: 0em;">Schema Component Name</div>
- </div>
-
- <!-- Hierarchy Table -->
- <table class="hierarchy" style="clear : both">
- <tr>
- <xsl:choose>
- <xsl:when test="normalize-space(translate($printAllSuperTypes, 'TRUE', 'true'))='true'">
- <th>Super-types:</th>
- <td>
- <span class="type" style="color: #0000FF; text-decoration:underline;">Address</span>
- <xsl:text> &lt; </xsl:text>
- <span class="current">AusAddress</span>
- <xsl:text> (by extension)</xsl:text>
- </td>
- </xsl:when>
- <xsl:otherwise>
- <th>Parent type:</th>
- <td>
- <span class="type" style="color: #0000FF; text-decoration:underline;">Address</span>
- <xsl:text> (derivation method: extension)</xsl:text>
- </td>
- </xsl:otherwise>
- </xsl:choose>
- </tr>
- <tr>
- <xsl:choose>
- <xsl:when test="normalize-space(translate($printAllSubTypes, 'TRUE', 'true'))='true'">
- <th>Sub-types:</th>
- <td>
- <ul>
- <li>
- <span class="type" style="color: #0000FF; text-decoration:underline;">QLDAddress</span>
- <xsl:text> (by restriction)</xsl:text>
- </li>
- </ul>
- </td>
- </xsl:when>
- <xsl:otherwise>
- <th>Direct sub-types:</th>
- <td>
- <ul>
- <li>
- <span class="type" style="color: #0000FF; text-decoration:underline;">QLDAddress</span>
- <xsl:text> (by restriction)</xsl:text>
- </li>
- </ul>
- </td>
- </xsl:otherwise>
- </xsl:choose>
- </tr>
- </table>
- <div class="hint">If this schema component is a type definition, its type hierarchy is shown in a gray-bordered box.</div>
-
- <!-- Properties Table -->
- <table class="properties">
- <tr>
- <th>Name</th>
- <td>AusAddress</td>
- </tr>
- <tr>
- <th>
- <a title="Look up 'Abstract' in glossary" href="#term_Abstract">Abstract</a>
- </th>
- <td>no</td>
- </tr>
- </table>
- <div class="hint">The table above displays the properties of this schema component.</div>
-
- <!-- XML Instance Representation Table -->
- <div class="sample box">
- <div>
- <span class="caption">XML Instance Representation</span>
- </div>
- <div class="contents">
- <span style="margin-left: 0em">&lt;...</span>
- <span class="newFields">
- <span> country="<span class="fixed">Australia</span>"</span>
- </span>
- <xsl:text>&gt; </xsl:text><br/>
- <span style="margin-left: 1.5em" class="inherited">&lt;unitNo&gt; <span class="type">string</span> &lt;/unitNo&gt; <span class="occurs">[0..1]</span></span><br/>
- <span style="margin-left: 1.5em" class="inherited">&lt;houseNo&gt; <span class="type">string</span> &lt;/houseNo&gt; <span class="occurs">[1]</span></span><br/>
- <span style="margin-left: 1.5em" class="inherited">&lt;street&gt; <span class="type">string</span> &lt;/street&gt; <span class="occurs">[1]</span></span><br/>
- <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/>
- <span style="margin-left: 3em" class="inherited">&lt;city&gt; <span class="type">string</span> &lt;/city&gt; <span class="occurs">[1]</span></span><br/>
- <span style="margin-left: 3em" class="inherited">&lt;town&gt; <span class="type">string</span> &lt;/town&gt; <span class="occurs">[1]</span></span><br/>
- <span class="group" style="margin-left: 1.5em">End Choice</span><br/>
- <span class="newFields">
- <span style="margin-left: 1.5em">&lt;state&gt; <span class="type" style="text-decoration:underline;">AusStates</span> &lt;/state&gt; <span class="occurs">[1]</span></span><br/>
- <span style="margin-left: 1.5em">&lt;postcode&gt; <span class="constraint">string &lt;&lt;<em>pattern</em> = [1-9][0-9]{3}>></span> &lt;/postcode&gt; <span class="occurs">[1]</span>
- <xsl:if test="normalize-space(translate($useJavaScript,'TRUE','true'))='true'">
- <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>
- </xsl:if>
- </span><br/>
- </span>
- <span style="margin-left: 0em">&lt;/...&gt;</span><br/>
- </div>
- </div>
- <div class="hint">
- <p>The XML Instance Representation table above shows the schema component's content as an XML instance.</p>
- <ul>
- <li>The minimum and maximum occurrence of elements and attributes are provided in square brackets, e.g. [0..1].</li>
- <li>Model group information are shown in gray, e.g. Start Choice ... End Choice.</li>
- <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>
- <li>If an element/attribute has a fixed value, the fixed value is shown in green, e.g. country="Australia".</li>
- <li>Otherwise, the type of the element/attribute is displayed.
- <ul>
- <li>If the element/attribute's type is in the schema, a link is provided to it.</li>
- <!--<li>An <em>E</em> symbol is shown if the element/attribute's type is located in an external schema.</li>-->
- <li>For local simple type definitions, the constraints are displayed in angle brackets, e.g. &lt;&lt;<em>pattern</em> = [1-9][0-9]{3}>>.</li>
- </ul>
- </li>
- <xsl:if test="normalize-space(translate($useJavaScript,'TRUE','true'))='true'">
- <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. &lt;postcode>.</li>
- </xsl:if>
- </ul>
- </div>
-
- <!-- Schema Component Representation Table -->
- <div class="schemaComponent box">
- <div>
- <span class="caption">Schema Component Representation</span>
- </div>
- <div class="contents">
- <span style="margin-left: 0em">&lt;<span class="scTag">complexType</span> <span class="scTag">name</span>="<span class="scContent">AusAddress</span>"&gt;</span><br/>
- <span style="margin-left: 1.5em">&lt;<span class="scTag">complexContent</span>&gt;</span><br/>
- <span style="margin-left: 3em">&lt;<span class="scTag">extension</span> <span class="scTag">base</span>="<span class="scContent"><span class="type" style="text-decoration:underline;">Address</span></span>"&gt;</span><br/>
- <span style="margin-left: 4.5em">&lt;<span class="scTag">sequence</span>&gt;</span><br/>
- <span style="margin-left: 6em">&lt;<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>"/&gt;</span><br/>
- <span style="margin-left: 6em">&lt;<span class="scTag">element</span> <span class="scTag">name</span>="<span class="scContent">postcode</span>"&gt;</span><br/>
- <span style="margin-left: 7.5em">&lt;<span class="scTag">simpleType</span>&gt;</span><br/>
- <span style="margin-left: 9em">&lt;<span class="scTag">restriction</span> <span class="scTag">base</span>="<span class="scContent"><span class="type">string</span></span>"&gt;</span><br/>
- <span style="margin-left: 10.5em">&lt;<span class="scTag">pattern</span> <span class="scTag">value</span>="<span class="scContent">[1-9][0-9]{3}</span>"/&gt;</span><br/>
- <span style="margin-left: 9em">&lt;/<span class="scTag">restriction</span>&gt;</span><br/>
- <span style="margin-left: 7.5em">&lt;/<span class="scTag">simpleType</span>&gt;</span><br/>
- <span style="margin-left: 6em">&lt;/<span class="scTag">element</span>&gt;</span><br/>
- <span style="margin-left: 4.5em">&lt;/<span class="scTag">sequence</span>&gt;</span><br/>
- <span style="margin-left: 4.5em">&lt;<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>"/&gt;</span><br/>
- <span style="margin-left: 3em">&lt;/<span class="scTag">extension</span>&gt;</span><br/>
- <span style="margin-left: 1.5em">&lt;/<span class="scTag">complexContent</span>&gt;</span><br/>
- <span style="margin-left: 0em">&lt;/<span class="scTag">complexType</span>&gt;</span><br/>
- </div>
- </div>
- <div class="hint">The Schema Component Representation table above displays the underlying XML representation of the schema component. (Annotations are not shown.)</div>
- </xsl:template>
-
- <!--
- Print outs all terms for the glossary section.
- -->
- <xsl:template name="Glossary">
- <xsl:call-template name="PrintGlossaryTerm">
- <xsl:with-param name="code">Abstract</xsl:with-param>
- <xsl:with-param name="term">Abstract</xsl:with-param>
- <xsl:with-param name="description">
- <xsl:text>(Applies to complex type definitions and element declarations).</xsl:text>
- <xsl:text> An abstract element or complex type cannot used to validate an element instance.</xsl:text>
- <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>
- <xsl:text> For references to abstract type definitions, only derived types can be used.</xsl:text>
- </xsl:with-param>
- </xsl:call-template>
-
- <xsl:call-template name="PrintGlossaryTerm">
- <xsl:with-param name="code">All</xsl:with-param>
- <xsl:with-param name="term">All Model Group</xsl:with-param>
- <xsl:with-param name="description">
- <xsl:text>Child elements can be provided </xsl:text>
- <em>
- <xsl:text>in any order</xsl:text>
- </em>
- <xsl:text> in instances.</xsl:text>
- </xsl:with-param>
- <xsl:with-param name="link">http://www.w3.org/TR/xmlschema-1/#element-all</xsl:with-param>
- </xsl:call-template>
-
- <xsl:call-template name="PrintGlossaryTerm">
- <xsl:with-param name="code">Choice</xsl:with-param>
- <xsl:with-param name="term">Choice Model Group</xsl:with-param>
- <xsl:with-param name="description">
- <em>
- <xsl:text>Only one</xsl:text>
- </em>
- <xsl:text> from the list of child elements and model groups can be provided in instances.</xsl:text>
- </xsl:with-param>
- <xsl:with-param name="link">http://www.w3.org/TR/xmlschema-1/#element-choice</xsl:with-param>
- </xsl:call-template>
-
- <xsl:call-template name="PrintGlossaryTerm">
- <xsl:with-param name="code">CollapseWS</xsl:with-param>
- <xsl:with-param name="term">Collapse Whitespace Policy</xsl:with-param>
- <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>
- </xsl:call-template>
-
- <xsl:call-template name="PrintGlossaryTerm">
- <xsl:with-param name="code">ElemBlock</xsl:with-param>
- <xsl:with-param name="term">Disallowed Substitutions</xsl:with-param>
- <xsl:with-param name="description">
- <xsl:text>(Applies to element declarations).</xsl:text>
- <xsl:text> If </xsl:text>
- <em>substitution</em>
- <xsl:text> is specified, then </xsl:text>
- <xsl:call-template name="PrintGlossaryTermRef">
- <xsl:with-param name="code">SubGroup</xsl:with-param>
- <xsl:with-param name="term">substitution group</xsl:with-param>
- </xsl:call-template>
- <xsl:text> members cannot be used in place of the given element declaration to validate element instances.</xsl:text>
-
- <xsl:text> If </xsl:text>
- <em>derivation methods</em>
- <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>
- <xsl:text> Normally, element instances can override their declaration's type by specifying an </xsl:text>
- <code>xsi:type</code>
- <xsl:text> attribute.</xsl:text>
- </xsl:with-param>
- </xsl:call-template>
-
- <xsl:call-template name="PrintGlossaryTerm">
- <xsl:with-param name="code">Key</xsl:with-param>
- <xsl:with-param name="term">Key Constraint</xsl:with-param>
- <xsl:with-param name="description">
- <xsl:text>Like </xsl:text>
- <xsl:call-template name="PrintGlossaryTermRef">
- <xsl:with-param name="code">Unique</xsl:with-param>
- <xsl:with-param name="term">Uniqueness Constraint</xsl:with-param>
- </xsl:call-template>
- <xsl:text>, but additionally requires that the specified value(s) must be provided.</xsl:text>
- </xsl:with-param>
- <xsl:with-param name="link">http://www.w3.org/TR/xmlschema-1/#cIdentity-constraint_Definitions</xsl:with-param>
- </xsl:call-template>
-
- <xsl:call-template name="PrintGlossaryTerm">
- <xsl:with-param name="code">KeyRef</xsl:with-param>
- <xsl:with-param name="term">Key Reference Constraint</xsl:with-param>
- <xsl:with-param name="description">
- <xsl:text>Ensures that the specified value(s) must match value(s) from a </xsl:text>
- <xsl:call-template name="PrintGlossaryTermRef">
- <xsl:with-param name="code">Key</xsl:with-param>
- <xsl:with-param name="term">Key Constraint</xsl:with-param>
- </xsl:call-template>
- <xsl:text> or </xsl:text>
- <xsl:call-template name="PrintGlossaryTermRef">
- <xsl:with-param name="code">Unique</xsl:with-param>
- <xsl:with-param name="term">Uniqueness Constraint</xsl:with-param>
- </xsl:call-template>
- <xsl:text>.</xsl:text>
- </xsl:with-param>
- <xsl:with-param name="link">http://www.w3.org/TR/xmlschema-1/#cIdentity-constraint_Definitions</xsl:with-param>
- </xsl:call-template>
-
- <xsl:call-template name="PrintGlossaryTerm">
- <xsl:with-param name="code">ModelGroup</xsl:with-param>
- <xsl:with-param name="term">Model Group</xsl:with-param>
- <xsl:with-param name="description">
- <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>
- </xsl:with-param>
- <xsl:with-param name="link">http://www.w3.org/TR/xmlschema-1/#Model_Groups</xsl:with-param>
- </xsl:call-template>
-
- <xsl:call-template name="PrintGlossaryTerm">
- <xsl:with-param name="code">Nillable</xsl:with-param>
- <xsl:with-param name="term">Nillable</xsl:with-param>
- <xsl:with-param name="description">
- <xsl:text>(Applies to element declarations). </xsl:text>
- <xsl:text>If an element declaration is nillable, instances can use the </xsl:text>
- <code>xsi:nil</code>
- <xsl:text> attribute.</xsl:text>
- <xsl:text> The </xsl:text>
- <code>xsi:nil</code>
- <xsl:text> attribute is the boolean attribute, </xsl:text>
- <em>nil</em>
- <xsl:text>, from the </xsl:text>
- <em>http://www.w3.org/2001/XMLSchema-instance</em>
- <xsl:text> namespace.</xsl:text>
- <xsl:text> If an element instance has an </xsl:text>
- <code>xsi:nil</code>
- <xsl:text> attribute set to true, it can be left empty, even though its element declaration may have required content.</xsl:text>
- </xsl:with-param>
- </xsl:call-template>
-
- <xsl:call-template name="PrintGlossaryTerm">
- <xsl:with-param name="code">Notation</xsl:with-param>
- <xsl:with-param name="term">Notation</xsl:with-param>
- <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>
- <xsl:with-param name="link">http://www.w3.org/TR/xmlschema-1/#cNotation_Declarations</xsl:with-param>
- </xsl:call-template>
-
- <xsl:call-template name="PrintGlossaryTerm">
- <xsl:with-param name="code">PreserveWS</xsl:with-param>
- <xsl:with-param name="term">Preserve Whitespace Policy</xsl:with-param>
- <xsl:with-param name="description">Preserve whitespaces exactly as they appear in instances.</xsl:with-param>
- </xsl:call-template>
-
- <xsl:call-template name="PrintGlossaryTerm">
- <xsl:with-param name="code">TypeFinal</xsl:with-param>
- <xsl:with-param name="term">Prohibited Derivations</xsl:with-param>
- <xsl:with-param name="description">
- <xsl:text>(Applies to type definitions). </xsl:text>
- <xsl:text>Derivation methods that cannot be used to create sub-types from a given type definition.</xsl:text>
- </xsl:with-param>
- </xsl:call-template>
-
- <xsl:call-template name="PrintGlossaryTerm">
- <xsl:with-param name="code">TypeBlock</xsl:with-param>
- <xsl:with-param name="term">Prohibited Substitutions</xsl:with-param>
- <xsl:with-param name="description">
- <xsl:text>(Applies to complex type definitions). </xsl:text>
- <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>
- </xsl:with-param>
- </xsl:call-template>
-
- <xsl:call-template name="PrintGlossaryTerm">
- <xsl:with-param name="code">ReplaceWS</xsl:with-param>
- <xsl:with-param name="term">Replace Whitespace Policy</xsl:with-param>
- <xsl:with-param name="description">Replace tab, line feed, and carriage return characters with space character (Unicode character 32).</xsl:with-param>
- </xsl:call-template>
-
- <xsl:call-template name="PrintGlossaryTerm">
- <xsl:with-param name="code">Sequence</xsl:with-param>
- <xsl:with-param name="term">Sequence Model Group</xsl:with-param>
- <xsl:with-param name="description">
- <xsl:text>Child elements and model groups must be provided </xsl:text>
- <em>
- <xsl:text>in the specified order</xsl:text>
- </em>
- <xsl:text> in instances.</xsl:text>
- </xsl:with-param>
- <xsl:with-param name="link">http://www.w3.org/TR/xmlschema-1/#element-sequence</xsl:with-param>
- </xsl:call-template>
-
- <xsl:call-template name="PrintGlossaryTerm">
- <xsl:with-param name="code">SubGroup</xsl:with-param>
- <xsl:with-param name="term">Substitution Group</xsl:with-param>
- <xsl:with-param name="description">
- <xsl:text>Elements that are </xsl:text>
- <em>
- <xsl:text>members</xsl:text>
- </em>
- <xsl:text> of a substitution group can be used wherever the </xsl:text>
- <em>
- <xsl:text>head</xsl:text>
- </em>
- <xsl:text> element of the substitution group is referenced.</xsl:text>
- </xsl:with-param>
- </xsl:call-template>
-
- <xsl:call-template name="PrintGlossaryTerm">
- <xsl:with-param name="code">ElemFinal</xsl:with-param>
- <xsl:with-param name="term">Substitution Group Exclusions</xsl:with-param>
- <xsl:with-param name="description">
- <xsl:text>(Applies to element declarations). </xsl:text>
- <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>
- </xsl:with-param>
- </xsl:call-template>
-
- <xsl:call-template name="PrintGlossaryTerm">
- <xsl:with-param name="code">TargetNS</xsl:with-param>
- <xsl:with-param name="term">Target Namespace</xsl:with-param>
- <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>
- </xsl:call-template>
-
- <xsl:call-template name="PrintGlossaryTerm">
- <xsl:with-param name="code">Unique</xsl:with-param>
- <xsl:with-param name="term">Uniqueness Constraint</xsl:with-param>
- <xsl:with-param name="description">Ensures uniqueness of an element/attribute value, or a combination of values, within a specified scope.</xsl:with-param>
- <xsl:with-param name="link">http://www.w3.org/TR/xmlschema-1/#cIdentity-constraint_Definitions</xsl:with-param>
- </xsl:call-template>
- </xsl:template>
-
- <!--
- Prints out a term in the glossary section.
- Param(s):
- code (String) required
- Unique ID of glossary term
- term (String) required
- Glossary term
- description (Result Tree Fragment) required
- Meaning of term; may contain HTML tags and links
- link (String) optional
- URI containing more info about term
- -->
- <xsl:template name="PrintGlossaryTerm">
- <xsl:param name="code"/>
- <xsl:param name="term"/>
- <xsl:param name="description"/>
- <xsl:param name="link"/>
-
- <p>
- <span class="glossaryTerm">
- <a name="{concat($TERM_PREFIX, $code)}"><xsl:value-of select="$term"/></a>
- <xsl:text> </xsl:text>
- </span>
- <xsl:copy-of select="$description"/>
- <xsl:if test="$link != ''">
- <xsl:text> See: </xsl:text>
- <xsl:call-template name="PrintURI">
- <xsl:with-param name="uri" select="$link"/>
- </xsl:call-template>
- <xsl:text>.</xsl:text>
- </xsl:if>
- </p>
- </xsl:template>
-
-
- <!-- ******** Hierarchy table ******** -->
-
- <!--
- Prints out substitution group hierarchy for
- element declarations.
- -->
- <xsl:template match="xsd:element" mode="hierarchy">
- <!--
- Find out members of substitution group that this element
- heads.
- -->
- <xsl:variable name="members">
- <ul>
- <xsl:call-template name="PrintSGroupMembers">
- <xsl:with-param name="element" select="."/>
- </xsl:call-template>
- </ul>
- </xsl:variable>
- <xsl:variable name="hasMembers">
- <xsl:if test="normalize-space($members)!=''">
- <xsl:text>true</xsl:text>
- </xsl:if>
- </xsl:variable>
- <!-- Print hierarchy table -->
- <xsl:if test="@substitutionGroup or normalize-space($hasMembers)='true'">
- <table class="hierarchy">
- <tr>
- <td>
- <ul>
- <!-- Print substitution group that this element belongs to -->
- <xsl:if test="@substitutionGroup">
- <li>
- <em>This element can be used wherever the following element is referenced:</em>
- <ul>
- <li>
- <xsl:call-template name="PrintElementRef">
- <xsl:with-param name="ref" select="@substitutionGroup"/>
- </xsl:call-template>
- </li>
- </ul>
- </li>
- </xsl:if>
- <!-- Print substitution group that this element heads -->
- <xsl:if test="normalize-space($hasMembers)='true'">
- <li>
- <em>The following elements can be used wherever this element is referenced:</em>
- <xsl:copy-of select="$members"/>
- </li>
- </xsl:if>
- </ul>
- </td>
- </tr>
- </table>
- </xsl:if>
- </xsl:template>
-
- <!--
- Prints out Hierarchy table for complex type definitions.
- -->
- <xsl:template match="xsd:complexType" mode="hierarchy">
- <table class="hierarchy">
- <!-- Print super types -->
- <tr>
- <th>
- <xsl:choose>
- <xsl:when test="normalize-space(translate($printAllSuperTypes, 'TRUE', 'true'))='true'">
- <xsl:text>Super-types:</xsl:text>
- </xsl:when>
- <xsl:otherwise>
- <xsl:text>Parent type:</xsl:text>
- </xsl:otherwise>
- </xsl:choose>
- </th>
- <td>
- <xsl:choose>
- <xsl:when test="xsd:simpleContent or xsd:complexContent">
- <xsl:call-template name="PrintSupertypes">
- <xsl:with-param name="type" select="."/>
- </xsl:call-template>
- </xsl:when>
- <xsl:otherwise>
- <xsl:text>None</xsl:text>
- </xsl:otherwise>
- </xsl:choose>
- </td>
- </tr>
- <!-- Print sub types -->
- <tr>
- <th>
- <xsl:choose>
- <xsl:when test="normalize-space(translate($printAllSubTypes, 'TRUE', 'true'))='true'">
- <xsl:text>Sub-types:</xsl:text>
- </xsl:when>
- <xsl:otherwise>
- <xsl:text>Direct sub-types:</xsl:text>
- </xsl:otherwise>
- </xsl:choose>
- </th>
- <td>
- <xsl:call-template name="PrintComplexSubtypes">
- <xsl:with-param name="type" select="."/>
- </xsl:call-template>
- </td>
- </tr>
- </table>
- </xsl:template>
-
- <!--
- Prints out Hierarchy table for simple type definitions.
- -->
- <xsl:template match="xsd:simpleType" mode="hierarchy">
- <table class="hierarchy">
- <!-- Print super types -->
- <tr>
- <th>
- <xsl:choose>
- <xsl:when test="normalize-space(translate($printAllSuperTypes, 'TRUE', 'true'))='true'">
- <xsl:text>Super-types:</xsl:text>
- </xsl:when>
- <xsl:otherwise>
- <xsl:text>Parent type:</xsl:text>
- </xsl:otherwise>
- </xsl:choose>
- </th>
- <td>
- <xsl:choose>
- <xsl:when test="xsd:restriction">
- <xsl:call-template name="PrintSupertypes">
- <xsl:with-param name="type" select="."/>
- </xsl:call-template>
- </xsl:when>
- <xsl:otherwise>
- <xsl:text>None</xsl:text>
- </xsl:otherwise>
- </xsl:choose>
- </td>
- </tr>
- <!-- Print sub types -->
- <tr>
- <th>
- <xsl:choose>
- <xsl:when test="normalize-space(translate($printAllSubTypes, 'TRUE', 'true'))='true'">
- <xsl:text>Sub-types:</xsl:text>
- </xsl:when>
- <xsl:otherwise>
- <xsl:text>Direct sub-types:</xsl:text>
- </xsl:otherwise>
- </xsl:choose>
- </th>
- <td>
- <xsl:call-template name="PrintSimpleSubtypes">
- <xsl:with-param name="type" select="."/>
- </xsl:call-template>
- </td>
- </tr>
- </table>
- </xsl:template>
-
- <!--
- Unmatched template for 'hierarchy' mode
- -->
- <xsl:template match="*" mode="hierarchy"/>
-
- <!--
- Prints out members, if any, of the substitution group that a
- given element declaration heads.
- Assumes it will be called within XHTML <ul> tags.
- Param(s):
- element (Node) required
- Top-level element declaration
- elementList (String) optional
- List of elements in this call chain. Name of element starts
- with '*', and ends with '+'. (Used to prevent infinite
- recursive loop.)
- -->
- <xsl:template name="PrintSGroupMembers">
- <xsl:param name="element"/>
- <xsl:param name="elementList"/>
-
- <xsl:variable name="elemName" select="normalize-space($element/@name)"/>
- <xsl:choose>
- <xsl:when test="contains($elementList, concat('*', $elemName, '+'))">
- <!-- Circular element substitution group hierarchy -->
- <li>
- <xsl:call-template name="HandleError">
- <xsl:with-param name="isTerminating">false</xsl:with-param>
- <xsl:with-param name="errorMsg">
- <xsl:text>Circular element reference to: </xsl:text>
- <xsl:value-of select="$elemName"/>
- </xsl:with-param>
- </xsl:call-template>
- </li>
- </xsl:when>
- <xsl:otherwise>
- <!-- Get 'block' attribute. -->
- <xsl:variable name="block">
- <xsl:call-template name="PrintBlockSet">
- <xsl:with-param name="EBV">
- <xsl:choose>
- <xsl:when test="$element/@block">
- <xsl:value-of select="$element/@block"/>
- </xsl:when>
- <xsl:otherwise>
- <xsl:value-of select="/xsd:schema/@blockDefault"/>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:with-param>
- </xsl:call-template>
- </xsl:variable>
-
- <xsl:for-each select="/xsd:schema/xsd:element[normalize-space(@substitutionGroup)=$elemName or normalize-space(substring-after(@substitutionGroup, ':'))=$elemName]">
- <li>
- <xsl:call-template name="PrintElementRef">
- <xsl:with-param name="name" select="@name"/>
- </xsl:call-template>
- </li>
- <!-- Recursively find members of a substitution group that
- current element in list might head, since substitution
- groups are transitive (unless 'substitution' is
- blocked).
- -->
- <xsl:if test="not(contains($block, 'substitution'))">
- <xsl:call-template name="PrintSGroupMembers">
- <xsl:with-param name="element" select="."/>
- <xsl:with-param name="elementList" select="concat($elementList, '*', $elemName, '+')"/>
- </xsl:call-template>
- </xsl:if>
- </xsl:for-each>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:template>
-
- <!--
- Prints out the super types of a given type definition.
- Param(s):
- type (Node) required
- Type definition
- isCallingType (boolean) optional
- If true, 'type' is the type definition that starts
- this call. Otherwise, this is a recursive call from
- 'PrintSupertypes' itself.
- typeList (String) optional
- List of types in this call chain. Name of type starts
- with '*', and ends with '+'. (Used to prevent infinite
- recursive loop.)
- -->
- <xsl:template name="PrintSupertypes">
- <xsl:param name="type"/>
- <xsl:param name="isCallingType">true</xsl:param>
- <xsl:param name="typeList"/>
-
- <xsl:variable name="typeName" select="$type/@name"/>
- <xsl:choose>
- <!-- Circular type hierarchy -->
- <xsl:when test="contains($typeList, concat('*', $typeName, '+'))">
- <!-- Note: Error message will be written out in the Sample Instance table. -->
- <xsl:value-of select="$typeName"/>
- </xsl:when>
- <xsl:otherwise>
- <!-- Get base type reference -->
- <xsl:variable name="baseTypeRef">
- <xsl:choose>
- <!-- Complex type definition -->
- <xsl:when test="local-name($type)='complexType'">
- <xsl:choose>
- <xsl:when test="$type/xsd:simpleContent/xsd:extension">
- <xsl:value-of select="$type/xsd:simpleContent/xsd:extension/@base"/>
- </xsl:when>
- <xsl:when test="$type/xsd:simpleContent/xsd:restriction">
- <xsl:value-of select="$type/xsd:simpleContent/xsd:restriction/@base"/>
- </xsl:when>
- <xsl:when test="$type/xsd:complexContent/xsd:extension">
- <xsl:value-of select="$type/xsd:complexContent/xsd:extension/@base"/>
- </xsl:when>
- <xsl:when test="$type/xsd:complexContent/xsd:restriction">
- <xsl:value-of select="$type/xsd:complexContent/xsd:restriction/@base"/>
- </xsl:when>
- </xsl:choose>
- </xsl:when>
- <!-- Simple type definition -->
- <xsl:when test="local-name($type)='simpleType'">
- <xsl:choose>
- <xsl:when test="$type/xsd:restriction/@base">
- <xsl:value-of select="$type/xsd:restriction/@base"/>
- </xsl:when>
- <xsl:when test="$type/xsd:restriction/xsd:simpleType">
- <xsl:text>Local type definition</xsl:text>
- </xsl:when>
- </xsl:choose>
- </xsl:when>
- </xsl:choose>
- </xsl:variable>
-
- <!-- Get derivation method -->
- <xsl:variable name="derive">
- <!-- Complex type definition -->
- <xsl:choose>
- <xsl:when test="local-name($type)='complexType'">
- <xsl:choose>
- <xsl:when test="$type/xsd:simpleContent/xsd:extension or $type/xsd:complexContent/xsd:extension">
- <xsl:text>extension</xsl:text>
- </xsl:when>
- <xsl:when test="$type/xsd:simpleContent/xsd:restriction or $type/xsd:complexContent/xsd:restriction">
- <xsl:text>restriction</xsl:text>
- </xsl:when>
- </xsl:choose>
- </xsl:when>
- <!-- Simple type definition -->
- <xsl:when test="local-name($type)='simpleType'">
- <xsl:text>restriction</xsl:text>
- </xsl:when>
- </xsl:choose>
- </xsl:variable>
-
- <xsl:choose>
- <!-- Print out entire hierarchy -->
- <xsl:when test="normalize-space(translate($printAllSuperTypes, 'TRUE', 'true'))='true'">
- <xsl:choose>
- <xsl:when test="normalize-space($baseTypeRef)='Local type definition'">
- <xsl:value-of select="$baseTypeRef"/>
- <!-- Symbol to indicate type derivation-->
- <xsl:text> &lt; </xsl:text>
- </xsl:when>
- <xsl:when test="normalize-space($baseTypeRef)!=''">
- <!-- Get base type name from reference -->
- <xsl:variable name="baseTypeName">
- <xsl:call-template name="GetRefName">
- <xsl:with-param name="ref" select="$baseTypeRef"/>
- </xsl:call-template>
- </xsl:variable>
- <!-- Get base type definition from schema -->
- <xsl:variable name="baseType" select="key('type', $baseTypeName)"/>
- <xsl:choose>
- <!-- Base type was found in this schema -->
- <xsl:when test="$baseType">
- <!-- Make recursive call to print out base type and itself -->
- <xsl:call-template name="PrintSupertypes">
- <xsl:with-param name="type" select="$baseType"/>
- <xsl:with-param name="isCallingType">false</xsl:with-param>
- <xsl:with-param name="typeList" select="concat($typeList, '*', $typeName, '+')"/>
- </xsl:call-template>
- </xsl:when>
- <!-- Base type was not found in this schema -->
- <xsl:otherwise>
- <xsl:call-template name="PrintTypeRef">
- <xsl:with-param name="ref" select="$baseTypeRef"/>
- </xsl:call-template>
- </xsl:otherwise>
- </xsl:choose>
- <!-- Symbol to indicate type derivation -->
- <xsl:text> &lt; </xsl:text>
- </xsl:when>
- <xsl:otherwise>
- <!-- IGNORE: Base type may not be exist probably because
- current type does not be derived from another type.
- -->
- </xsl:otherwise>
- </xsl:choose>
- <!-- Print out current type's name -->
- <xsl:choose>
- <xsl:when test="$isCallingType='true'">
- <strong><xsl:value-of select="$typeName"/></strong>
- </xsl:when>
- <xsl:otherwise>
- <xsl:call-template name="PrintTypeRef">
- <xsl:with-param name="name" select="$typeName"/>
- </xsl:call-template>
- </xsl:otherwise>
- </xsl:choose>
- <!-- Print out derivation method -->
- <xsl:if test="$derive != ''">
- <xsl:text> (by </xsl:text>
- <xsl:value-of select="$derive"/>
- <xsl:text>)</xsl:text>
- </xsl:if>
- </xsl:when>
- <!-- Print out parent type only -->
- <xsl:otherwise>
- <!-- Print out base type reference -->
- <xsl:choose>
- <xsl:when test="normalize-space($baseTypeRef)='Local type definition'">
- <xsl:value-of select="$baseTypeRef"/>
- </xsl:when>
- <xsl:when test="$baseTypeRef!=''">
- <xsl:call-template name="PrintTypeRef">
- <xsl:with-param name="ref" select="$baseTypeRef"/>
- </xsl:call-template>
- </xsl:when>
- <xsl:otherwise>
- <!-- IGNORE: Base type may not be exist probably because
- current type does not be derived from another type.
- -->
- </xsl:otherwise>
- </xsl:choose>
- <!-- Print out derivation method -->
- <xsl:if test="$derive != ''">
- <xsl:text> (derivation method: </xsl:text>
- <xsl:value-of select="$derive"/>
- <xsl:text>)</xsl:text>
- </xsl:if>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:template>
-
- <!--
- Prints out the sub types of a given complex type definition.
- Param(s):
- type (Node) required
- Complex type definition
- isCallingType (boolean) optional
- If true, 'type' is the type definition that starts this
- call. Otherwise, this is a recursive call from
- 'PrintComplexSubtypes' itself.
- typeList (String) optional
- List of types in this call chain. Name of type starts
- with '*', and ends with '+'. (Used to prevent infinite
- recursive loop.)
- -->
- <xsl:template name="PrintComplexSubtypes">
- <xsl:param name="type"/>
- <xsl:param name="isCallingType">true</xsl:param>
- <xsl:param name="typeList"/>
-
- <xsl:variable name="typeName" select="normalize-space($type/@name)"/>
- <xsl:choose>
- <!-- Circular type hierarchy -->
- <xsl:when test="contains($typeList, concat('*', $typeName, '+'))">
- <!-- Do nothing. Note: Error message will be written out in the Sample Instance table. -->
- </xsl:when>
- <xsl:otherwise>
- <!-- Find sub types -->
- <xsl:variable name="subTypes">
- <ul>
- <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]">
- <li>
- <xsl:variable name="subType" select="../.."/>
- <!-- Write out type name -->
- <xsl:call-template name="PrintTypeRef">
- <xsl:with-param name="name" select="$subType/@name"/>
- </xsl:call-template>
- <!-- Write derivation method -->
- <xsl:text> (by </xsl:text>
- <xsl:value-of select="local-name(.)"/>
- <xsl:text>)</xsl:text>
- <!-- Make recursive call to write sub-types of this sub-type -->
- <xsl:if test="normalize-space(translate($printAllSubTypes, 'TRUE', 'true'))='true'">
- <xsl:call-template name="PrintComplexSubtypes">
- <xsl:with-param name="type" select="$subType"/>
- <xsl:with-param name="isCallingType">false</xsl:with-param>
- <xsl:with-param name="typeList" select="concat($typeList, '*', $typeName, '+')"/>
- </xsl:call-template>
- </xsl:if>
- </li>
- </xsl:for-each>
- </ul>
- </xsl:variable>
- <!-- Print out sub types -->
- <xsl:choose>
- <xsl:when test="normalize-space($subTypes)!=''">
- <xsl:copy-of select="$subTypes"/>
- </xsl:when>
- <xsl:when test="$isCallingType='true'">
- <xsl:text>None</xsl:text>
- </xsl:when>
- </xsl:choose>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:template>
-
- <!--
- Prints out the sub types of a given simple type definition.
- Param(s):
- type (Node) required
- Simple type definition
- isCallingType (boolean) optional
- If true, 'type' is the type definition that starts this
- call. Otherwise, this is a recursive call from
- 'PrintSimpleSubtypes'
- typeList (String) optional
- List of types in this call chain. Name of type starts
- with '*', and ends with '+'. (Used to prevent infinite
- recursive loop.)
- -->
- <xsl:template name="PrintSimpleSubtypes">
- <xsl:param name="type"/>
- <xsl:param name="isCallingType">true</xsl:param>
- <xsl:param name="typeList"/>
-
- <xsl:variable name="typeName" select="normalize-space($type/@name)"/>
- <xsl:choose>
- <!-- Circular type hierarchy -->
- <xsl:when test="contains($typeList, concat('*', $typeName, '+'))">
- <!-- Do nothing. Note: Error message will be written out in the Sample Instance table. -->
- </xsl:when>
- <xsl:otherwise>
- <!-- Find sub-types that are simple type definitions -->
- <xsl:variable name="simpleSubTypes">
- <ul>
- <xsl:for-each select="/xsd:schema/xsd:simpleType/xsd:restriction[normalize-space(@base)=$typeName or normalize-space(substring-after(@base, ':'))=$typeName]">
- <li>
- <xsl:variable name="subType" select=".."/>
- <!-- Write out type name -->
- <xsl:call-template name="PrintTypeRef">
- <xsl:with-param name="name" select="$subType/@name"/>
- </xsl:call-template>
- <!-- Write derivation method -->
- <xsl:text> (by restriction)</xsl:text>
- <!-- Make recursive call to write sub-types of this sub-type -->
- <xsl:if test="normalize-space(translate($printAllSubTypes, 'TRUE', 'true'))='true'">
- <xsl:call-template name="PrintSimpleSubtypes">
- <xsl:with-param name="type" select="$subType"/>
- <xsl:with-param name="isCallingType">false</xsl:with-param>
- <xsl:with-param name="typeList" select="concat($typeList, '*', $typeName, '+')"/>
- </xsl:call-template>
- </xsl:if>
- </li>
- </xsl:for-each>
- </ul>
- </xsl:variable>
- <!-- Find sub-types that are complex type definitions -->
- <xsl:variable name="complexSubTypes">
- <ul>
- <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]">
- <li>
- <xsl:variable name="subType" select="../.."/>
- <!-- Write out type name -->
- <xsl:call-template name="PrintTypeRef">
- <xsl:with-param name="name" select="$subType/@name"/>
- </xsl:call-template>
- <!-- Write derivation method -->
- <xsl:text> (by </xsl:text>
- <xsl:value-of select="local-name(.)"/>
- <xsl:text>)</xsl:text>
- <!-- Make recursive call to write sub-types of this sub-type -->
- <xsl:if test="normalize-space(translate($printAllSubTypes, 'TRUE', 'true'))='true'">
- <xsl:call-template name="PrintComplexSubtypes">
- <xsl:with-param name="type" select="$subType"/>
- <xsl:with-param name="isCallingType">false</xsl:with-param>
- <xsl:with-param name="typeList" select="concat($typeList, '*', $typeName, '+')"/>
- </xsl:call-template>
- </xsl:if>
- </li>
- </xsl:for-each>
- </ul>
- </xsl:variable>
-
- <xsl:variable name="hasSimpleSubTypes">
- <xsl:if test="normalize-space($simpleSubTypes)!=''">
- <xsl:text>true</xsl:text>
- </xsl:if>
- </xsl:variable>
- <xsl:variable name="hasComplexSubTypes">
- <xsl:if test="normalize-space($complexSubTypes)!=''">
- <xsl:text>true</xsl:text>
- </xsl:if>
- </xsl:variable>
- <!-- Print out sub types -->
- <xsl:choose>
- <xsl:when test="$hasSimpleSubTypes='true' or $hasComplexSubTypes='true'">
- <xsl:if test="$hasSimpleSubTypes='true'">
- <xsl:copy-of select="$simpleSubTypes"/>
- </xsl:if>
- <xsl:if test="$hasComplexSubTypes='true'">
- <xsl:copy-of select="$complexSubTypes"/>
- </xsl:if>
- </xsl:when>
- <xsl:when test="$isCallingType='true'">
- <xsl:text>None</xsl:text>
- </xsl:when>
- </xsl:choose>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:template>
-
-
- <!-- ******** Properties table ******** -->
-
- <!--
- Prints out the contents of an 'appinfo' or a 'documentation'
- element in the Properties table.
- -->
- <xsl:template match="xsd:appinfo | xsd:documentation" mode="properties">
- <!-- Print out children using XML pretty printer templates -->
- <xsl:choose>
- <xsl:when test="local-name(.)='appinfo'">
- <xsl:apply-templates select="* | text()" mode="xpp"/>
- </xsl:when>
- <xsl:otherwise>
- <xsl:apply-templates select="* | text()" mode="html"/>
- </xsl:otherwise>
- </xsl:choose>
-
- <!-- Print out URL in the source attribute. -->
- <xsl:if test="@source">
- <xsl:if test="* | text()"><br/></xsl:if>
- <xsl:text> More information at: </xsl:text>
- <xsl:call-template name="PrintURI">
- <xsl:with-param name="uri" select="@source"/>
- </xsl:call-template>
- <xsl:text>.</xsl:text>
- </xsl:if>
- </xsl:template>
-
- <!--
- Prints out the Properties table for a top-level
- attribute declaration.
- -->
- <xsl:template match="xsd:attribute" mode="properties">
- <table class="properties">
- <!-- Name -->
- <tr>
- <th>Name</th>
- <td><xsl:value-of select="@name"/></td>
- </tr>
- <!-- Type -->
- <tr>
- <th>Type</th>
- <td>
- <xsl:choose>
- <xsl:when test="xsd:simpleType">
- <xsl:text>Locally-defined simple type</xsl:text>
- </xsl:when>
- <xsl:when test="@type">
- <xsl:call-template name="PrintTypeRef">
- <xsl:with-param name="ref" select="@type"/>
- </xsl:call-template>
- </xsl:when>
- <xsl:otherwise>
- <xsl:text>anySimpleType</xsl:text>
- </xsl:otherwise>
- </xsl:choose>
- </td>
- </tr>
- <!-- Default Value -->
- <xsl:if test="@default">
- <tr>
- <th>Default Value</th>
- <td><xsl:value-of select="@default"/></td>
- </tr>
- </xsl:if>
- <!-- Fixed Value -->
- <xsl:if test="@fixed">
- <tr>
- <th>Fixed Value</th>
- <td><xsl:value-of select="@fixed"/></td>
- </tr>
- </xsl:if>
- <!-- Annotation -->
- <xsl:call-template name="PrintAnnotation">
- <xsl:with-param name="component" select="."/>
- </xsl:call-template>
- </table>
- </xsl:template>
-
- <!--
- Prints out Properties table for a top-level
- attribute group or model group definition.
- -->
- <xsl:template match="xsd:attributeGroup | xsd:group" mode="properties">
- <table class="properties">
- <!-- Name -->
- <tr>
- <th>Name</th>
- <td><xsl:value-of select="@name"/></td>
- </tr>
- <!-- Annotation -->
- <xsl:call-template name="PrintAnnotation">
- <xsl:with-param name="component" select="."/>
- </xsl:call-template>
- </table>
- </xsl:template>
-
- <!--
- Prints out the Properties table for a top-level
- complex type definition.
- -->
- <xsl:template match="xsd:complexType" mode="properties">
- <table class="properties">
- <!-- Name -->
- <tr>
- <th>Name</th>
- <td><xsl:value-of select="@name"/></td>
- </tr>
- <!-- Abstract -->
- <tr>
- <th>
- <xsl:call-template name="PrintGlossaryTermRef">
- <xsl:with-param name="code">Abstract</xsl:with-param>
- <xsl:with-param name="term">Abstract</xsl:with-param>
- </xsl:call-template>
- </th>
- <td>
- <xsl:call-template name="PrintBoolean">
- <xsl:with-param name="boolean" select="@abstract"/>
- </xsl:call-template>
- </td>
- </tr>
- <!-- Final -->
- <xsl:variable name="final">
- <xsl:call-template name="PrintDerivationSet">
- <xsl:with-param name="EBV">
- <xsl:choose>
- <xsl:when test="@final">
- <xsl:value-of select="@final"/>
- </xsl:when>
- <xsl:otherwise>
- <xsl:value-of select="/xsd:schema/@finalDefault"/>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:with-param>
- </xsl:call-template>
- </xsl:variable>
- <xsl:if test="normalize-space($final)!=''">
- <tr>
- <th>
- <xsl:call-template name="PrintGlossaryTermRef">
- <xsl:with-param name="code">TypeFinal</xsl:with-param>
- <xsl:with-param name="term">Prohibited Derivations</xsl:with-param>
- </xsl:call-template>
- </th>
- <td><xsl:value-of select="$final"/></td>
- </tr>
- </xsl:if>
- <!-- Block -->
- <xsl:variable name="block">
- <xsl:call-template name="PrintDerivationSet">
- <xsl:with-param name="EBV">
- <xsl:choose>
- <xsl:when test="@block">
- <xsl:value-of select="@block"/>
- </xsl:when>
- <xsl:otherwise>
- <xsl:value-of select="/xsd:schema/@blockDefault"/>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:with-param>
- </xsl:call-template>
- </xsl:variable>
- <xsl:if test="normalize-space($block)!=''">
- <tr>
- <th>
- <xsl:call-template name="PrintGlossaryTermRef">
- <xsl:with-param name="code">TypeBlock</xsl:with-param>
- <xsl:with-param name="term">Prohibited Substitutions</xsl:with-param>
- </xsl:call-template>
- </th>
- <td><xsl:value-of select="$block"/></td>
- </tr>
- </xsl:if>
- <!-- Annotation -->
- <xsl:call-template name="PrintAnnotation">
- <xsl:with-param name="component" select="."/>
- </xsl:call-template>
- </table>
- </xsl:template>
-
- <!--
- Prints out the Properties table for a top-level
- element declaration.
- -->
- <xsl:template match="xsd:element" mode="properties">
- <table class="properties">
- <!-- Name -->
- <tr>
- <th>Name</th>
- <td><xsl:value-of select="@name"/></td>
- </tr>
- <!-- Type -->
- <tr>
- <th>Type</th>
- <td>
- <xsl:choose>
- <xsl:when test="xsd:simpleType">
- <xsl:text>Locally-defined simple type</xsl:text>
- </xsl:when>
- <xsl:when test="xsd:complexType">
- <xsl:text>Locally-defined complex type</xsl:text>
- </xsl:when>
- <xsl:when test="@type">
- <xsl:call-template name="PrintTypeRef">
- <xsl:with-param name="ref" select="@type"/>
- </xsl:call-template>
- </xsl:when>
- <xsl:otherwise>
- <xsl:text>anyType</xsl:text>
- </xsl:otherwise>
- </xsl:choose>
- </td>
- </tr>
- <!-- Nillable -->
- <tr>
- <th>
- <xsl:call-template name="PrintGlossaryTermRef">
- <xsl:with-param name="code">Nillable</xsl:with-param>
- <xsl:with-param name="term">Nillable</xsl:with-param>
- </xsl:call-template>
- </th>
- <td>
- <xsl:call-template name="PrintBoolean">
- <xsl:with-param name="boolean" select="@nillable"/>
- </xsl:call-template>
- </td>
- </tr>
- <!-- Abstract -->
- <tr>
- <th>
- <xsl:call-template name="PrintGlossaryTermRef">
- <xsl:with-param name="code">Abstract</xsl:with-param>
- <xsl:with-param name="term">Abstract</xsl:with-param>
- </xsl:call-template>
- </th>
- <td>
- <xsl:call-template name="PrintBoolean">
- <xsl:with-param name="boolean" select="@abstract"/>
- </xsl:call-template>
- </td>
- </tr>
- <!-- Default Value -->
- <xsl:if test="@default">
- <tr>
- <th>Default Value</th>
- <td><xsl:value-of select="@default"/></td>
- </tr>
- </xsl:if>
- <!-- Fixed Value -->
- <xsl:if test="@fixed">
- <tr>
- <th>Fixed Value</th>
- <td><xsl:value-of select="@fixed"/></td>
- </tr>
- </xsl:if>
- <!-- Final -->
- <xsl:variable name="final">
- <xsl:call-template name="PrintDerivationSet">
- <xsl:with-param name="EBV">
- <xsl:choose>
- <xsl:when test="@final">
- <xsl:value-of select="@final"/>
- </xsl:when>
- <xsl:otherwise>
- <xsl:value-of select="/xsd:schema/@finalDefault"/>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:with-param>
- </xsl:call-template>
- </xsl:variable>
- <xsl:if test="normalize-space($final)!=''">
- <tr>
- <th>
- <xsl:call-template name="PrintGlossaryTermRef">
- <xsl:with-param name="code">ElemFinal</xsl:with-param>
- <xsl:with-param name="term">Substitution Group Exclusions</xsl:with-param>
- </xsl:call-template>
- </th>
- <td><xsl:value-of select="$final"/></td>
- </tr>
- </xsl:if>
- <!-- Block -->
- <xsl:variable name="block">
- <xsl:call-template name="PrintBlockSet">
- <xsl:with-param name="EBV">
- <xsl:choose>
- <xsl:when test="@block">
- <xsl:value-of select="@block"/>
- </xsl:when>
- <xsl:otherwise>
- <xsl:value-of select="/xsd:schema/@blockDefault"/>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:with-param>
- </xsl:call-template>
- </xsl:variable>
- <xsl:if test="normalize-space($block)!=''">
- <tr>
- <th>
- <xsl:call-template name="PrintGlossaryTermRef">
- <xsl:with-param name="code">ElemBlock</xsl:with-param>
- <xsl:with-param name="term">Disallowed Substitutions</xsl:with-param>
- </xsl:call-template>
- </th>
- <td><xsl:value-of select="$block"/></td>
- </tr>
- </xsl:if>
- <!-- Annotation -->
- <xsl:call-template name="PrintAnnotation">
- <xsl:with-param name="component" select="."/>
- </xsl:call-template>
- </table>
- </xsl:template>
-
- <!--
- Prints out the Properties table for a top-level
- notation declaration.
- -->
- <xsl:template match="xsd:notation" mode="properties">
- <table class="properties">
- <!-- Name -->
- <tr>
- <th>Name</th>
- <td><xsl:value-of select="@name"/></td>
- </tr>
- <!-- Public Identifier -->
- <tr>
- <th>Public Identifier</th>
- <td><xsl:value-of select="@public"/></td>
- </tr>
- <!-- System Identifier -->
- <xsl:if test="@system">
- <tr>
- <th>System Identifier</th>
- <td><xsl:value-of select="@system"/></td>
- </tr>
- </xsl:if>
- <!-- Annotation -->
- <xsl:call-template name="PrintAnnotation">
- <xsl:with-param name="component" select="."/>
- </xsl:call-template>
- </table>
- </xsl:template>
-
- <!--
- Prints out the Properties table for the root
- schema element.
- -->
- <xsl:template match="xsd:schema" mode="properties">
- <table class="properties">
- <!-- Target Namespace -->
- <tr>
- <th>
- <xsl:call-template name="PrintGlossaryTermRef">
- <xsl:with-param name="code">TargetNS</xsl:with-param>
- <xsl:with-param name="term">Target Namespace</xsl:with-param>
- </xsl:call-template>
- </th>
- <td>
- <xsl:choose>
- <xsl:when test="@targetNamespace">
- <span class="targetNS">
- <xsl:value-of select="@targetNamespace"/>
- </span>
- </xsl:when>
- <xsl:otherwise>
- <xsl:text>None</xsl:text>
- </xsl:otherwise>
- </xsl:choose>
- </td>
- </tr>
- <!-- Version -->
- <xsl:if test="@version">
- <tr>
- <th>Version</th>
- <td><xsl:value-of select="@version"/></td>
- </tr>
- </xsl:if>
- <!-- Language -->
- <xsl:if test="@xml:lang">
- <tr>
- <th>Language</th>
- <td><xsl:value-of select="@xml:lang"/></td>
- </tr>
- </xsl:if>
- <!-- Element/Attribute Form Defaults -->
- <tr>
- <th>Element and Attribute Namespaces</th>
- <td>
- <ul>
- <li>Global element and attribute declarations belong to this schema's target namespace.</li>
- <li>
- <xsl:choose>
- <xsl:when test="normalize-space(@elementFormDefault)='qualified'">
- <xsl:text>By default, local element declarations belong to this schema's target namespace.</xsl:text>
- </xsl:when>
- <xsl:otherwise>
- <xsl:text>By default, local element declarations have no namespace.</xsl:text>
- </xsl:otherwise>
- </xsl:choose>
- </li>
- <li>
- <xsl:choose>
- <xsl:when test="normalize-space(@attributeFormDefault)='qualified'">
- <xsl:text>By default, local attribute declarations belong to this schema's target namespace.</xsl:text>
- </xsl:when>
- <xsl:otherwise>
- <xsl:text>By default, local attribute declarations have no namespace.</xsl:text>
- </xsl:otherwise>
- </xsl:choose>
- </li>
- </ul>
- </td>
- </tr>
- <!-- Schema Composition, e.g. include, import, redefine -->
- <xsl:if test="xsd:include or xsd:import or xsd:redefine">
- <tr>
- <th>Schema Composition</th>
- <td>
- <ul>
- <!-- Import -->
- <xsl:if test="xsd:import">
- <li>
- <xsl:text>This schema imports schema(s) from the following namespace(s):</xsl:text>
- <ul>
- <xsl:for-each select="xsd:import">
- <li>
- <em><xsl:value-of select="@namespace"/></em>
- <xsl:if test="@schemaLocation">
- <xsl:text> (at </xsl:text>
- <xsl:call-template name="PrintSchemaLink">
- <xsl:with-param name="uri" select="@schemaLocation"/>
- </xsl:call-template>
- <xsl:text>)</xsl:text>
- </xsl:if>
- </li>
- </xsl:for-each>
- </ul>
- </li>
- </xsl:if>
- <!-- Include -->
- <xsl:if test="xsd:include">
- <li>
- <xsl:text>This schema includes components from the following schema document(s):</xsl:text>
- <ul>
- <xsl:for-each select="xsd:include">
- <li>
- <xsl:call-template name="PrintSchemaLink">
- <xsl:with-param name="uri" select="@schemaLocation"/>
- </xsl:call-template>
- </li>
- </xsl:for-each>
- </ul>
- </li>
- </xsl:if>
- <!-- Redefine -->
- <xsl:if test="xsd:redefine">
- <li>
- <xsl:text>This schema includes components from the following schema document(s), where some of the components have been redefined:</xsl:text>
- <ul>
- <xsl:for-each select="xsd:redefine">
- <li>
- <xsl:call-template name="PrintSchemaLink">
- <xsl:with-param name="uri" select="@schemaLocation"/>
- </xsl:call-template>
- </li>
- </xsl:for-each>
- </ul>
- <xsl:text>See </xsl:text><a href="#Redefinitions">Redefined Schema Components</a><xsl:text> section.</xsl:text>
- </li>
- </xsl:if>
- </ul>
- </td>
- </tr>
- </xsl:if>
- <!-- Annotation -->
- <xsl:call-template name="PrintAnnotation">
- <xsl:with-param name="component" select="."/>
- </xsl:call-template>
- </table>
- </xsl:template>
-
- <!--
- Prints out the Properties table for a top-level
- simple type definition.
- -->
- <xsl:template match="xsd:simpleType" mode="properties">
- <table class="properties">
- <!-- Name -->
- <tr>
- <th>Name</th>
- <td><xsl:value-of select="@name"/></td>
- </tr>
- <!-- Constraints -->
- <tr>
- <th>Content</th>
- <td>
- <xsl:call-template name="PrintSimpleConstraints">
- <xsl:with-param name="simpleContent" select="."/>
- </xsl:call-template>
- </td>
- </tr>
- <!-- Final -->
- <xsl:variable name="final">
- <xsl:call-template name="PrintSimpleDerivationSet">
- <xsl:with-param name="EBV">
- <xsl:choose>
- <xsl:when test="@final">
- <xsl:value-of select="@final"/>
- </xsl:when>
- <xsl:otherwise>
- <xsl:value-of select="/xsd:schema/@finalDefault"/>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:with-param>
- </xsl:call-template>
- </xsl:variable>
- <xsl:if test="normalize-space($final)!=''">
- <tr>
- <th>
- <xsl:call-template name="PrintGlossaryTermRef">
- <xsl:with-param name="code">TypeFinal</xsl:with-param>
- <xsl:with-param name="term">Prohibited Derivations</xsl:with-param>
- </xsl:call-template>
- </th>
- <td><xsl:value-of select="$final"/></td>
- </tr>
- </xsl:if>
- <!-- Annotation -->
- <xsl:call-template name="PrintAnnotation">
- <xsl:with-param name="component" select="."/>
- </xsl:call-template>
- </table>
- </xsl:template>
-
- <!--
- Unmatched template for 'properties' mode
- -->
- <xsl:template match="*" mode="properties"/>
-
- <!--
- Prints out the rows to display 'annotation' elements of an
- component in the Properties table. This template assumes it
- will be called within an HTML 'table' element.
- Param(s):
- component (Node) required
- Schema component
- -->
- <xsl:template name="PrintAnnotation">
- <xsl:param name="component"/>
-
- <xsl:if test="$component/xsd:annotation/xsd:documentation">
- <tr>
- <th>Documentation</th>
- <td>
- <xsl:for-each select="$component/xsd:annotation/xsd:documentation">
- <xsl:if test="position()!=1"><br/><br/></xsl:if>
- <xsl:apply-templates select="." mode="properties"/>
- </xsl:for-each>
- </td>
- </tr>
- </xsl:if>
- <xsl:if test="$component/xsd:annotation/xsd:appinfo">
- <tr>
- <th>Application Data</th>
- <td>
- <xsl:for-each select="$component/xsd:annotation/xsd:appinfo">
- <xsl:if test="position()!=1"><br/><br/></xsl:if>
- <xsl:apply-templates select="." mode="properties"/>
- </xsl:for-each>
- </td>
- </tr>
- </xsl:if>
- </xsl:template>
-
- <!--
- Prints out the constraints of simple content
- to be displayed within a Properties table.
- Param(s):
- simpleContent (Node) required
- Node containing the simple content
- typeList (String) optional
- List of types in this call chain. Name of type starts
- with '*', and ends with '+'. (Used to prevent infinite
- recursive loop.)
- -->
- <xsl:template name="PrintSimpleConstraints">
- <xsl:param name="simpleContent"/>
- <xsl:param name="typeList"/>
-
- <xsl:choose>
- <!-- Derivation by restriction -->
- <xsl:when test="$simpleContent/xsd:restriction">
- <xsl:call-template name="PrintSimpleRestriction">
- <xsl:with-param name="restriction" select="$simpleContent/xsd:restriction"/>
- <xsl:with-param name="typeList" select="$typeList"/>
- </xsl:call-template>
- </xsl:when>
- <!-- Derivation by list -->
- <xsl:when test="$simpleContent/xsd:list">
- <ul><li>
- <xsl:text>List of: </xsl:text>
- <xsl:choose>
- <!-- Globally-defined item type -->
- <xsl:when test="$simpleContent/xsd:list/@itemType">
- <xsl:call-template name="PrintTypeRef">
- <xsl:with-param name="ref" select="$simpleContent/xsd:list/@itemType"/>
- </xsl:call-template>
- </xsl:when>
- <!-- Locally-defined item type -->
- <xsl:otherwise>
- <ul>
- <li>
- <xsl:text>Locally defined type:</xsl:text>
- <xsl:call-template name="PrintSimpleConstraints">
- <xsl:with-param name="simpleContent" select="$simpleContent/xsd:list/xsd:simpleType"/>
- <xsl:with-param name="typeList" select="$typeList"/>
- </xsl:call-template>
- </li>
- </ul>
- </xsl:otherwise>
- </xsl:choose>
- </li></ul>
- </xsl:when>
- <!-- Derivation by union -->
- <xsl:when test="$simpleContent/xsd:union">
- <ul><li>
- <xsl:text>Union of following types: </xsl:text>
- <ul>
- <!-- Globally-defined member types -->
- <xsl:if test="$simpleContent/xsd:union/@memberTypes">
- <xsl:call-template name="PrintWhitespaceList">
- <xsl:with-param name="value" select="$simpleContent/xsd:union/@memberTypes"/>
- <xsl:with-param name="compType">type</xsl:with-param>
- <xsl:with-param name="isInList">true</xsl:with-param>
- </xsl:call-template>
- </xsl:if>
- <!-- Locally-defined member types -->
- <xsl:for-each select="$simpleContent/xsd:union/xsd:simpleType">
- <li>
- <xsl:text>Locally defined type:</xsl:text>
- <xsl:call-template name="PrintSimpleConstraints">
- <xsl:with-param name="simpleContent" select="."/>
- <xsl:with-param name="typeList" select="$typeList"/>
- </xsl:call-template>
- </li>
- </xsl:for-each>
- </ul>
- </li></ul>
- </xsl:when>
- </xsl:choose>
- </xsl:template>
-
- <!--
- Prints out the constraints of simple content derived by
- restriction, which is to be displayed in a Properties table.
- Param(s):
- restriction (Node) required
- Node containing the restriction
- typeList (String) optional
- List of types in this call chain. Name of type starts
- with '*', and ends with '+'. (Used to prevent infinite
- recursive loop.)
- -->
- <xsl:template name="PrintSimpleRestriction">
- <xsl:param name="restriction"/>
- <xsl:param name="typeList"/>
-
- <xsl:variable name="typeName" select="$restriction/parent::xsd:simpleType/@name"/>
-
- <!-- Print out base type info -->
- <xsl:choose>
- <!-- Circular type hierarchy -->
- <xsl:when test="$typeName != '' and contains($typeList, concat('*', $typeName, '+'))">
- <li>
- <xsl:call-template name="HandleError">
- <xsl:with-param name="isTerminating">false</xsl:with-param>
- <xsl:with-param name="errorMsg">
- <xsl:text>Circular type reference to '</xsl:text>
- <xsl:value-of select="$typeName"/>
- <xsl:text>' in type hierarchy.</xsl:text>
- </xsl:with-param>
- </xsl:call-template>
- </li>
- </xsl:when>
- <!-- Locally-defined base type -->
- <xsl:when test="$restriction/xsd:simpleType">
- <xsl:call-template name="PrintSimpleConstraints">
- <xsl:with-param name="simpleContent" select="$restriction/xsd:simpleType"/>
- <xsl:with-param name="typeList" select="$typeList"/>
- </xsl:call-template>
- </xsl:when>
- <!-- Base type reference -->
- <xsl:when test="$restriction">
- <xsl:variable name="baseTypeRef" select="$restriction/@base"/>
- <xsl:variable name="baseTypeName">
- <xsl:call-template name="GetRefName">
- <xsl:with-param name="ref" select="$baseTypeRef"/>
- </xsl:call-template>
- </xsl:variable>
- <xsl:variable name="baseTypeNS">
- <xsl:call-template name="GetRefNS">
- <xsl:with-param name="ref" select="$baseTypeRef"/>
- </xsl:call-template>
- </xsl:variable>
-
- <xsl:choose>
- <!-- Base type is built-in XSD type -->
- <xsl:when test="$baseTypeNS=$XSD_NS">
- <ul><li>
- <xsl:text>Base XSD Type: </xsl:text>
- <xsl:choose>
- <!-- Current schema is the schema for XSDL -->
- <xsl:when test="normalize-space(/xsd:schema/@targetNamespace)=$XSD_NS">
- <xsl:call-template name="PrintTypeRef">
- <xsl:with-param name="ref" select="$baseTypeRef"/>
- </xsl:call-template>
- </xsl:when>
- <!-- Current schema is not XSD namespace -->
- <xsl:otherwise>
- <xsl:value-of select="$baseTypeName"/>
- </xsl:otherwise>
- </xsl:choose>
- </li></ul>
- </xsl:when>
- <!-- Other types -->
- <xsl:otherwise>
- <xsl:variable name="baseType" select="key('simpleType', $baseTypeName)"/>
- <xsl:choose>
- <!-- Base type found -->
- <xsl:when test="$baseType">
- <xsl:call-template name="PrintSimpleConstraints">
- <xsl:with-param name="simpleContent" select="$baseType"/>
- <xsl:with-param name="typeList" select="concat($typeList, '*', $typeName, '+')"/>
- </xsl:call-template>
- </xsl:when>
- <!-- Base type not found -->
- <xsl:otherwise>
- <ul><li><strong>
- <xsl:text>'</xsl:text>
- <xsl:value-of select="$baseTypeName"/>
- <xsl:text>' super type was not found in this schema. </xsl:text>
- <xsl:text>Its facets could not be printed out.</xsl:text>
- </strong></li></ul>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:when>
- </xsl:choose>
-
- <!-- Find constraints in current restriction -->
- <xsl:variable name="enumeration">
- <xsl:call-template name="PrintEnumFacets">
- <xsl:with-param name="simpleRestrict" select="$restriction"/>
- </xsl:call-template>
- </xsl:variable>
- <xsl:variable name="pattern">
- <xsl:call-template name="PrintPatternFacet">
- <xsl:with-param name="simpleRestrict" select="$restriction"/>
- </xsl:call-template>
- </xsl:variable>
- <xsl:variable name="range">
- <xsl:call-template name="PrintRangeFacets">
- <xsl:with-param name="simpleRestrict" select="$restriction"/>
- </xsl:call-template>
- </xsl:variable>
- <xsl:variable name="totalDigits">
- <xsl:call-template name="PrintTotalDigitsFacet">
- <xsl:with-param name="simpleRestrict" select="$restriction"/>
- </xsl:call-template>
- </xsl:variable>
- <xsl:variable name="fractionDigits">
- <xsl:call-template name="PrintFractionDigitsFacet">
- <xsl:with-param name="simpleRestrict" select="$restriction"/>
- </xsl:call-template>
- </xsl:variable>
- <xsl:variable name="length">
- <xsl:call-template name="PrintLengthFacets">
- <xsl:with-param name="simpleRestrict" select="$restriction"/>
- </xsl:call-template>
- </xsl:variable>
- <xsl:variable name="whitespace">
- <xsl:call-template name="PrintWhitespaceFacet">
- <xsl:with-param name="simpleRestrict" select="$restriction"/>
- </xsl:call-template>
- </xsl:variable>
-
- <!-- Print out facets -->
- <xsl:if test="$enumeration!='' or $pattern!='' or $range!='' or $totalDigits!='' or $fractionDigits!='' or $length!='' or $whitespace!=''">
- <ul>
- <xsl:if test="$enumeration!=''">
- <li>
- <xsl:copy-of select="$enumeration"/>
- </li>
- </xsl:if>
- <xsl:if test="$pattern!=''">
- <li>
- <xsl:copy-of select="$pattern"/>
- </li>
- </xsl:if>
- <xsl:if test="$range!=''">
- <li>
- <xsl:copy-of select="$range"/>
- </li>
- </xsl:if>
- <xsl:if test="$totalDigits!=''">
- <li>
- <xsl:copy-of select="$totalDigits"/>
- </li>
- </xsl:if>
- <xsl:if test="$fractionDigits!=''">
- <li>
- <xsl:copy-of select="$fractionDigits"/>
- </li>
- </xsl:if>
- <xsl:if test="$length!=''">
- <li>
- <xsl:copy-of select="$length"/>
- </li>
- </xsl:if>
- <xsl:if test="$whitespace!=''">
- <li>
- <xsl:copy-of select="$whitespace"/>
- </li>
- </xsl:if>
- </ul>
- </xsl:if>
- </xsl:template>
-
-
- <!-- ******** XML Instance Representation table ******** -->
-
- <!--
- Prints out the XML Instance Representation table for a top-level
- schema component.
- Param(s):
- component (Node) required
- Top-level schema component
- -->
- <xsl:template name="SampleInstanceTable">
- <xsl:param name="component"/>
-
- <!-- Not applicable for simple type definitions and notation
- declarations -->
- <xsl:if test="local-name($component)!='simpleType' and local-name($component)!='notation'">
- <xsl:variable name="componentID">
- <xsl:call-template name="GetComponentID">
- <xsl:with-param name="component" select="$component"/>
- </xsl:call-template>
- </xsl:variable>
-
- <xsl:call-template name="CollapseableBox">
- <xsl:with-param name="id" select="concat($componentID, '_xibox')"/>
- <xsl:with-param name="styleClass">sample</xsl:with-param>
- <xsl:with-param name="caption">XML Instance Representation</xsl:with-param>
- <xsl:with-param name="contents">
- <xsl:apply-templates select="$component" mode="sample"/>
- </xsl:with-param>
- <xsl:with-param name="isOpened">true</xsl:with-param>
- </xsl:call-template>
- </xsl:if>
- </xsl:template>
-
- <!--
- Prints out a sample XML instance representation of an 'all'
- model group.
- Param(s):
- margin (nonNegativeInteger) optional
- Number of 'em' to indent from left
- isInherited (boolean) optional
- If true, display elements using 'inherited' CSS class.
- isNewField (boolean) optional
- If true, display elements using 'newFields' CSS class.
- schemaLoc (String) optional
- Schema file containing this all model group;
- if in current schema, 'schemaLoc' is set to 'this'
- typeList (String) optional
- List of types in this call chain. Name of type starts
- with '*', and ends with '+'. (Used to prevent infinite
- recursive loop.)
- -->
- <xsl:template match="xsd:all" mode="sample">
- <xsl:param name="margin">0</xsl:param>
- <xsl:param name="isInherited">false</xsl:param>
- <xsl:param name="isNewField">false</xsl:param>
- <xsl:param name="schemaLoc">this</xsl:param>
- <xsl:param name="typeList"/>
-
- <xsl:if test="normalize-space(@maxOccurs)!='0'">
- <!-- Header -->
- <span class="group" style="margin-left: {$margin}em">
- <xsl:text>Start </xsl:text>
- <xsl:call-template name="PrintGlossaryTermRef">
- <xsl:with-param name="code">All</xsl:with-param>
- <xsl:with-param name="term">All</xsl:with-param>
- </xsl:call-template>
- <!-- Min/max occurs information-->
- <xsl:text> </xsl:text>
- <xsl:call-template name="PrintOccurs">
- <xsl:with-param name="component" select="."/>
- </xsl:call-template>
- <!-- Documentation -->
- <xsl:call-template name="PrintSampleDocumentation">
- <xsl:with-param name="component" select="."/>
- </xsl:call-template>
- </span><br/>
-
- <!-- Content -->
- <xsl:apply-templates select="xsd:*" mode="sample">
- <xsl:with-param name="margin" select="number($margin) + number($ELEM_INDENT)"/>
- <xsl:with-param name="isInherited" select="$isInherited"/>
- <xsl:with-param name="isNewField" select="$isNewField"/>
- <xsl:with-param name="schemaLoc" select="$schemaLoc"/>
- <xsl:with-param name="typeList" select="$typeList"/>
- </xsl:apply-templates>
-
- <!-- Footer -->
- <span class="group" style="margin-left: {$margin}em">
- <xsl:text>End All</xsl:text>
- </span><br/>
- </xsl:if>
- </xsl:template>
-
- <!--
- Prints out a sample XML instance representation of an element
- content wild card.
- Param(s):
- margin (nonNegativeInteger) optional
- Number of 'em' to indent from left
- -->
- <xsl:template match="xsd:any | xsd:anyAttribute" mode="sample">
- <xsl:param name="margin">0</xsl:param>
-
- <div class="other" style="margin-left: {$margin}em">
- <xsl:call-template name="PrintWildcard">
- <xsl:with-param name="componentType">
- <xsl:choose>
- <xsl:when test="local-name(.)='anyAttribute'">attribute</xsl:when>
- <xsl:otherwise>element</xsl:otherwise>
- </xsl:choose>
- </xsl:with-param>
- <xsl:with-param name="namespace" select="@namespace"/>
- <xsl:with-param name="processContents" select="@processContents"/>
- <xsl:with-param name="minOccurs" select="@minOccurs"/>
- <xsl:with-param name="maxOccurs" select="@maxOccurs"/>
- </xsl:call-template>
- </div>
- </xsl:template>
-
- <!--
- Prints out a sample XML instance representation
- of an attribute declaration.
- Param(s):
- subTypeAttrs (String) optional
- List of attributes in sub-types of the type that
- contains this attribute
- isInherited (boolean) optional
- If true, display attribute using 'inherited' CSS
- class.
- isNewField (boolean) optional
- If true, display attribute using 'newFields' CSS
- class.
- margin (nonNegativeInteger) optional
- Number of 'em' to indent from left
- addBR (boolean) optional
- If true, add <br/> before attribute.
- schemaLoc (String) optional
- Schema file containing this attribute declaration;
- if in current schema, 'schemaLoc' is set to 'this'.
- -->
- <xsl:template match="xsd:attribute[@name]" mode="sample">
- <xsl:param name="subTypeAttrs"/>
- <xsl:param name="isInherited">false</xsl:param>
- <xsl:param name="isNewField">false</xsl:param>
- <xsl:param name="margin">0</xsl:param>
- <xsl:param name="addBR">false</xsl:param>
- <xsl:param name="schemaLoc">this</xsl:param>
-
- <!-- Get attribute namespace -->
- <xsl:variable name="attrNS">
- <xsl:call-template name="GetAttributeNS">
- <xsl:with-param name="attribute" select="."/>
- </xsl:call-template>
- </xsl:variable>
-
- <xsl:choose>
- <xsl:when test="contains($subTypeAttrs, concat('*', normalize-space($attrNS), '+', normalize-space(@name), '+'))">
- <!-- IGNORE: Sub type has attribute with same name;
- Sub-type's attribute declaration will override this
- one. -->
- </xsl:when>
- <xsl:when test="@use and normalize-space(@use)='prohibited'">
- <!-- IGNORE: Attribute is prohibited. -->
- </xsl:when>
- <xsl:otherwise>
- <xsl:if test="$addBR!='false'"><br/></xsl:if>
-
- <span style="margin-left: {$margin}em">
- <xsl:choose>
- <xsl:when test="$isNewField!='false'">
- <xsl:attribute name="class">newFields</xsl:attribute>
- </xsl:when>
- <xsl:when test="$isInherited!='false'">
- <xsl:attribute name="class">inherited</xsl:attribute>
- </xsl:when>
- </xsl:choose>
-
- <xsl:text> </xsl:text>
- <xsl:variable name="prefix">
- <xsl:call-template name="GetAttributePrefix">
- <xsl:with-param name="attribute" select="."/>
- </xsl:call-template>
- </xsl:variable>
- <xsl:call-template name="PrintNSPrefix">
- <xsl:with-param name="prefix" select="$prefix"/>
- <xsl:with-param name="schemaLoc" select="$schemaLoc"/>
- </xsl:call-template>
- <xsl:value-of select="@name"/>
- <xsl:text>="</xsl:text>
-
- <xsl:choose>
- <!-- Fixed value is provided -->
- <xsl:when test="@fixed">
- <span class="fixed">
- <xsl:value-of select="@fixed"/>
- </span>
- </xsl:when>
- <!-- Type reference is provided -->
- <xsl:when test="@type">
- <xsl:call-template name="PrintTypeRef">
- <xsl:with-param name="ref" select="@type"/>
- <xsl:with-param name="schemaLoc" select="$schemaLoc"/>
- </xsl:call-template>
- </xsl:when>
- <!-- Local type definition is provided -->
- <xsl:when test="xsd:simpleType">
- <xsl:apply-templates select="xsd:simpleType" mode="sample">
- <xsl:with-param name="schemaLoc" select="$schemaLoc"/>
- </xsl:apply-templates>
- </xsl:when>
- <xsl:otherwise>
- <span class="type">anySimpleType</span>
- </xsl:otherwise>
- </xsl:choose>
-
- <!-- Don't print occurrence info and documentation
- for global attributes. -->
- <xsl:if test="local-name(..)!='schema'">
- <!-- Occurrence info-->
- <xsl:text> </xsl:text>
- <xsl:call-template name="PrintOccurs">
- <xsl:with-param name="component" select="."/>
- </xsl:call-template>
- <!-- Documentation -->
- <xsl:call-template name="PrintSampleDocumentation">
- <xsl:with-param name="component" select="."/>
- </xsl:call-template>
- </xsl:if>
-
- <xsl:text>"</xsl:text>
- </span>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:template>
-
- <!--
- Prints out a sample XML instance representation
- of an attribute reference.
- Param(s):
- subTypeAttrs (String) optional
- List of attribute in sub-types of the type that
- contains this attribute
- isInherited (boolean) optional
- If true, display attributes using 'inherited' CSS
- class.
- isNewField (boolean) optional
- If true, display attributes using 'newFields' CSS
- class.
- margin (nonNegativeInteger) optional
- Number of 'em' to indent from left
- addBR (boolean) optional
- If true, add <br/> before attribute.
- schemaLoc (String) optional
- Schema file containing this attribute reference;
- if in current schema, 'schemaLoc' is set to 'this'
- -->
- <xsl:template match="xsd:attribute[@ref]" mode="sample">
- <xsl:param name="subTypeAttrs"/>
- <xsl:param name="isInherited">false</xsl:param>
- <xsl:param name="isNewField">false</xsl:param>
- <xsl:param name="margin">0</xsl:param>
- <xsl:param name="addBR">false</xsl:param>
- <xsl:param name="schemaLoc">this</xsl:param>
-
- <!-- Get attribute name -->
- <xsl:variable name="attrName">
- <xsl:call-template name="GetRefName">
- <xsl:with-param name="ref" select="@ref"/>
- </xsl:call-template>
- </xsl:variable>
-
- <!-- Get attribute namespace -->
- <xsl:variable name="attrNS">
- <xsl:call-template name="GetAttributeNS">
- <xsl:with-param name="attribute" select="."/>
- </xsl:call-template>
- </xsl:variable>
-
- <xsl:choose>
- <xsl:when test="contains($subTypeAttrs, concat('*', normalize-space($attrNS), '+', normalize-space($attrName), '+'))">
- <!-- IGNORE: Sub type has attribute with same name;
- Sub-type's attribute declaration will override this
- one. -->
- </xsl:when>
- <xsl:when test="@use and normalize-space(@use)='prohibited'">
- <!-- IGNORE: Attribute is prohibited. -->
- </xsl:when>
- <xsl:otherwise>
- <xsl:if test="$addBR!='false'"><br/></xsl:if>
-
- <span style="margin-left: {$margin}em">
- <xsl:choose>
- <xsl:when test="$isNewField!='false'">
- <xsl:attribute name="class">newFields</xsl:attribute>
- </xsl:when>
- <xsl:when test="$isInherited!='false'">
- <xsl:attribute name="class">inherited</xsl:attribute>
- </xsl:when>
- </xsl:choose>
-
- <xsl:text> </xsl:text>
- <xsl:call-template name="PrintAttributeRef">
- <xsl:with-param name="ref" select="@ref"/>
- <xsl:with-param name="schemaLoc" select="$schemaLoc"/>
- </xsl:call-template>
- <xsl:text>="</xsl:text>
- <!-- Fixed value is provided -->
- <xsl:if test="@fixed">
- <span class="fixed">
- <xsl:value-of select="@fixed"/>
- </span>
- <xsl:text> </xsl:text>
- </xsl:if>
- <!-- Print occurs info-->
- <xsl:call-template name="PrintOccurs">
- <xsl:with-param name="component" select="."/>
- </xsl:call-template>
- <!-- Documentation -->
- <xsl:call-template name="PrintSampleDocumentation">
- <xsl:with-param name="component" select="."/>
- </xsl:call-template>
-
- <xsl:text>"</xsl:text>
- </span>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:template>
-
- <!--
- Prints out a sample XML instance representation of an attribute
- group definition.
- Param(s):
- schemaLoc (String) optional
- Schema file containing this attribute group
- definition; if in current schema, 'schemaLoc' is
- set to 'this'.
- -->
- <xsl:template match="xsd:attributeGroup[@name]" mode="sample">
- <xsl:param name="schemaLoc">this</xsl:param>
-
- <xsl:for-each select="xsd:attribute | xsd:attributeGroup | xsd:anyAttribute">
- <xsl:variable name="addBR">
- <xsl:choose>
- <xsl:when test="position()!=1">
- <xsl:text>true</xsl:text>
- </xsl:when>
- <xsl:otherwise>
- <xsl:text>false</xsl:text>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:variable>
-
- <xsl:apply-templates select="." mode="sample">
- <xsl:with-param name="addBR" select="$addBR"/>
- <xsl:with-param name="schemaLoc" select="$schemaLoc"/>
- </xsl:apply-templates>
- </xsl:for-each>
- </xsl:template>
-
- <!--
- Prints out a sample XML instance representation of an attribute
- group reference.
- Param(s):
- subTypeAttrs (String) optional
- List of attributes in sub-types of the type that
- contains this attribute group
- isInherited (boolean) optional
- If true, display attributes using 'inherited' CSS
- class.
- isNewField (boolean) optional
- If true, display attributes using 'newFields' CSS
- class.
- margin (nonNegativeInteger) optional
- Number of 'em' to indent from left
- parentGroups (String) optional
- List of parent attribute group definitions that
- contain this attribute group. Used to prevent
- infinite loops when displaying attribute group
- definitions. In such a case, writes out an error
- message and stops processing.
- schemaLoc (String) optional
- Schema file containing this attribute group
- reference if in current schema, 'schemaLoc' is
- set to 'this'.
- -->
- <xsl:template match="xsd:attributeGroup[@ref]" mode="sample">
- <xsl:param name="subTypeAttrs"/>
- <xsl:param name="isInherited">false</xsl:param>
- <xsl:param name="isNewField">false</xsl:param>
- <xsl:param name="margin">0</xsl:param>
- <xsl:param name="parentGroups"/>
- <xsl:param name="schemaLoc">this</xsl:param>
-
- <!-- Get attribute group name -->
- <xsl:variable name="attrGrpName">
- <xsl:call-template name="GetRefName">
- <xsl:with-param name="ref" select="@ref"/>
- </xsl:call-template>
- </xsl:variable>
-
- <xsl:choose>
- <xsl:when test="contains($parentGroups, concat('*', normalize-space($attrGrpName), '+'))">
- <!-- Circular attribute group definition -->
- <xsl:call-template name="HandleError">
- <xsl:with-param name="isTerminating">false</xsl:with-param>
- <xsl:with-param name="errorMsg">
- <xsl:text>Circular attribute group reference: </xsl:text>
- <xsl:value-of select="$attrGrpName"/>
- </xsl:with-param>
- </xsl:call-template>
- </xsl:when>
- <xsl:otherwise>
- <!-- Look for attribute group definition -->
- <xsl:variable name="defLoc">
- <xsl:call-template name="FindComponent">
- <xsl:with-param name="ref" select="@ref"/>
- <xsl:with-param name="compType">attribute group</xsl:with-param>
- </xsl:call-template>
- </xsl:variable>
-
- <xsl:choose>
- <!-- Not found -->
- <xsl:when test="normalize-space($defLoc)='' or normalize-space($defLoc)='none' or normalize-space($defLoc)='xml' or normalize-space($defLoc)='xsd'">
- <div class="other" style="margin-left: {$margin}em">
- <xsl:text>Attribute group reference (not shown): </xsl:text>
- <xsl:call-template name="PrintAttributeGroupRef">
- <xsl:with-param name="ref" select="@ref"/>
- <xsl:with-param name="schemaLoc" select="$schemaLoc"/>
- </xsl:call-template>
- <!-- Documentation -->
- <xsl:call-template name="PrintSampleDocumentation">
- <xsl:with-param name="component" select="."/>
- </xsl:call-template>
- </div>
- </xsl:when>
- <!-- Found in current schema -->
- <xsl:when test="normalize-space($defLoc)='this'">
- <xsl:variable name="attrGrpDef" select="key('attributeGroup', $attrGrpName)"/>
- <xsl:apply-templates select="$attrGrpDef/xsd:attribute | $attrGrpDef/xsd:attributeGroup" mode="sample">
- <xsl:with-param name="subTypeAttrs" select="$subTypeAttrs"/>
- <xsl:with-param name="isInherited" select="$isInherited"/>
- <xsl:with-param name="isNewField" select="$isNewField"/>
- <xsl:with-param name="parentGroups" select="concat($parentGroups, concat('*', normalize-space($attrGrpName), '+'))"/>
- <xsl:with-param name="margin" select="$margin"/>
- <xsl:with-param name="addBR">true</xsl:with-param>
- <xsl:with-param name="schemaLoc" select="$schemaLoc"/>
- </xsl:apply-templates>
- </xsl:when>
- <!-- Found in external schema -->
- <xsl:otherwise>
- <xsl:variable name="attrGrpDef" select="document($defLoc)/xsd:schema/xsd:attributeGroup[@name=$attrGrpName]"/>
- <xsl:apply-templates select="$attrGrpDef/xsd:attribute | $attrGrpDef/xsd:attributeGroup" mode="sample">
- <xsl:with-param name="subTypeAttrs" select="$subTypeAttrs"/>
- <xsl:with-param name="isInherited" select="$isInherited"/>
- <xsl:with-param name="isNewField" select="$isNewField"/>
- <xsl:with-param name="parentGroups" select="concat($parentGroups, concat('*', normalize-space($attrGrpName), '+'))"/>
- <xsl:with-param name="margin" select="$margin"/>
- <xsl:with-param name="addBR">true</xsl:with-param>
- <xsl:with-param name="schemaLoc" select="$defLoc"/>
- </xsl:apply-templates>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:template>
-
- <!--
- Prints out a sample XML instance representation of a 'choice'
- model group.
- Param(s):
- margin (nonNegativeInteger) optional
- Number of 'em' to indent from left
- isInherited (boolean) optional
- If true, display elements using'inherited' CSS class.
- isNewField (boolean) optional
- If true, display elements using 'newFields' CSS class.
- parentGroups (String) optional
- List of parent model group definitions that contain this
- model group. Used to prevent infinite loops when
- displaying model group definitions.
- schemaLoc (String) optional
- Schema file containing this choice model group;
- if in current schema, 'schemaLoc' is set to 'this'
- typeList (String) optional
- List of types in this call chain. Name of type starts
- with '*', and ends with '+'. (Used to prevent infinite
- recursive loop.)
- -->
- <xsl:template match="xsd:choice" mode="sample">
- <xsl:param name="margin">0</xsl:param>
- <xsl:param name="isInherited">false</xsl:param>
- <xsl:param name="isNewField">false</xsl:param>
- <xsl:param name="parentGroups"/>
- <xsl:param name="schemaLoc">this</xsl:param>
- <xsl:param name="typeList"/>
-
- <xsl:if test="normalize-space(@maxOccurs)!='0'">
- <!-- Header -->
- <span class="group" style="margin-left: {$margin}em">
- <xsl:text>Start </xsl:text>
- <xsl:call-template name="PrintGlossaryTermRef">
- <xsl:with-param name="code">Choice</xsl:with-param>
- <xsl:with-param name="term">Choice</xsl:with-param>
- </xsl:call-template>
- <!-- Min/max occurrence -->
- <xsl:text> </xsl:text>
- <xsl:call-template name="PrintOccurs">
- <xsl:with-param name="component" select="."/>
- </xsl:call-template>
- <!-- Documentation -->
- <xsl:call-template name="PrintSampleDocumentation">
- <xsl:with-param name="component" select="."/>
- </xsl:call-template>
- </span><br/>
-
- <!-- Content -->
- <xsl:apply-templates select="xsd:*" mode="sample">
- <xsl:with-param name="margin" select="number($margin)+number($ELEM_INDENT)"/>
- <xsl:with-param name="isInherited" select="$isInherited"/>
- <xsl:with-param name="isNewField" select="$isNewField"/>
- <xsl:with-param name="parentGroups" select="$parentGroups"/>
- <xsl:with-param name="schemaLoc" select="$schemaLoc"/>
- <xsl:with-param name="typeList" select="$typeList"/>
- </xsl:apply-templates>
-
- <!-- Footer -->
- <span class="group" style="margin-left: {$margin}em">
- <xsl:text>End Choice</xsl:text>
- </span><br/>
- </xsl:if>
- </xsl:template>
-
- <!--
- Prints out a sample XML instance from a complex type definition.
- Param(s):
- schemaLoc (String) optional
- Schema file containing this complex type definition;
- if in current schema, 'schemaLoc' is set to 'this'.
- -->
- <xsl:template match="xsd:complexType" mode="sample">
- <xsl:param name="schemaLoc">this</xsl:param>
-
- <xsl:call-template name="PrintSampleComplexElement">
- <xsl:with-param name="type" select="."/>
- <xsl:with-param name="schemaLoc" select="$schemaLoc"/>
- </xsl:call-template>
- </xsl:template>
-
- <!--
- Prints out a sample XML instance from an element declaration.
- Param(s):
- margin (nonNegativeInteger) optional
- Number of 'em' to indent from left
- isInherited (boolean) optional
- If true, display elements using 'inherited' CSS class.
- isNewField (boolean) optional
- If true, display elements using 'newFields' CSS class.
- schemaLoc (String) optional
- Schema file containing this element declaration;
- if in current schema, 'schemaLoc' is set to 'this'.
- typeList (String) optional
- List of types in this call chain. Name of type starts
- with '*', and ends with '+'. (Used to prevent infinite
- recursive loop.)
- -->
- <xsl:template match="xsd:element[@name]" mode="sample">
- <xsl:param name="margin">0</xsl:param>
- <xsl:param name="isInherited">false</xsl:param>
- <xsl:param name="isNewField">false</xsl:param>
- <xsl:param name="schemaLoc">this</xsl:param>
- <xsl:param name="typeList"/>
-
- <xsl:choose>
- <!-- Prohibited element declaration -->
- <xsl:when test="normalize-space(@maxOccurs)='0'">
- <!-- IGNORE if max occurs is zero -->
- </xsl:when>
- <!-- Global element declaration -->
- <xsl:when test="local-name(..)='schema'">
- <xsl:choose>
- <!-- With type reference -->
- <xsl:when test="@type">
- <xsl:variable name="elemTypeName">
- <xsl:call-template name="GetRefName">
- <xsl:with-param name="ref" select="@type"/>
- </xsl:call-template>
- </xsl:variable>
-
- <!-- Look for complex type definition -->
- <xsl:variable name="defLoc">
- <xsl:call-template name="FindComponent">
- <xsl:with-param name="ref" select="@type"/>
- <xsl:with-param name="compType">complex type</xsl:with-param>
- </xsl:call-template>
- </xsl:variable>
-
- <xsl:choose>
- <!-- Complex type was found in current
- schema. -->
- <xsl:when test="normalize-space($defLoc)='this'">
- <xsl:variable name="ctype" select="key('complexType', $elemTypeName)"/>
- <xsl:call-template name="PrintSampleComplexElement">
- <xsl:with-param name="element" select="."/>
- <xsl:with-param name="type" select="$ctype"/>
- </xsl:call-template>
- </xsl:when>
- <!-- Complex type was not found. -->
- <xsl:when test="normalize-space($defLoc)='' or normalize-space($defLoc)='none' or normalize-space($defLoc)='xml' or normalize-space($defLoc)='xsd'">
- <xsl:call-template name="PrintSampleSimpleElement">
- <xsl:with-param name="element" select="."/>
- <xsl:with-param name="schemaLoc" select="$schemaLoc"/>
- </xsl:call-template>
- </xsl:when>
- <!-- Complex type was found in external
- schema. -->
- <xsl:otherwise>
- <xsl:variable name="ctype" select="document($defLoc)/xsd:schema/xsd:complexType[@name=$elemTypeName]"/>
- <xsl:call-template name="PrintSampleComplexElement">
- <xsl:with-param name="element" select="."/>
- <xsl:with-param name="type" select="$ctype"/>
- </xsl:call-template>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:when>
- <!-- With local complex type definition -->
- <xsl:when test="xsd:complexType">
- <xsl:call-template name="PrintSampleComplexElement">
- <xsl:with-param name="element" select="."/>
- <xsl:with-param name="type" select="xsd:complexType"/>
- <xsl:with-param name="schemaLoc" select="$schemaLoc"/>
- </xsl:call-template>
- </xsl:when>
- <xsl:otherwise>
- <xsl:call-template name="PrintSampleSimpleElement">
- <xsl:with-param name="element" select="."/>
- <xsl:with-param name="schemaLoc" select="$schemaLoc"/>
- </xsl:call-template>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:when>
- <!-- Local element declaration -->
- <xsl:otherwise>
- <xsl:choose>
- <!-- With local complex type definition -->
- <xsl:when test="xsd:complexType">
- <xsl:call-template name="PrintSampleComplexElement">
- <xsl:with-param name="element" select="."/>
- <xsl:with-param name="type" select="xsd:complexType"/>
- <xsl:with-param name="margin" select="$margin"/>
- <xsl:with-param name="isInherited" select="$isInherited"/>
- <xsl:with-param name="isNewField" select="$isNewField"/>
- <xsl:with-param name="schemaLoc" select="$schemaLoc"/>
- <xsl:with-param name="typeList" select="$typeList"/>
- </xsl:call-template>
- </xsl:when>
- <xsl:otherwise>
- <xsl:call-template name="PrintSampleSimpleElement">
- <xsl:with-param name="element" select="."/>
- <xsl:with-param name="margin" select="$margin"/>
- <xsl:with-param name="isInherited" select="$isInherited"/>
- <xsl:with-param name="isNewField" select="$isNewField"/>
- <xsl:with-param name="schemaLoc" select="$schemaLoc"/>
- <xsl:with-param name="typeList" select="$typeList"/>
- </xsl:call-template>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:template>
-
- <!--
- Prints out a sample XML instance from an element
- reference.
- Param(s):
- margin (nonNegativeInteger) optional
- Number of 'em' to indent from left
- isInherited (boolean) optional
- If true, display elements using 'inherited' CSS class.
- isNewField (boolean) optional
- If true, display elements using 'newFields' CSS class.
- schemaLoc (String) optional
- Schema file containing this element reference;
- if in current schema, 'schemaLoc' is set to 'this'.
- -->
- <xsl:template match="xsd:element[@ref]" mode="sample">
- <xsl:param name="margin">0</xsl:param>
- <xsl:param name="isInherited">false</xsl:param>
- <xsl:param name="isNewField">false</xsl:param>
- <xsl:param name="schemaLoc">this</xsl:param>
-
- <xsl:if test="normalize-space(@maxOccurs)!='0'">
- <xsl:call-template name="PrintSampleSimpleElement">
- <xsl:with-param name="element" select="."/>
- <xsl:with-param name="margin" select="$margin"/>
- <xsl:with-param name="isInherited" select="$isInherited"/>
- <xsl:with-param name="isNewField" select="$isNewField"/>
- <xsl:with-param name="schemaLoc" select="$schemaLoc"/>
- </xsl:call-template>
- </xsl:if>
- </xsl:template>
-
- <!--
- Prints out a sample XML instance from a group definition.
- Param(s):
- schemaLoc (String) optional
- Schema file containing this model group definition;
- if in current schema, 'schemaLoc' is set to 'this'
- typeList (String) optional
- List of types in this call chain. Name of type starts
- with '*', and ends with '+'. (Used to prevent infinite
- recursive loop.)
- -->
- <xsl:template match="xsd:group[@name]" mode="sample">
- <xsl:param name="schemaLoc">this</xsl:param>
- <xsl:param name="typeList"/>
-
- <xsl:apply-templates select="xsd:*" mode="sample">
- <xsl:with-param name="parentGroups" select="concat('*', normalize-space(@name), '+')"/>
- <xsl:with-param name="schemaLoc" select="$schemaLoc"/>
- <xsl:with-param name="typeList" select="$typeList"/>
- </xsl:apply-templates>
- </xsl:template>
-
- <!--
- Prints out a sample XML instance from a group reference.
- Param(s):
- margin (nonNegativeInteger) optional
- Number of 'em' to indent from left
- isInherited (boolean) optional
- If true, display elements using 'inherited' CSS
- class.
- isNewField (boolean) optional
- If true, display elements using 'newFields' CSS
- class.
- parentGroups (String) optional
- List of parent model group definitions that contain
- this model group. Used to prevent infinite loops
- when displaying model group definitions.
- schemaLoc (String) optional
- Schema file containing this model group reference;
- if in current schema, 'schemaLoc' is set to 'this'
- typeList (String) optional
- List of types in this call chain. Name of type starts
- with '*', and ends with '+'. (Used to prevent infinite
- recursive loop.)
- -->
- <xsl:template match="xsd:group[@ref]" mode="sample">
- <xsl:param name="margin">0</xsl:param>
- <xsl:param name="isInherited">false</xsl:param>
- <xsl:param name="isNewField">false</xsl:param>
- <xsl:param name="parentGroups"/>
- <xsl:param name="schemaLoc">this</xsl:param>
- <xsl:param name="typeList"/>
-
- <!-- Get group name -->
- <xsl:variable name="grpName">
- <xsl:call-template name="GetRefName">
- <xsl:with-param name="ref" select="@ref"/>
- </xsl:call-template>
- </xsl:variable>
-
- <!-- Create link to the group definition -->
- <xsl:variable name="grpLink">
- <xsl:call-template name="PrintGroupRef">
- <xsl:with-param name="ref" select="@ref"/>
- <xsl:with-param name="schemaLoc" select="$schemaLoc"/>
- </xsl:call-template>
- </xsl:variable>
-
- <!-- Get occurrence info -->
- <xsl:variable name="occursInfo">
- <xsl:call-template name="PrintOccurs">
- <xsl:with-param name="component" select="."/>
- </xsl:call-template>
- </xsl:variable>
-
- <xsl:choose>
- <!-- Circular group definition -->
- <xsl:when test="contains($parentGroups, concat('*', normalize-space($grpName), '+'))">
- <!-- Don't show contents -->
- <div class="other" style="margin-left: {$margin}em">
- <xsl:text>Circular model group reference: </xsl:text>
- <xsl:copy-of select="$grpLink"/>
- <!-- Occurrence info -->
- <xsl:text> </xsl:text>
- <xsl:copy-of select="$occursInfo"/>
- <!-- Documentation -->
- <xsl:call-template name="PrintSampleDocumentation">
- <xsl:with-param name="component" select="."/>
- </xsl:call-template>
- </div>
- </xsl:when>
- <xsl:otherwise>
- <!-- Look for group definition -->
- <xsl:variable name="grpDefLoc">
- <xsl:call-template name="FindComponent">
- <xsl:with-param name="ref" select="@ref"/>
- <xsl:with-param name="compType">group</xsl:with-param>
- </xsl:call-template>
- </xsl:variable>
-
- <xsl:choose>
- <!-- Not found -->
- <xsl:when test="normalize-space($grpDefLoc)='' or normalize-space($grpDefLoc)='none' or normalize-space($grpDefLoc)='xml' or normalize-space($grpDefLoc)='xsd'">
- <div class="other" style="margin-left: {$margin}em">
- <xsl:text>Model group reference (not shown): </xsl:text>
- <xsl:copy-of select="$grpLink"/>
- <!-- Occurrence info -->
- <xsl:text> </xsl:text>
- <xsl:copy-of select="$occursInfo"/>
- <!-- Documentation -->
- <xsl:call-template name="PrintSampleDocumentation">
- <xsl:with-param name="component" select="."/>
- </xsl:call-template>
- </div>
- </xsl:when>
- <!-- Found in current schema -->
- <xsl:when test="normalize-space($grpDefLoc)='this'">
- <xsl:variable name="grpDef" select="key('group', $grpName)"/>
- <xsl:call-template name="PrintSampleGroup">
- <xsl:with-param name="margin" select="$margin"/>
- <xsl:with-param name="isInherited" select="$isInherited"/>
- <xsl:with-param name="isNewField" select="$isNewField"/>
- <xsl:with-param name="parentGroups" select="concat($parentGroups, concat('*', normalize-space($grpName), '+'))"/>
- <xsl:with-param name="occursInfo" select="$occursInfo"/>
- <xsl:with-param name="grpLink" select="$grpLink"/>
- <xsl:with-param name="grpRef" select="."/>
- <xsl:with-param name="grpDef" select="$grpDef"/>
- <xsl:with-param name="grpDefLoc" select="$grpDefLoc"/>
- <xsl:with-param name="typeList" select="$typeList"/>
- </xsl:call-template>
- </xsl:when>
- <!-- Found in external schema -->
- <xsl:otherwise>
- <xsl:variable name="grpDef" select="document($grpDefLoc)/xsd:schema/xsd:group[@name=$grpName]"/>
- <xsl:call-template name="PrintSampleGroup">
- <xsl:with-param name="margin" select="$margin"/>
- <xsl:with-param name="isInherited" select="$isInherited"/>
- <xsl:with-param name="isNewField" select="$isNewField"/>
- <xsl:with-param name="parentGroups" select="concat($parentGroups, concat('*', normalize-space($grpName), '+'))"/>
- <xsl:with-param name="occursInfo" select="$occursInfo"/>
- <xsl:with-param name="grpLink" select="$grpLink"/>
- <xsl:with-param name="grpRef" select="."/>
- <xsl:with-param name="grpDef" select="$grpDef"/>
- <xsl:with-param name="grpDefLoc" select="$grpDefLoc"/>
- <xsl:with-param name="typeList" select="$typeList"/>
- </xsl:call-template>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:template>
-
- <!--
- Prints out a sample XML instance from a 'sequence' model group.
- Param(s):
- margin (nonNegativeInteger) optional
- Number of 'em' to indent from left
- isInherited (boolean) optional
- If true, display elements using 'inherited' CSS class.
- isNewField (boolean) optional
- If true, display elements using 'newFields' CSS class.
- parentGroups (String) optional
- List of parent model group definitions that contain
- this model group. Used to prevent infinite loops when
- displaying model group definitions.
- schemaLoc (String) optional
- Schema file containing this sequence model group;
- if in current schema, 'schemaLoc' is set to 'this'
- typeList (String) optional
- List of types in this call chain. Name of type starts
- with '*', and ends with '+'. (Used to prevent infinite
- recursive loop.)
- -->
- <xsl:template match="xsd:sequence" mode="sample">
- <xsl:param name="margin">0</xsl:param>
- <xsl:param name="isInherited">false</xsl:param>
- <xsl:param name="isNewField">false</xsl:param>
- <xsl:param name="parentGroups"/>
- <xsl:param name="schemaLoc">this</xsl:param>
- <xsl:param name="typeList"/>
-
- <xsl:if test="normalize-space(@maxOccurs)!='0'">
- <!-- Get occurrence info -->
- <xsl:variable name="occursInfo">
- <xsl:call-template name="PrintOccurs">
- <xsl:with-param name="component" select="."/>
- </xsl:call-template>
- </xsl:variable>
-
- <!-- Header -->
- <xsl:if test="normalize-space($occursInfo)!='[1]'">
- <!-- Don't display header if min/max occurs is one. -->
- <span class="group" style="margin-left: {$margin}em">
- <xsl:text>Start </xsl:text>
- <xsl:call-template name="PrintGlossaryTermRef">
- <xsl:with-param name="code">Sequence</xsl:with-param>
- <xsl:with-param name="term">Sequence</xsl:with-param>
- </xsl:call-template>
-
- <xsl:text> </xsl:text>
- <xsl:copy-of select="$occursInfo"/>
- <!-- Documentation -->
- <xsl:call-template name="PrintSampleDocumentation">
- <xsl:with-param name="component" select="."/>
- </xsl:call-template>
- </span><br/>
- </xsl:if>
-
- <xsl:apply-templates select="xsd:*" mode="sample">
- <xsl:with-param name="margin">
- <xsl:choose>
- <xsl:when test="normalize-space($occursInfo)='[1]'">
- <xsl:value-of select="$margin"/>
- </xsl:when>
- <xsl:otherwise>
- <xsl:value-of select="number($margin)+number($ELEM_INDENT)"/>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:with-param>
- <xsl:with-param name="isInherited" select="$isInherited"/>
- <xsl:with-param name="isNewField" select="$isNewField"/>
- <xsl:with-param name="parentGroups" select="$parentGroups"/>
- <xsl:with-param name="schemaLoc" select="$schemaLoc"/>
- <xsl:with-param name="typeList" select="$typeList"/>
- </xsl:apply-templates>
-
- <!-- Footer -->
- <xsl:if test="normalize-space($occursInfo)!='[1]'">
- <!-- Don't display footer if min/max occurs is one. -->
- <span class="group" style="margin-left: {$margin}em">
- <xsl:text>End Sequence</xsl:text>
- </span><br/>
- </xsl:if>
- </xsl:if>
- </xsl:template>
-
- <!--
- Prints out the constraints of a complex type with simple content
- to be displayed within a sample XML instance.
- Param(s):
- schemaLoc (String) optional
- Schema file containing this simple content
- restriction; if in current schema, 'schemaLoc' is
- set to 'this'
- -->
- <xsl:template match="xsd:simpleContent[xsd:restriction]" mode="sample">
- <xsl:param name="schemaLoc">this</xsl:param>
-
- <span class="constraint">
- <xsl:call-template name="PrintSampleSimpleRestriction">
- <xsl:with-param name="restriction" select="./xsd:restriction"/>
- <xsl:with-param name="schemaLoc" select="$schemaLoc"/>
- </xsl:call-template>
- </span>
- </xsl:template>
-
- <!--
- Prints out the constraints of a simple type definition to be
- displayed within a sample XML instance.
- Param(s):
- schemaLoc (String) optional
- Schema file containing this simple type definition;
- if in current schema, 'schemaLoc' is set to 'this'
- -->
- <xsl:template match="xsd:simpleType" mode="sample">
- <xsl:param name="schemaLoc">this</xsl:param>
-
- <span class="constraint">
- <xsl:call-template name="PrintSampleSimpleConstraints">
- <xsl:with-param name="simpleContent" select="."/>
- <xsl:with-param name="schemaLoc" select="$schemaLoc"/>
- </xsl:call-template>
- </span>
- </xsl:template>
-
- <!--
- Prints out the identity constraints of an element to be displayed
- within a sample XML instance.
- Param(s):
- margin (nonNegativeInteger) optional
- Number of 'em' to indent from left
- schemaLoc (String) optional
- Schema file containing this simple type definition;
- if in current schema, 'schemaLoc' is set to 'this'
- -->
- <xsl:template match="xsd:unique | xsd:key | xsd:keyref" mode="sample">
- <xsl:param name="margin">0</xsl:param>
- <xsl:param name="schemaLoc">this</xsl:param>
-
- <div class="other" style="margin-left: {$margin}em">
- <xsl:text>&lt;!-- </xsl:text><br/>
-
- <xsl:choose>
- <xsl:when test="local-name(.)='unique'">
- <xsl:call-template name="PrintGlossaryTermRef">
- <xsl:with-param name="code">Unique</xsl:with-param>
- <xsl:with-param name="term">Uniqueness</xsl:with-param>
- </xsl:call-template>
- </xsl:when>
- <xsl:when test="local-name(.)='key'">
- <xsl:call-template name="PrintGlossaryTermRef">
- <xsl:with-param name="code">Key</xsl:with-param>
- <xsl:with-param name="term">Key</xsl:with-param>
- </xsl:call-template>
- </xsl:when>
- <xsl:otherwise>
- <xsl:call-template name="PrintGlossaryTermRef">
- <xsl:with-param name="code">KeyRef</xsl:with-param>
- <xsl:with-param name="term">Key Reference</xsl:with-param>
- </xsl:call-template>
- </xsl:otherwise>
- </xsl:choose>
- <xsl:text> Constraint - </xsl:text>
- <strong>
- <xsl:choose>
- <xsl:when test="local-name(.)='keyref'">
- <xsl:value-of select="@name"/>
- </xsl:when>
- <xsl:otherwise>
- <xsl:variable name="componentID">
- <xsl:call-template name="GetComponentID">
- <xsl:with-param name="component" select="."/>
- </xsl:call-template>
- </xsl:variable>
- <a name="{$componentID}"><xsl:value-of select="@name"/></a>
- </xsl:otherwise>
- </xsl:choose>
- </strong><br/>
-
- <xsl:text>Selector - </xsl:text>
- <strong>
- <xsl:value-of select="xsd:selector/@xpath"/>
- </strong><br/>
-
- <xsl:text>Field(s) - </xsl:text>
- <xsl:for-each select="xsd:field">
- <xsl:if test="position()!=1">
- <xsl:text>, </xsl:text>
- </xsl:if>
- <strong>
- <xsl:value-of select="@xpath"/>
- </strong>
- </xsl:for-each>
- <br/>
-
- <xsl:if test="local-name(.)='keyref'">
- <xsl:text>Refers to - </xsl:text>
- <xsl:call-template name="PrintKeyRef">
- <xsl:with-param name="ref" select="@refer"/>
- <xsl:with-param name="schemaLoc" select="$schemaLoc"/>
- </xsl:call-template>
- <br/>
- </xsl:if>
-
- <xsl:text>--></xsl:text>
- </div>
- </xsl:template>
-
- <!--
- Unmatched template for 'sample' mode
- -->
- <xsl:template match="*" mode="sample"/>
-
- <!--
- Prints out a link which will open up a window, displaying a
- schema component's documentation.
- Param(s):
- component (Node) required
- Schema component
- -->
- <xsl:template name="PrintSampleDocumentation">
- <xsl:param name="component"/>
-
- <xsl:if test="normalize-space(translate($useJavaScript,'TRUE','true'))='true' and $component and $component/xsd:annotation/xsd:documentation">
- <xsl:variable name="documentation">
- <xsl:for-each select="$component/xsd:annotation/xsd:documentation">
- <!-- Check for two dashes, which will break the JavaScript
- code -->
- <xsl:if test="contains(., '--') or contains(@source, '--')">
- <xsl:call-template name="HandleError">
- <xsl:with-param name="isTerminating">true</xsl:with-param>
- <xsl:with-param name="errorMsg">
-A local schema component contains two dashes in
-'documentation' elements within its 'annotation' element.
- </xsl:with-param>
- </xsl:call-template>
- </xsl:if>
-
- <xsl:if test="position()!=1">
- <xsl:text>,</xsl:text>
- </xsl:if>
- <xsl:text>'</xsl:text>
- <xsl:choose>
- <xsl:when test="@source">
- <xsl:text>More information at: </xsl:text>
- <xsl:call-template name="EscapeQuotes">
- <xsl:with-param name="value" select="@source"/>
- </xsl:call-template>
- <xsl:text>.</xsl:text>
- </xsl:when>
- <xsl:when test="normalize-space(.)!=''">
- <xsl:call-template name="EscapeQuotes">
- <xsl:with-param name="value" select="normalize-space(.)"/>
- </xsl:call-template>
- </xsl:when>
- </xsl:choose>
- <xsl:text>'</xsl:text>
- </xsl:for-each>
- </xsl:variable>
-
- <xsl:text> </xsl:text>
- <a href="javascript:void(0)" title="View Documentation" class="documentation">
- <!-- onclick attribute -->
- <xsl:attribute name="onclick">
- <xsl:text>docArray = new Array(</xsl:text>
- <xsl:value-of select="$documentation"/>
- <xsl:text>); viewDocumentation('</xsl:text>
- <xsl:call-template name="GetComponentDescription">
- <xsl:with-param name="component" select="$component"/>
- </xsl:call-template>
- <xsl:text>', '</xsl:text>
- <xsl:choose>
- <xsl:when test="$component/@name">
- <xsl:value-of select="$component/@name"/>
- </xsl:when>
- <xsl:when test="$component/@ref">
- <xsl:call-template name="GetRefName">
- <xsl:with-param name="ref" select="$component/@ref"/>
- </xsl:call-template>
- </xsl:when>
- </xsl:choose>
- <xsl:text>', docArray);</xsl:text>
- </xsl:attribute>
- <xsl:text>?</xsl:text>
- </a>
- </xsl:if>
- </xsl:template>
-
- <!--
- Translates occurrences of single and double quotes
- in a piece of text with single and double quote
- escape characters.
- Param(s):
- value (String) required
- Text to translate
- -->
- <xsl:template name="EscapeQuotes">
- <xsl:param name="value"/>
-
- <xsl:variable name="noSingleQuotes">
- <xsl:call-template name="TranslateStr">
- <xsl:with-param name="value" select="$value"/>
- <xsl:with-param name="strToReplace">'</xsl:with-param>
- <xsl:with-param name="replacementStr">\'</xsl:with-param>
- </xsl:call-template>
- </xsl:variable>
- <xsl:variable name="noDoubleQuotes">
- <xsl:call-template name="TranslateStr">
- <xsl:with-param name="value" select="$noSingleQuotes"/>
- <xsl:with-param name="strToReplace">"</xsl:with-param>
- <xsl:with-param name="replacementStr">\"</xsl:with-param>
- </xsl:call-template>
- </xsl:variable>
- <xsl:value-of select="$noDoubleQuotes"/>
- </xsl:template>
-
- <!--
- Helper template for template, match="xsd:group[@ref]"
- mode="sample". Basically prints out a group reference, for
- which we are able to look up the group definition that it
- is referring to. This template is a work-around because XSLT
- doesn't have variables (in the traditional sense of
- programming languages) and it doesn't allow you to query
- result tree fragments.
- Param(s):
- margin (nonNegativeInteger) optional
- Number of 'em' to indent from left
- isInherited (boolean) optional
- If true, display elements using 'inherited' CSS class.
- isNewField (boolean) optional
- If true, display elements using 'newFields' CSS class.
- parentGroups (String) optional
- List of parent model group definitions that contain this
- model group. Used to prevent infinite loops when
- displaying model group definitions.
- occursInfo (Result tree fragment) required
- Pre-formatted occurrence info of group reference
- grpLink (Result tree fragment) required
- Pre-formatted <a> link representing group reference
- grpRef (Node) required
- Group reference
- grpDef (Node) required
- Group definition that the reference is pointing to
- grpDefLoc (String) optional
- Schema file containing 'grpDef' group definition;
- if current schema, 'schemaLoc' is set to 'this'
- typeList (String) optional
- List of types in this call chain. Name of type starts
- with '*', and ends with '+'. (Used to prevent infinite
- recursive loop.)
- -->
- <xsl:template name="PrintSampleGroup">
- <xsl:param name="margin">0</xsl:param>
- <xsl:param name="isInherited">false</xsl:param>
- <xsl:param name="isNewField">false</xsl:param>
- <xsl:param name="parentGroups"/>
- <xsl:param name="occursInfo"/>
- <xsl:param name="grpLink"/>
- <xsl:param name="grpRef"/>
- <xsl:param name="grpDef"/>
- <xsl:param name="grpDefLoc">this</xsl:param>
- <xsl:param name="typeList"/>
-
- <!-- Header -->
- <xsl:if test="normalize-space($occursInfo)!='[1]'">
- <!-- Don't print out header if min/max occurs is one. -->
- <span class="group" style="margin-left: {$margin}em">
- <xsl:text>Start Group: </xsl:text>
- <xsl:copy-of select="$grpLink"/>
- <!-- Occurrence info -->
- <xsl:text> </xsl:text>
- <xsl:copy-of select="$occursInfo"/>
- <!-- Documentation -->
- <xsl:call-template name="PrintSampleDocumentation">
- <xsl:with-param name="component" select="$grpRef"/>
- </xsl:call-template>
- </span><br/>
- </xsl:if>
-
- <!-- Content -->
- <xsl:apply-templates select="$grpDef/xsd:*" mode="sample">
- <xsl:with-param name="margin">
- <xsl:choose>
- <xsl:when test="normalize-space($occursInfo)!='[1]'">
- <xsl:value-of select="number($margin)+number($ELEM_INDENT)"/>
- </xsl:when>
- <xsl:otherwise>
- <xsl:value-of select="$margin"/>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:with-param>
- <xsl:with-param name="isInherited" select="$isInherited"/>
- <xsl:with-param name="isNewField" select="$isNewField"/>
- <xsl:with-param name="parentGroups" select="$parentGroups"/>
- <xsl:with-param name="schemaLoc" select="$grpDefLoc"/>
- <xsl:with-param name="typeList" select="$typeList"/>
- </xsl:apply-templates>
-
- <!-- Footer -->
- <xsl:if test="normalize-space($occursInfo)!='[1]'">
- <!-- Don't print out footer if min/max occurs is one. -->
- <span class="group" style="margin-left: {$margin}em">
- <xsl:text>End Group: </xsl:text>
- <xsl:copy-of select="$grpLink"/>
- </span><br/>
- </xsl:if>
- </xsl:template>
-
- <!--
- Prints out a sample element instance in one line.
- Param(s):
- element (Node) required
- Element declaration or reference
- margin (nonNegativeInteger) optional
- Number of 'em' to indent from left
- isInherited (boolean) optional
- If true, display element using 'inherited' CSS class.
- isNewField (boolean) optional
- If true, display element using 'newFields' CSS class.
- schemaLoc (String) optional
- Schema file containing this element declaration
- or reference; if in current schema, 'schemaLoc' is
- set to 'this'.
- -->
- <xsl:template name="PrintSampleSimpleElement">
- <xsl:param name="element"/>
- <xsl:param name="margin">0</xsl:param>
- <xsl:param name="isInherited">false</xsl:param>
- <xsl:param name="isNewField">false</xsl:param>
- <xsl:param name="schemaLoc">this</xsl:param>
-
- <!-- Element Tag -->
- <xsl:variable name="elemTag">
- <!-- Local Name -->
- <xsl:choose>
- <!-- Element reference -->
- <xsl:when test="$element/@ref">
- <!-- Note: Prefix will be automatically written out
- in call to 'PrintElementRef'. -->
- <xsl:call-template name="PrintElementRef">
- <xsl:with-param name="ref" select="@ref"/>
- <xsl:with-param name="schemaLoc" select="$schemaLoc"/>
- </xsl:call-template>
- </xsl:when>
- <!-- Element declaration -->
- <xsl:otherwise>
- <!-- Prefix -->
- <xsl:variable name="prefix">
- <xsl:call-template name="GetElementPrefix">
- <xsl:with-param name="element" select="$element"/>
- </xsl:call-template>
- </xsl:variable>
- <xsl:call-template name="PrintNSPrefix">
- <xsl:with-param name="prefix" select="$prefix"/>
- <xsl:with-param name="schemaLoc" select="$schemaLoc"/>
- </xsl:call-template>
- <xsl:value-of select="$element/@name"/>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:variable>
-
- <div style="margin-left: {$margin}em">
- <xsl:choose>
- <xsl:when test="$isNewField!='false'">
- <xsl:attribute name="class">newFields</xsl:attribute>
- </xsl:when>
- <xsl:when test="$isInherited!='false'">
- <xsl:attribute name="class">inherited</xsl:attribute>
- </xsl:when>
- </xsl:choose>
-
- <!-- Start Tag -->
- <xsl:text>&lt;</xsl:text>
- <xsl:copy-of select="$elemTag"/>
- <xsl:text>></xsl:text>
-
- <!-- Contents -->
- <xsl:text> </xsl:text>
- <xsl:choose>
- <!-- Fixed value is provided -->
- <xsl:when test="$element/@fixed">
- <span class="fixed">
- <xsl:value-of select="$element/@fixed"/>
- </span>
- </xsl:when>
- <!-- Type reference is provided -->
- <xsl:when test="$element/@name and $element/@type">
- <xsl:call-template name="PrintTypeRef">
- <xsl:with-param name="ref" select="$element/@type"/>
- <xsl:with-param name="schemaLoc" select="$schemaLoc"/>
- </xsl:call-template>
- </xsl:when>
- <!-- Local simple type definition is provided -->
- <xsl:when test="$element/@name and $element/xsd:simpleType">
- <xsl:apply-templates select="$element/xsd:simpleType" mode="sample">
- <xsl:with-param name="schemaLoc" select="$schemaLoc"/>
- </xsl:apply-templates>
- </xsl:when>
- <xsl:otherwise>
- <xsl:text>...</xsl:text>
- </xsl:otherwise>
- </xsl:choose>
- <xsl:text> </xsl:text>
-
- <!-- Identity Constraints -->
- <xsl:if test="$element/xsd:unique or $element/xsd:key or $element/xsd:keyref">
- <xsl:apply-templates select="$element/xsd:unique | $element/xsd:key | $element/xsd:keyref" mode="sample">
- <xsl:with-param name="margin" select="$ELEM_INDENT"/>
- <xsl:with-param name="schemaLoc" select="$schemaLoc"/>
- </xsl:apply-templates>
- </xsl:if>
-
- <!-- End Tag -->
- <xsl:text>&lt;/</xsl:text>
- <xsl:copy-of select="$elemTag"/>
- <xsl:text>></xsl:text>
-
- <xsl:if test="local-name($element/..)!='schema'">
- <!-- Min/max occurs information -->
- <xsl:text> </xsl:text>
- <xsl:call-template name="PrintOccurs">
- <xsl:with-param name="component" select="$element"/>
- </xsl:call-template>
- <!-- Documentation -->
- <xsl:call-template name="PrintSampleDocumentation">
- <xsl:with-param name="component" select="$element"/>
- </xsl:call-template>
- </xsl:if>
- </div>
- </xsl:template>
-
- <!--
- Prints out a sample element instance that has complex content.
- Param(s):
- type (Node) required
- Complex type definition
- element (Node) optional
- Element declaration
- margin (nonNegativeInteger) optional
- Number of 'em' to indent from left
- isInherited (boolean) optional
- If true, display element using 'inherited' CSS class.
- isNewField (boolean) optional
- If true, display element using 'newFields' CSS class.
- schemaLoc (String) optional
- Schema file containing this element declaration
- or type definition; if in current schema, 'schemaLoc'
- is set to 'this'.
- typeList (String) optional
- List of types in this call chain. Name of type starts
- with '*', and ends with '+'. (Used to prevent infinite
- recursive loop.)
- -->
- <xsl:template name="PrintSampleComplexElement">
- <xsl:param name="type"/>
- <xsl:param name="element"/>
- <xsl:param name="margin">0</xsl:param>
- <xsl:param name="isInherited">false</xsl:param>
- <xsl:param name="isNewField">false</xsl:param>
- <xsl:param name="schemaLoc">this</xsl:param>
- <xsl:param name="typeList"/>
-
- <xsl:choose>
- <!-- Circular type hierarchy -->
- <xsl:when test="$type/@name and contains($typeList, concat('*', $type/@name, '+'))"/>
- <xsl:otherwise>
- <xsl:variable name="tag">
- <xsl:choose>
- <xsl:when test="$element">
- <!-- Prefix -->
- <xsl:variable name="prefix">
- <xsl:call-template name="GetElementPrefix">
- <xsl:with-param name="element" select="$element"/>
- </xsl:call-template>
- </xsl:variable>
- <xsl:call-template name="PrintNSPrefix">
- <xsl:with-param name="prefix" select="$prefix"/>
- <xsl:with-param name="schemaLoc" select="$schemaLoc"/>
- </xsl:call-template>
- <xsl:value-of select="$element/@name"/>
- </xsl:when>
- <xsl:otherwise>
- <xsl:text>...</xsl:text>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:variable>
-
- <xsl:variable name="fromTopCType">
- <xsl:choose>
- <xsl:when test="not($element) and local-name($type/..)='schema'">
- <xsl:text>true</xsl:text>
- </xsl:when>
- <xsl:otherwise>
- <xsl:text>false</xsl:text>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:variable>
-
- <div style="margin-left: {$margin}em">
- <xsl:choose>
- <xsl:when test="$isNewField!='false'">
- <xsl:attribute name="class">newFields</xsl:attribute>
- </xsl:when>
- <xsl:when test="$isInherited!='false'">
- <xsl:attribute name="class">inherited</xsl:attribute>
- </xsl:when>
- </xsl:choose>
-
- <!-- Start Tag -->
- <xsl:text>&lt;</xsl:text>
- <xsl:copy-of select="$tag"/>
-
- <!-- Print attributes -->
- <xsl:call-template name="PrintSampleTypeAttrs">
- <xsl:with-param name="type" select="$type"/>
- <xsl:with-param name="isInherited" select="$isInherited"/>
- <xsl:with-param name="isNewField" select="$isNewField"/>
- <xsl:with-param name="margin" select="$ATTR_INDENT"/>
- <xsl:with-param name="fromTopCType" select="$fromTopCType"/>
- <xsl:with-param name="schemaLoc" select="$schemaLoc"/>
- <xsl:with-param name="typeList" select="$typeList"/>
- </xsl:call-template>
-
- <!-- Get content -->
- <xsl:variable name="content">
- <xsl:call-template name="PrintSampleTypeContent">
- <xsl:with-param name="type" select="$type"/>
- <xsl:with-param name="margin" select="$ELEM_INDENT"/>
- <xsl:with-param name="isInherited" select="$isInherited"/>
- <xsl:with-param name="isNewField" select="$isNewField"/>
- <xsl:with-param name="fromTopCType" select="$fromTopCType"/>
- <xsl:with-param name="schemaLoc" select="$schemaLoc"/>
- <xsl:with-param name="typeList" select="$typeList"/>
- </xsl:call-template>
- </xsl:variable>
-
- <!-- Find out if content type is mixed -->
- <xsl:variable name="mixed">
- <xsl:choose>
- <xsl:when test="normalize-space(translate($type/xsd:complexContent/@mixed, 'TRUE', 'true'))='true' or normalize-space($type/xsd:complexContent/@mixed)='1'">
- <xsl:text>true</xsl:text>
- </xsl:when>
- <xsl:when test="normalize-space(translate($type/@mixed, 'TRUE', 'true'))='true' or normalize-space($type/@mixed)='1'">
- <xsl:text>true</xsl:text>
- </xsl:when>
- <xsl:otherwise>
- <xsl:text>false</xsl:text>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:variable>
-
- <!-- Find out if there are identity constraints -->
- <xsl:variable name="hasIdConstraints">
- <xsl:if test="$element and ($element/xsd:unique or $element/xsd:key or $element/xsd:keyref)">
- <xsl:text>true</xsl:text>
- </xsl:if>
- </xsl:variable>
-
- <!-- Print content -->
- <xsl:choose>
- <!-- Empty content -->
- <xsl:when test="$hasIdConstraints!='true' and normalize-space($content)=''">
- <!-- Close start tag -->
- <xsl:text>/> </xsl:text>
-
- <xsl:if test="$element and local-name($element/..)!='schema'">
- <!-- Occurrence info -->
- <xsl:text> </xsl:text>
- <xsl:call-template name="PrintOccurs">
- <xsl:with-param name="component" select="$element"/>
- </xsl:call-template>
-
- <!-- Documentation -->
- <xsl:call-template name="PrintSampleDocumentation">
- <xsl:with-param name="component" select="$element"/>
- </xsl:call-template>
- </xsl:if>
- </xsl:when>
- <xsl:otherwise>
- <!-- Close start tag -->
- <xsl:text>> </xsl:text>
-
- <xsl:if test="$element and local-name($element/..)!='schema'">
- <!-- Occurrence info -->
- <xsl:text> </xsl:text>
- <xsl:call-template name="PrintOccurs">
- <xsl:with-param name="component" select="$element"/>
- </xsl:call-template>
-
- <!-- Documentation -->
- <xsl:text> </xsl:text>
- <xsl:call-template name="PrintSampleDocumentation">
- <xsl:with-param name="component" select="$element"/>
- </xsl:call-template>
- </xsl:if>
-
- <!-- Identity Constraints -->
- <xsl:if test="$element">
- <xsl:apply-templates select="$element/xsd:unique | $element/xsd:key | $element/xsd:keyref" mode="sample">
- <xsl:with-param name="margin" select="$ELEM_INDENT"/>
- </xsl:apply-templates>
- </xsl:if>
-
- <!-- Print out restriction/extension information -->
- <xsl:choose>
- <xsl:when test="false()">
- <!--<xsl:when test="$type/xsd:complexContent/xsd:restriction/@base">-->
- <br/><span class="other" style="margin-left: {$ELEM_INDENT}em">
- <xsl:text>&lt;!-- Restricts : </xsl:text>
- <xsl:call-template name="PrintTypeRef">
- <xsl:with-param name="ref" select="$type/xsd:complexContent/xsd:restriction/@base"/>
- <xsl:with-param name="schemaLoc" select="$schemaLoc"/>
- </xsl:call-template>
- <xsl:text> --></xsl:text>
- </span>
- </xsl:when>
- <xsl:when test="false()">
- <!--<xsl:when test="$type/xsd:complexContent/xsd:extension/@base">-->
- <br/><span class="other" style="margin-left: {$ELEM_INDENT}em">
- <xsl:text>&lt;!-- Extends : </xsl:text>
- <xsl:call-template name="PrintTypeRef">
- <xsl:with-param name="ref" select="$type/xsd:complexContent/xsd:extension/@base"/>
- <xsl:with-param name="schemaLoc" select="$schemaLoc"/>
- </xsl:call-template>
- <xsl:text> --></xsl:text>
- </span>
- </xsl:when>
- </xsl:choose>
-
- <!-- Print out message if has mixed content -->
- <xsl:if test="$mixed='true'">
- <br/><span class="other" style="margin-left: {$ELEM_INDENT}em">
- <xsl:text>&lt;!-- Mixed content --></xsl:text>
- </span>
- </xsl:if>
-
- <!-- Element Content -->
- <xsl:copy-of select="$content"/>
-
- <!-- End Tag -->
- <xsl:text>&lt;/</xsl:text>
- <xsl:copy-of select="$tag"/>
- <xsl:text>></xsl:text>
- </xsl:otherwise>
- </xsl:choose>
- </div>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:template>
-
- <!--
- Prints out attributes of a complex type definition, including
- those inherited from a base type.
- Param(s):
- type (Node) required
- Complex type definition
- subTypeAttrs (String) optional
- List of attributes in sub-types of this current type
- definition
- isInherited (boolean) optional
- If true, display attributes using 'inherited' CSS class.
- isNewField (boolean) optional
- If true, display attributes using 'newFields' CSS class.
- fromTopCType (boolean) optional
- Set to true if this is being displayed in the XML
- Instance Representation table of a top-level complex
- type definition, in which case, 'inherited' attributes
- and elements are distinguished.
- margin (nonNegativeInteger) optional
- Number of 'em' to indent from left
- schemaLoc (String) optional
- Schema file containing this complex type definition;
- if in current schema, 'schemaLoc' is set to 'this'.
- typeList (String) optional
- List of types in this call chain. Name of type starts
- with '*', and ends with '+'. (Used to prevent infinite
- recursive loop.)
- -->
- <xsl:template name="PrintSampleTypeAttrs">
- <xsl:param name="type"/>
- <xsl:param name="subTypeAttrs"/>
- <xsl:param name="isInherited">false</xsl:param>
- <xsl:param name="isNewField">false</xsl:param>
- <xsl:param name="fromTopCType">false</xsl:param>
- <xsl:param name="margin">0</xsl:param>
- <xsl:param name="schemaLoc">this</xsl:param>
- <xsl:param name="typeList"/>
-
- <xsl:choose>
- <!-- Circular type hierarchy -->
- <xsl:when test="$type/@name and contains($typeList, concat('*', $type/@name, '+'))">
- <!-- Do nothing.
- Error message will be written out by 'PrintSampleTypeContent' template.
- -->
- </xsl:when>
- <!-- Derivation -->
- <xsl:when test="$type/xsd:complexContent or $type/xsd:simpleContent">
- <xsl:choose>
- <xsl:when test="$type/xsd:complexContent/xsd:restriction">
- <xsl:call-template name="PrintSampleDerivedTypeAttrs">
- <xsl:with-param name="derivationElem" select="$type/xsd:complexContent/xsd:restriction"/>
- <xsl:with-param name="subTypeAttrs" select="$subTypeAttrs"/>
- <xsl:with-param name="isInherited" select="$isInherited"/>
- <xsl:with-param name="isNewField" select="$isNewField"/>
- <xsl:with-param name="fromTopCType" select="$fromTopCType"/>
- <xsl:with-param name="margin" select="$margin"/>
- <xsl:with-param name="schemaLoc" select="$schemaLoc"/>
- <xsl:with-param name="typeList" select="concat($typeList, '*', $type/@name, '+')"/>
- </xsl:call-template>
- </xsl:when>
- <xsl:when test="$type/xsd:simpleContent/xsd:restriction">
- <xsl:call-template name="PrintSampleDerivedTypeAttrs">
- <xsl:with-param name="derivationElem" select="$type/xsd:simpleContent/xsd:restriction"/>
- <xsl:with-param name="subTypeAttrs" select="$subTypeAttrs"/>
- <xsl:with-param name="isInherited" select="$isInherited"/>
- <xsl:with-param name="isNewField" select="$isNewField"/>
- <xsl:with-param name="fromTopCType" select="$fromTopCType"/>
- <xsl:with-param name="margin" select="$margin"/>
- <xsl:with-param name="schemaLoc" select="$schemaLoc"/>
- <xsl:with-param name="typeList" select="concat($typeList, '*', $type/@name, '+')"/>
- </xsl:call-template>
- </xsl:when>
- <xsl:when test="$type/xsd:complexContent/xsd:extension">
- <xsl:call-template name="PrintSampleDerivedTypeAttrs">
- <xsl:with-param name="derivationElem" select="$type/xsd:complexContent/xsd:extension"/>
- <xsl:with-param name="subTypeAttrs" select="$subTypeAttrs"/>
- <xsl:with-param name="isInherited" select="$isInherited"/>
- <xsl:with-param name="isNewField" select="$isNewField"/>
- <xsl:with-param name="fromTopCType" select="$fromTopCType"/>
- <xsl:with-param name="margin" select="$margin"/>
- <xsl:with-param name="schemaLoc" select="$schemaLoc"/>
- <xsl:with-param name="typeList" select="concat($typeList, '*', $type/@name, '+')"/>
- </xsl:call-template>
- </xsl:when>
- <xsl:when test="$type/xsd:simpleContent/xsd:extension">
- <xsl:call-template name="PrintSampleDerivedTypeAttrs">
- <xsl:with-param name="derivationElem" select="$type/xsd:simpleContent/xsd:extension"/>
- <xsl:with-param name="subTypeAttrs" select="$subTypeAttrs"/>
- <xsl:with-param name="isInherited" select="$isInherited"/>
- <xsl:with-param name="isNewField" select="$isNewField"/>
- <xsl:with-param name="fromTopCType" select="$fromTopCType"/>
- <xsl:with-param name="margin" select="$margin"/>
- <xsl:with-param name="schemaLoc" select="$schemaLoc"/>
- <xsl:with-param name="typeList" select="concat($typeList, '*', $type/@name, '+')"/>
- </xsl:call-template>
- </xsl:when>
- </xsl:choose>
- </xsl:when>
- <!-- No derivation -->
- <xsl:when test="local-name($type)='complexType'">
- <xsl:call-template name="PrintSampleAttrList">
- <xsl:with-param name="list" select="$type"/>
- <xsl:with-param name="subTypeAttrs" select="$subTypeAttrs"/>
- <xsl:with-param name="isInherited" select="$isInherited"/>
- <xsl:with-param name="isNewField" select="$isNewField"/>
- <xsl:with-param name="margin" select="$margin"/>
- <xsl:with-param name="schemaLoc" select="$schemaLoc"/>
- <xsl:with-param name="typeList" select="concat($typeList, '*', $type/@name, '+')"/>
- </xsl:call-template>
- </xsl:when>
- <!-- Ignore base types that are simple types -->
- </xsl:choose>
- </xsl:template>
-
- <!--
- Helper function 'PrintSampleTypeAttrs' template to
- handle case of derived types.
- Param(s):
- derivationElem (Node) required
- 'restriction' or 'extension' element
- subTypeAttrs (String) optional
- List of attributes in sub-types of
- this current type definition
- isInherited (boolean) optional
- If true, display attributes using 'inherited' CSS class.
- isNewField (boolean) optional
- If true, display attributes using 'newFields' CSS class.
- fromTopCType (boolean) optional
- Set to true if this is being displayed
- in the XML Instance Representation table
- of a top-level complex type definition, in
- which case, 'inherited' attributes and
- elements are distinguished.
- margin (nonNegativeInteger) optional
- Number of 'em' to indent from left
- schemaLoc (String) optional
- Schema file containing this derivation element;
- if in current schema, 'schemaLoc' is set to 'this'.
- typeList (String) optional
- List of types in this call chain. Name of type starts
- with '*', and ends with '+'. (Used to prevent infinite
- recursive loop.)
- -->
- <xsl:template name="PrintSampleDerivedTypeAttrs">
- <xsl:param name="derivationElem"/>
- <xsl:param name="subTypeAttrs"/>
- <xsl:param name="isInherited">false</xsl:param>
- <xsl:param name="isNewField">false</xsl:param>
- <xsl:param name="fromTopCType">false</xsl:param>
- <xsl:param name="margin">0</xsl:param>
- <xsl:param name="schemaLoc">this</xsl:param>
- <xsl:param name="typeList"/>
-
- <!-- Get attributes from this type to add to
- 'subTypeAttrs' list for recursive call on base type -->
- <xsl:variable name="thisAttrs">
- <xsl:call-template name="GetAttrList">
- <xsl:with-param name="list" select="$derivationElem"/>
- </xsl:call-template>
- </xsl:variable>
-
- <!-- Look for base type -->
- <xsl:variable name="baseTypeName">
- <xsl:call-template name="GetRefName">
- <xsl:with-param name="ref" select="$derivationElem/@base"/>
- </xsl:call-template>
- </xsl:variable>
- <xsl:variable name="defLoc">
- <xsl:call-template name="FindComponent">
- <xsl:with-param name="ref" select="$derivationElem/@base"/>
- <xsl:with-param name="compType">complex type</xsl:with-param>
- </xsl:call-template>
- </xsl:variable>
- <xsl:choose>
- <!-- Complex type was found in current schema. -->
- <xsl:when test="normalize-space($defLoc)='this'">
- <xsl:variable name="ctype" select="key('complexType', $baseTypeName)"/>
- <xsl:call-template name="PrintSampleTypeAttrs">
- <xsl:with-param name="type" select="$ctype"/>
- <xsl:with-param name="subTypeAttrs" select="concat($subTypeAttrs, $thisAttrs)"/>
- <xsl:with-param name="isInherited">
- <xsl:choose>
- <xsl:when test="$fromTopCType!='false'">
- <xsl:text>true</xsl:text>
- </xsl:when>
- <xsl:otherwise>
- <xsl:text>false</xsl:text>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:with-param>
- <xsl:with-param name="isNewField" select="$isNewField"/>
- <xsl:with-param name="fromTopCType" select="$fromTopCType"/>
- <xsl:with-param name="margin" select="$margin"/>
- <xsl:with-param name="schemaLoc" select="$schemaLoc"/>
- <xsl:with-param name="typeList" select="$typeList"/>
- </xsl:call-template>
- </xsl:when>
- <!-- Complex type was not found. -->
- <xsl:when test="normalize-space($defLoc)='' or normalize-space($defLoc)='none' or normalize-space($defLoc)='xml' or normalize-space($defLoc)='xsd'">
- <!-- IGNORE: Error message will be printed out be
- 'PrintSampleTypeContent' template. -->
- </xsl:when>
- <!-- Complex type was found in external schema. -->
- <xsl:otherwise>
- <xsl:variable name="ctype" select="document($defLoc)/xsd:schema/xsd:complexType[@name=$baseTypeName]"/>
- <xsl:call-template name="PrintSampleTypeAttrs">
- <xsl:with-param name="type" select="$ctype"/>
- <xsl:with-param name="subTypeAttrs" select="concat($subTypeAttrs, $thisAttrs)"/>
- <xsl:with-param name="isInherited">
- <xsl:choose>
- <xsl:when test="$fromTopCType!='false'">
- <xsl:text>true</xsl:text>
- </xsl:when>
- <xsl:otherwise>
- <xsl:text>false</xsl:text>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:with-param>
- <xsl:with-param name="isNewField" select="$isNewField"/>
- <xsl:with-param name="fromTopCType" select="$fromTopCType"/>
- <xsl:with-param name="margin" select="$margin"/>
- <xsl:with-param name="schemaLoc" select="$defLoc"/>
- <xsl:with-param name="typeList" select="$typeList"/>
- </xsl:call-template>
- </xsl:otherwise>
- </xsl:choose>
-
- <!-- Print out attributes in this type -->
- <xsl:call-template name="PrintSampleAttrList">
- <xsl:with-param name="list" select="$derivationElem"/>
- <xsl:with-param name="subTypeAttrs" select="$subTypeAttrs"/>
- <xsl:with-param name="isInherited" select="$isInherited"/>
- <xsl:with-param name="isNewField">
- <xsl:choose>
- <xsl:when test="$fromTopCType!='false' and $isInherited='false'">
- <xsl:text>true</xsl:text>
- </xsl:when>
- <xsl:otherwise>
- <xsl:text>false</xsl:text>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:with-param>
- <xsl:with-param name="margin" select="$margin"/>
- <xsl:with-param name="schemaLoc" select="$schemaLoc"/>
- </xsl:call-template>
- </xsl:template>
-
- <!--
- Returns the names and namespaces of attributes
- in a list of attributes and attribute groups.
- Param(s):
- list (Node) required
- Node containing list of attributes and attribute groups
- -->
- <xsl:template name="GetAttrList">
- <xsl:param name="list"/>
-
- <xsl:if test="$list">
- <xsl:for-each select="$list/xsd:attribute | $list/xsd:attributeGroup | $list/xsd:anyAttribute">
- <xsl:choose>
- <!-- Attribute declaration -->
- <xsl:when test="local-name(.)='attribute' and @name">
- <!-- Get attribute name -->
- <xsl:variable name="attrName" select="@name"/>
- <!-- Get attribute namespace -->
- <xsl:variable name="attrNS">
- <xsl:call-template name="GetAttributeNS">
- <xsl:with-param name="attribute" select="."/>
- </xsl:call-template>
- </xsl:variable>
-
- <xsl:value-of select="concat('*', normalize-space($attrNS), '+', normalize-space($attrName), '+')"/>
- </xsl:when>
- <!-- Attribute reference -->
- <xsl:when test="local-name(.)='attribute' and @ref">
- <!-- Get attribute name -->
- <xsl:variable name="attrName">
- <xsl:call-template name="GetRefName">
- <xsl:with-param name="ref" select="@ref"/>
- </xsl:call-template>
- </xsl:variable>
- <!-- Get attribute namespace -->
- <xsl:variable name="attrNS">
- <xsl:call-template name="GetAttributeNS">
- <xsl:with-param name="attribute" select="."/>
- </xsl:call-template>
- </xsl:variable>
-
- <xsl:value-of select="concat('*', normalize-space($attrNS), '+', normalize-space($attrName), '+')"/>
- </xsl:when>
- <!-- Attribute Group reference -->
- <xsl:when test="local-name(.)='attributeGroup' and @ref">
- <xsl:variable name="attrGrpName">
- <xsl:call-template name="GetRefName">
- <xsl:with-param name="ref" select="@ref"/>
- </xsl:call-template>
- </xsl:variable>
- <xsl:call-template name="GetAttrList">
- <xsl:with-param name="list" select="key('attributeGroup', $attrGrpName)"/>
- </xsl:call-template>
- </xsl:when>
- <!-- Attribute wildcard -->
- <xsl:when test="local-name(.)='anyAttribute'">
- </xsl:when>
- </xsl:choose>
- </xsl:for-each>
- </xsl:if>
- </xsl:template>
-
- <!--
- Prints out sample XML instances from a list of attributes and
- attribute groups.
- Param(s):
- list (Node) required
- Node containing list of attributes and attribute groups
- subTypeAttrs (String) optional
- List of attributes in sub-types of
- the type definition containing this list
- isInherited (boolean) optional
- If true, display attributes using 'inherited' CSS class.
- isNewField (boolean) optional
- If true, display attributes using 'newFields' CSS class.
- margin (nonNegativeInteger) optional
- Number of 'em' to indent from left
- schemaLoc (String) optional
- Schema file containing this attribute list;
- if in current schema, 'schemaLoc' is set to 'this'.
- -->
- <xsl:template name="PrintSampleAttrList">
- <xsl:param name="list"/>
- <xsl:param name="subTypeAttrs"/>
- <xsl:param name="isInherited">false</xsl:param>
- <xsl:param name="isNewField">false</xsl:param>
- <xsl:param name="margin">0</xsl:param>
- <xsl:param name="schemaLoc">this</xsl:param>
-
- <xsl:apply-templates select="$list/xsd:attribute | $list/xsd:attributeGroup | $list/xsd:anyAttribute" mode="sample">
- <xsl:with-param name="subTypeAttrs" select="$subTypeAttrs"/>
- <xsl:with-param name="isInherited" select="$isInherited"/>
- <xsl:with-param name="isNewField" select="$isNewField"/>
- <xsl:with-param name="margin" select="$margin"/>
- <xsl:with-param name="addBR">true</xsl:with-param>
- <xsl:with-param name="schemaLoc" select="$schemaLoc"/>
- </xsl:apply-templates>
- </xsl:template>
-
- <!--
- Prints out the element content of a complex type definition,
- including those inherited from a base type.
- Param(s):
- type (Node) required
- Complex type definition
- margin (nonNegativeInteger) optional
- Number of 'em' to indent from left
- isInherited (boolean) optional
- If true, display elements using 'inherited' CSS class.
- isNewField (boolean) optional
- If true, display elements using 'newFields' CSS class.
- fromTopCType (boolean) optional
- Set to true if this is being displayed in the XML
- Instance Representation table of a top-level complex
- type definition, in which case, 'inherited' attributes
- and elements are distinguished.
- addBR (boolean) optional
- If true, can add <br/> before element content.
- Applicable only if displaying complex content.
- schemaLoc (String) optional
- Schema file containing this type definition;
- if in current schema, 'schemaLoc' is set to 'this'.
- typeList (String) optional
- List of types in this call chain. Name of type starts
- with '*', and ends with '+'. (Used to prevent infinite
- recursive loop.)
- -->
- <xsl:template name="PrintSampleTypeContent">
- <xsl:param name="type"/>
- <xsl:param name="margin">0</xsl:param>
- <xsl:param name="isInherited">false</xsl:param>
- <xsl:param name="isNewField">false</xsl:param>
- <xsl:param name="fromTopCType">false</xsl:param>
- <xsl:param name="addBR">true</xsl:param>
- <xsl:param name="schemaLoc">this</xsl:param>
- <xsl:param name="typeList"/>
-
- <xsl:if test="$addBR='true'"><br/></xsl:if>
-
- <xsl:choose>
- <!-- Circular type hierarchy -->
- <xsl:when test="$type/@name and contains($typeList, concat('*', $type/@name, '+'))"/>
- <!-- Derivation by restriction on complex content -->
- <xsl:when test="$type/xsd:complexContent/xsd:restriction">
- <xsl:variable name="restriction" select="$type/xsd:complexContent/xsd:restriction"/>
-
- <!-- Test if base type is in schema to print out warning comment-->
- <xsl:variable name="baseTypeName">
- <xsl:call-template name="GetRefName">
- <xsl:with-param name="ref" select="$restriction/@base"/>
- </xsl:call-template>
- </xsl:variable>
- <!-- Look for base type -->
- <xsl:variable name="defLoc">
- <xsl:call-template name="FindComponent">
- <xsl:with-param name="ref" select="$restriction/@base"/>
- <xsl:with-param name="compType">complex type</xsl:with-param>
- </xsl:call-template>
- </xsl:variable>
-
- <xsl:choose>
- <!-- Complex type was not found. -->
- <xsl:when test="normalize-space($defLoc)='' or normalize-space($defLoc)='none' or normalize-space($defLoc)='xml' or normalize-space($defLoc)='xsd'">
- <div class="other" style="margin-left: {$margin}em;">
- <xsl:text>&lt;!-- '</xsl:text>
- <xsl:call-template name="PrintTypeRef">
- <xsl:with-param name="ref" select="$restriction/@base"/>
- <xsl:with-param name="schemaLoc" select="$schemaLoc"/>
- </xsl:call-template>
- <xsl:text>' super type was not found in this schema. Some elements and attributes may be missing. --></xsl:text>
- </div>
- </xsl:when>
- <!-- Complex type was found. -->
- <xsl:otherwise>
- <!-- IGNORE element content of base type if by restriction,
- since current content will override restricted
- base type's content. -->
- </xsl:otherwise>
- </xsl:choose>
-
- <!-- Print out content from this type -->
- <xsl:if test="$restriction/xsd:*[local-name(.)!='annotation']">
- <xsl:call-template name="PrintSampleParticleList">
- <xsl:with-param name="list" select="$restriction"/>
- <xsl:with-param name="margin" select="$margin"/>
- <xsl:with-param name="isInherited" select="$isInherited"/>
- <xsl:with-param name="isNewField">
- <xsl:choose>
- <xsl:when test="$fromTopCType!='false' and $isInherited='false'">
- <xsl:text>true</xsl:text>
- </xsl:when>
- <xsl:otherwise>
- <xsl:text>false</xsl:text>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:with-param>
- <xsl:with-param name="schemaLoc" select="$schemaLoc"/>
- <xsl:with-param name="typeList" select="concat($typeList, '*', $type/@name, '+')"/>
- </xsl:call-template>
- </xsl:if>
- </xsl:when>
- <!-- Derivation by extension on complex content -->
- <xsl:when test="$type/xsd:complexContent/xsd:extension">
- <xsl:variable name="extension" select="$type/xsd:complexContent/xsd:extension"/>
-
- <xsl:variable name="baseTypeName">
- <xsl:call-template name="GetRefName">
- <xsl:with-param name="ref" select="$extension/@base"/>
- </xsl:call-template>
- </xsl:variable>
-
- <xsl:choose>
- <xsl:when test="contains($typeList, concat('*', $baseTypeName, '+'))">
- <div class="other" style="margin-left: {$margin}em">
- <xsl:text>&lt;-- Extends: </xsl:text>
- <xsl:call-template name="PrintTypeRef">
- <xsl:with-param name="ref" select="$extension/@base"/>
- <xsl:with-param name="schemaLoc" select="$schemaLoc"/>
- </xsl:call-template>
- <xsl:text> (Circular type hierarchy) --&gt;</xsl:text>
- </div>
- </xsl:when>
- <xsl:otherwise>
- <!-- Look for base type -->
- <xsl:variable name="defLoc">
- <xsl:call-template name="FindComponent">
- <xsl:with-param name="ref" select="$extension/@base"/>
- <xsl:with-param name="compType">complex type</xsl:with-param>
- </xsl:call-template>
- </xsl:variable>
-
- <xsl:choose>
- <!-- Complex type was found in current schema. -->
- <xsl:when test="normalize-space($defLoc)='this'">
- <xsl:variable name="ctype" select="key('complexType', $baseTypeName)"/>
- <xsl:call-template name="PrintSampleTypeContent">
- <xsl:with-param name="type" select="$ctype"/>
- <xsl:with-param name="margin" select="$margin"/>
- <xsl:with-param name="isInherited">
- <xsl:choose>
- <xsl:when test="$fromTopCType!='false'">
- <xsl:text>true</xsl:text>
- </xsl:when>
- <xsl:otherwise>
- <xsl:text>false</xsl:text>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:with-param>
- <xsl:with-param name="isNewField" select="$isNewField"/>
- <xsl:with-param name="fromTopCType" select="$fromTopCType"/>
- <xsl:with-param name="addBR">false</xsl:with-param>
- <xsl:with-param name="schemaLoc" select="$schemaLoc"/>
- <xsl:with-param name="typeList" select="concat($typeList, '*', $type/@name, '+')"/>
- </xsl:call-template>
- </xsl:when>
- <!-- Complex type was not found. -->
- <xsl:when test="normalize-space($defLoc)='' or normalize-space($defLoc)='none' or normalize-space($defLoc)='xml' or normalize-space($defLoc)='xsd'">
- <div class="other" style="margin-left: {$margin}em;">
- <xsl:text>&lt;!-- '</xsl:text>
- <xsl:call-template name="PrintTypeRef">
- <xsl:with-param name="ref" select="$extension/@base"/>
- <xsl:with-param name="schemaLoc" select="$schemaLoc"/>
- </xsl:call-template>
- <xsl:text>' super type was not found in this schema. Some elements and attributes may be missing. --></xsl:text>
- </div>
- </xsl:when>
- <!-- Complex type was found in external schema. -->
- <xsl:otherwise>
- <xsl:variable name="ctype" select="document($defLoc)/xsd:schema/xsd:complexType[@name=$baseTypeName]"/>
- <xsl:call-template name="PrintSampleTypeContent">
- <xsl:with-param name="type" select="$ctype"/>
- <xsl:with-param name="margin" select="$margin"/>
- <xsl:with-param name="isInherited">
- <xsl:choose>
- <xsl:when test="$fromTopCType!='false'">
- <xsl:text>true</xsl:text>
- </xsl:when>
- <xsl:otherwise>
- <xsl:text>false</xsl:text>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:with-param>
- <xsl:with-param name="isNewField" select="$isNewField"/>
- <xsl:with-param name="fromTopCType" select="$fromTopCType"/>
- <xsl:with-param name="addBR">false</xsl:with-param>
- <xsl:with-param name="schemaLoc" select="$defLoc"/>
- <xsl:with-param name="typeList" select="concat($typeList, '*', $type/@name, '+')"/>
- </xsl:call-template>
- </xsl:otherwise>
- </xsl:choose>
-
- <!-- Print out content from this type -->
- <xsl:if test="$extension/xsd:*[local-name(.)!='annotation']">
- <xsl:call-template name="PrintSampleParticleList">
- <xsl:with-param name="list" select="$extension"/>
- <xsl:with-param name="margin" select="$margin"/>
- <xsl:with-param name="isInherited" select="$isInherited"/>
- <xsl:with-param name="isNewField">
- <xsl:choose>
- <xsl:when test="$fromTopCType!='false' and $isInherited='false'">
- <xsl:text>true</xsl:text>
- </xsl:when>
- <xsl:otherwise>
- <xsl:text>false</xsl:text>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:with-param>
- <xsl:with-param name="schemaLoc" select="$schemaLoc"/>
- <xsl:with-param name="typeList" select="concat($typeList, '*', $type/@name, '+')"/>
- </xsl:call-template>
- </xsl:if>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:when>
- <!-- Derivation by restriction on simple content -->
- <xsl:when test="$type/xsd:simpleContent/xsd:restriction">
- <!-- Print out simple type constraints-->
- <span style="margin-left: {$margin}em">
- <xsl:text> </xsl:text>
- <xsl:apply-templates select="$type/xsd:simpleContent" mode="sample">
- <xsl:with-param name="schemaLoc" select="$schemaLoc"/>
- </xsl:apply-templates>
- <xsl:text> </xsl:text>
- </span><br/>
- </xsl:when>
- <!-- Derivation by extension on simple content -->
- <xsl:when test="$type/xsd:simpleContent/xsd:extension">
- <!-- Print out base type name -->
- <span style="margin-left: {$margin}em">
- <xsl:text> </xsl:text>
- <xsl:call-template name="PrintTypeRef">
- <xsl:with-param name="ref" select="$type/xsd:simpleContent/xsd:extension/@base"/>
- <xsl:with-param name="schemaLoc" select="$schemaLoc"/>
- </xsl:call-template>
- <xsl:text> </xsl:text>
- </span><br/>
- </xsl:when>
- <!-- No derivation: complex type definition -->
- <xsl:when test="local-name($type)='complexType'">
- <!-- Print out content from this type -->
- <xsl:call-template name="PrintSampleParticleList">
- <xsl:with-param name="list" select="$type"/>
- <xsl:with-param name="margin" select="$margin"/>
- <xsl:with-param name="isInherited" select="$isInherited"/>
- <xsl:with-param name="isNewField" select="$isNewField"/>
- <xsl:with-param name="schemaLoc" select="$schemaLoc"/>
- <xsl:with-param name="typeList" select="concat($typeList, '*', $type/@name, '+')"/>
- </xsl:call-template>
- </xsl:when>
- </xsl:choose>
- </xsl:template>
-
- <!--
- Prints out sample XML instances from a list of
- element particle.
- Param(s):
- list (Node) required
- Node containing list of element particles
- margin (nonNegativeInteger) optional
- Number of 'em' to indent from left
- isInherited (boolean) optional
- If true, display elements using 'inherited' CSS class.
- isNewField (boolean) optional
- If true, display elements using 'newFields' CSS class.
- schemaLoc (String) optional
- Schema file containing this particle list;
- if in current schema, 'schemaLoc' is set to 'this'.
- typeList (String) optional
- List of types in this call chain. Name of type starts
- with '*', and ends with '+'. (Used to prevent infinite
- recursive loop.)
- -->
- <xsl:template name="PrintSampleParticleList">
- <xsl:param name="list"/>
- <xsl:param name="margin">0</xsl:param>
- <xsl:param name="isInherited">false</xsl:param>
- <xsl:param name="isNewField">false</xsl:param>
- <xsl:param name="schemaLoc">this</xsl:param>
- <xsl:param name="typeList"/>
-
- <xsl:if test="$list">
- <xsl:apply-templates select="$list/xsd:group | $list/xsd:sequence | $list/xsd:choice | $list/xsd:all | $list/xsd:element" mode="sample">
- <xsl:with-param name="margin" select="$margin"/>
- <xsl:with-param name="isInherited" select="$isInherited"/>
- <xsl:with-param name="isNewField" select="$isNewField"/>
- <xsl:with-param name="schemaLoc" select="$schemaLoc"/>
- <xsl:with-param name="typeList" select="$typeList"/>
- </xsl:apply-templates>
- </xsl:if>
- </xsl:template>
-
- <!--
- Prints out the constraints of simple content
- to be displayed within a sample XML instance.
- Param(s):
- simpleContent (Node) required
- Node containing with the simple content
- schemaLoc (String) optional
- Schema file containing these simple constraints;
- if in current schema, 'schemaLoc' is set to 'this'.
- -->
- <xsl:template name="PrintSampleSimpleConstraints">
- <xsl:param name="simpleContent"/>
- <xsl:param name="schemaLoc">this</xsl:param>
- <xsl:param name="typeList"/>
-
- <xsl:choose>
- <!-- Derivation by restriction -->
- <xsl:when test="$simpleContent/xsd:restriction">
- <xsl:call-template name="PrintSampleSimpleRestriction">
- <xsl:with-param name="restriction" select="$simpleContent/xsd:restriction"/>
- <xsl:with-param name="schemaLoc" select="$schemaLoc"/>
- <xsl:with-param name="typeList" select="$typeList"/>
- </xsl:call-template>
- </xsl:when>
- <!-- Derivation by list -->
- <xsl:when test="$simpleContent/xsd:list">
- <xsl:choose>
- <xsl:when test="$simpleContent/xsd:list/@itemType">
- <xsl:text>list of: </xsl:text>
- <xsl:call-template name="PrintTypeRef">
- <xsl:with-param name="ref" select="$simpleContent/xsd:list/@itemType"/>
- <xsl:with-param name="schemaLoc" select="$schemaLoc"/>
- </xsl:call-template>
- </xsl:when>
- <xsl:otherwise>
- <xsl:text>list of: [ </xsl:text>
- <xsl:call-template name="PrintSampleSimpleConstraints">
- <xsl:with-param name="simpleContent" select="$simpleContent/xsd:list/xsd:simpleType"/>
- <xsl:with-param name="schemaLoc" select="$schemaLoc"/>
- </xsl:call-template>
- <xsl:text> ]</xsl:text>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:when>
- <!-- Derivation by union -->
- <xsl:when test="$simpleContent/xsd:union">
- <xsl:text>union of: [ </xsl:text>
-
- <xsl:variable name="hasMemberTypes">
- <xsl:if test="normalize-space($simpleContent/xsd:union/@memberTypes)!=''">
- <xsl:text>true</xsl:text>
- </xsl:if>
- </xsl:variable>
- <xsl:if test="$hasMemberTypes='true'">
- <xsl:call-template name="PrintWhitespaceList">
- <xsl:with-param name="value" select="$simpleContent/xsd:union/@memberTypes"/>
- <xsl:with-param name="compType">type</xsl:with-param>
- <xsl:with-param name="separator">,</xsl:with-param>
- <xsl:with-param name="schemaLoc" select="$schemaLoc"/>
- </xsl:call-template>
- </xsl:if>
- <xsl:for-each select="$simpleContent/xsd:union/xsd:simpleType">
- <xsl:if test="position()!=1 or $hasMemberTypes='true'">
- <xsl:text>, </xsl:text>
- </xsl:if>
- <xsl:text>[ </xsl:text>
- <xsl:call-template name="PrintSampleSimpleConstraints">
- <xsl:with-param name="simpleContent" select="."/>
- <xsl:with-param name="schemaLoc" select="$schemaLoc"/>
- </xsl:call-template>
- <xsl:text> ]</xsl:text>
- </xsl:for-each>
-
- <xsl:text> ]</xsl:text>
- </xsl:when>
- </xsl:choose>
- </xsl:template>
-
- <!--
- Prints out the constraints of simple content
- derived by restriction, which is to be displayed
- within a sample XML instance.
- Param(s):
- restriction (Node) required
- Node containing with the restriction
- schemaLoc (String) optional
- Schema file containing this restriction element;
- if in current schema, 'schemaLoc' is set to 'this'.
- -->
- <xsl:template name="PrintSampleSimpleRestriction">
- <xsl:param name="restriction"/>
- <xsl:param name="schemaLoc">this</xsl:param>
- <xsl:param name="typeList"/>
-
- <xsl:variable name="typeName" select="$restriction/parent::xsd:simpleType/@name"/>
-
- <!-- Print out base type info -->
- <xsl:choose>
- <!-- Circular type hierarchy -->
- <xsl:when test="$typeName != '' and contains($typeList, concat('*', $typeName, '+'))">
- <xsl:call-template name="HandleError">
- <xsl:with-param name="isTerminating">false</xsl:with-param>
- <xsl:with-param name="errorMsg">
- <xsl:text>Circular type reference to '</xsl:text>
- <xsl:value-of select="$typeName"/>
- <xsl:text>' in type hierarchy.</xsl:text>
- </xsl:with-param>
- </xsl:call-template>
- </xsl:when>
- <!-- Locally-defined base type -->
- <xsl:when test="$restriction/xsd:simpleType">
- <xsl:call-template name="PrintSampleSimpleConstraints">
- <xsl:with-param name="simpleContent" select="$restriction/xsd:simpleType"/>
- <xsl:with-param name="schemaLoc" select="$schemaLoc"/>
- <xsl:with-param name="typeList" select="$typeList"/>
- </xsl:call-template>
- </xsl:when>
- <!-- Base type reference -->
- <xsl:when test="$restriction">
- <xsl:variable name="baseTypeRef" select="$restriction/@base"/>
- <xsl:variable name="baseTypeName">
- <xsl:call-template name="GetRefName">
- <xsl:with-param name="ref" select="$baseTypeRef"/>
- </xsl:call-template>
- </xsl:variable>
- <xsl:variable name="baseTypeNS">
- <xsl:call-template name="GetRefNS">
- <xsl:with-param name="ref" select="$baseTypeRef"/>
- </xsl:call-template>
- </xsl:variable>
- <!-- Write out reference to base type -->
- <xsl:call-template name="PrintTypeRef">
- <xsl:with-param name="ref" select="$baseTypeRef"/>
- <xsl:with-param name="schemaLoc" select="$schemaLoc"/>
- </xsl:call-template>
- </xsl:when>
- </xsl:choose>
-
- <!-- Regular Expression Pattern -->
- <xsl:variable name="pattern">
- <xsl:call-template name="PrintPatternFacet">
- <xsl:with-param name="simpleRestrict" select="$restriction"/>
- </xsl:call-template>
- </xsl:variable>
- <!-- Range -->
- <xsl:variable name="range">
- <xsl:call-template name="PrintRangeFacets">
- <xsl:with-param name="simpleRestrict" select="$restriction"/>
- </xsl:call-template>
- </xsl:variable>
- <!-- Length -->
- <xsl:variable name="length">
- <xsl:call-template name="PrintLengthFacets">
- <xsl:with-param name="simpleRestrict" select="$restriction"/>
- </xsl:call-template>
- </xsl:variable>
-
- <!-- Print out facets -->
- <xsl:if test="$restriction/xsd:enumeration">
- <xsl:text> (</xsl:text>
- <xsl:call-template name="PrintEnumFacets">
- <xsl:with-param name="simpleRestrict" select="$restriction"/>
- </xsl:call-template>
- <xsl:text>)</xsl:text>
- </xsl:if>
- <xsl:if test="$pattern !=''">
- <xsl:text> (</xsl:text>
- <xsl:copy-of select="$pattern"/>
- <xsl:text>)</xsl:text>
- </xsl:if>
- <xsl:if test="$range !=''">
- <xsl:text> (</xsl:text>
- <xsl:copy-of select="$range"/>
- <xsl:text>)</xsl:text>
- </xsl:if>
- <xsl:if test="$restriction/xsd:totalDigits">
- <xsl:text> (</xsl:text>
- <xsl:call-template name="PrintTotalDigitsFacet">
- <xsl:with-param name="simpleRestrict" select="$restriction"/>
- </xsl:call-template>
- <xsl:text>)</xsl:text>
- </xsl:if>
- <xsl:if test="$restriction/xsd:fractionDigits">
- <xsl:text> (</xsl:text>
- <xsl:call-template name="PrintFractionDigitsFacet">
- <xsl:with-param name="simpleRestrict" select="$restriction"/>
- </xsl:call-template>
- <xsl:text>)</xsl:text>
- </xsl:if>
- <xsl:if test="$length !=''">
- <xsl:text> (</xsl:text>
- <xsl:copy-of select="$length"/>
- <xsl:text>)</xsl:text>
- </xsl:if>
- <xsl:if test="$restriction/xsd:whiteSpace">
- <xsl:text> (</xsl:text>
- <xsl:call-template name="PrintWhitespaceFacet">
- <xsl:with-param name="simpleRestrict" select="$restriction"/>
- </xsl:call-template>
- <xsl:text>)</xsl:text>
- </xsl:if>
- </xsl:template>
-
- <!-- ******** Schema Component Representation table ******** -->
-
- <!--
- Prints out the Schema Component Representation table
- for a top-level schema component.
- Param(s):
- component (Node) required
- Top-level schema component
- -->
- <xsl:template name="SchemaComponentTable">
- <xsl:param name="component"/>
-
- <xsl:variable name="componentID">
- <xsl:call-template name="GetComponentID">
- <xsl:with-param name="component" select="$component"/>
- </xsl:call-template>
- </xsl:variable>
-
- <xsl:call-template name="CollapseableBox">
- <xsl:with-param name="id" select="concat($componentID, '_scbox')"/>
- <xsl:with-param name="styleClass">schemaComponent</xsl:with-param>
- <xsl:with-param name="caption">Schema Component Representation</xsl:with-param>
- <xsl:with-param name="contents">
- <xsl:apply-templates select="$component" mode="schemaComponent"/>
- </xsl:with-param>
- <xsl:with-param name="isOpened">false</xsl:with-param>
- </xsl:call-template>
- </xsl:template>
-
- <!--
- Prints out schema component representation of
- declarations.
- Param(s):
- margin (nonNegativeInteger) optional
- Number of 'em' to indent from left
- -->
- <xsl:template match="xsd:attribute[@name] | xsd:element[@name]" mode="schemaComponent">
- <xsl:param name="margin">0</xsl:param>
-
- <xsl:call-template name="DisplaySchemaComponent">
- <xsl:with-param name="component" select="."/>
- <xsl:with-param name="margin" select="$margin"/>
- <xsl:with-param name="attributes">
- <!-- Attribute: name -->
- <xsl:call-template name="DisplayAttr">
- <xsl:with-param name="attrName">name</xsl:with-param>
- <xsl:with-param name="attrValue" select="normalize-space(@name)"/>
- </xsl:call-template>
- <!-- Attribute: type -->
- <xsl:if test="@type">
- <xsl:call-template name="DisplayAttr">
- <xsl:with-param name="attrName">type</xsl:with-param>
- <xsl:with-param name="attrValue">
- <xsl:call-template name="PrintTypeRef">
- <xsl:with-param name="ref" select="normalize-space(@type)"/>
- </xsl:call-template>
- </xsl:with-param>
- </xsl:call-template>
- </xsl:if>
- <!-- Other attributes -->
- <xsl:call-template name="DisplayOtherAttributes">
- <xsl:with-param name="component" select="."/>
- <xsl:with-param name="attrsNotToDisplay">*name+*type+</xsl:with-param>
- </xsl:call-template>
- </xsl:with-param>
- <xsl:with-param name="excludeFilter">*annotation+</xsl:with-param>
- </xsl:call-template>
- </xsl:template>
-
- <!--
- Prints out schema component representation of
- definitions and key/uniqueness constraints.
- Param(s):
- margin (nonNegativeInteger) optional
- Number of 'em' to indent from left
- -->
- <xsl:template match="xsd:attributeGroup[@name] | xsd:complexType[@name] | xsd:simpleType[@name] | xsd:group[@name] | xsd:key | xsd:unique" mode="schemaComponent">
- <xsl:param name="margin">0</xsl:param>
-
- <xsl:call-template name="DisplaySchemaComponent">
- <xsl:with-param name="component" select="."/>
- <xsl:with-param name="margin" select="$margin"/>
- <xsl:with-param name="attributes">
- <!-- Attribute: name -->
- <xsl:call-template name="DisplayAttr">
- <xsl:with-param name="attrName">name</xsl:with-param>
- <xsl:with-param name="attrValue" select="normalize-space(@name)"/>
- </xsl:call-template>
- <!-- Other attributes -->
- <xsl:call-template name="DisplayOtherAttributes">
- <xsl:with-param name="component" select="."/>
- <xsl:with-param name="attrsNotToDisplay">*name+</xsl:with-param>
- </xsl:call-template>
- </xsl:with-param>
- <xsl:with-param name="excludeFilter">*annotation+</xsl:with-param>
- </xsl:call-template>
- </xsl:template>
-
- <!--
- Prints out schema component representation of attribute
- references.
- Param(s):
- margin (nonNegativeInteger) optional
- Number of 'em' to indent from left
- -->
- <xsl:template match="xsd:attribute[@ref]" mode="schemaComponent">
- <xsl:param name="margin">0</xsl:param>
-
- <xsl:call-template name="DisplaySchemaComponent">
- <xsl:with-param name="component" select="."/>
- <xsl:with-param name="margin" select="$margin"/>
- <xsl:with-param name="attributes">
- <!-- Attribute: ref -->
- <xsl:call-template name="DisplayAttr">
- <xsl:with-param name="attrName">ref</xsl:with-param>
- <xsl:with-param name="attrValue">
- <xsl:call-template name="PrintAttributeRef">
- <xsl:with-param name="ref" select="normalize-space(@ref)"/>
- </xsl:call-template>
- </xsl:with-param>
- </xsl:call-template>
- <!-- Other attributes -->
- <xsl:call-template name="DisplayOtherAttributes">
- <xsl:with-param name="component" select="."/>
- <xsl:with-param name="attrsNotToDisplay">*ref+</xsl:with-param>
- </xsl:call-template>
- </xsl:with-param>
- <xsl:with-param name="excludeFilter">*annotation+</xsl:with-param>
- </xsl:call-template>
- </xsl:template>
-
- <!--
- Prints out schema component representation of attribute group
- references.
- Param(s):
- margin (nonNegativeInteger) optional
- Number of 'em' to indent from left
- -->
- <xsl:template match="xsd:attributeGroup[@ref]" mode="schemaComponent">
- <xsl:param name="margin">0</xsl:param>
-
- <xsl:call-template name="DisplaySchemaComponent">
- <xsl:with-param name="component" select="."/>
- <xsl:with-param name="margin" select="$margin"/>
- <xsl:with-param name="attributes">
- <!-- Attribute: ref -->
- <xsl:call-template name="DisplayAttr">
- <xsl:with-param name="attrName">ref</xsl:with-param>
- <xsl:with-param name="attrValue">
- <xsl:call-template name="PrintAttributeGroupRef">
- <xsl:with-param name="ref" select="normalize-space(@ref)"/>
- </xsl:call-template>
- </xsl:with-param>
- </xsl:call-template>
- <!-- Other attributes -->
- <xsl:call-template name="DisplayOtherAttributes">
- <xsl:with-param name="component" select="."/>
- <xsl:with-param name="attrsNotToDisplay">*ref+</xsl:with-param>
- </xsl:call-template>
- </xsl:with-param>
- <xsl:with-param name="excludeFilter">*annotation+</xsl:with-param>
- </xsl:call-template>
- </xsl:template>
-
- <!--
- Prints out schema component representation of element
- references.
- Param(s):
- margin (nonNegativeInteger) optional
- Number of 'em' to indent from left
- -->
- <xsl:template match="xsd:element[@ref]" mode="schemaComponent">
- <xsl:param name="margin">0</xsl:param>
-
- <xsl:call-template name="DisplaySchemaComponent">
- <xsl:with-param name="component" select="."/>
- <xsl:with-param name="margin" select="$margin"/>
- <xsl:with-param name="attributes">
- <!-- Attribute: ref -->
- <xsl:call-template name="DisplayAttr">
- <xsl:with-param name="attrName">ref</xsl:with-param>
- <xsl:with-param name="attrValue">
- <xsl:call-template name="PrintElementRef">
- <xsl:with-param name="ref" select="normalize-space(@ref)"/>
- </xsl:call-template>
- </xsl:with-param>
- </xsl:call-template>
- <!-- Other attributes -->
- <xsl:call-template name="DisplayOtherAttributes">
- <xsl:with-param name="component" select="."/>
- <xsl:with-param name="attrsNotToDisplay">*ref+</xsl:with-param>
- </xsl:call-template>
- </xsl:with-param>
- <xsl:with-param name="excludeFilter">*annotation+</xsl:with-param>
- </xsl:call-template>
- </xsl:template>
-
- <!--
- Prints out schema component representation of model group
- references.
- Param(s):
- margin (nonNegativeInteger) optional
- Number of 'em' to indent from left
- -->
- <xsl:template match="xsd:group[@ref]" mode="schemaComponent">
- <xsl:param name="margin">0</xsl:param>
-
- <xsl:call-template name="DisplaySchemaComponent">
- <xsl:with-param name="component" select="."/>
- <xsl:with-param name="margin" select="$margin"/>
- <xsl:with-param name="attributes">
- <!-- Attribute: ref -->
- <xsl:call-template name="DisplayAttr">
- <xsl:with-param name="attrName">ref</xsl:with-param>
- <xsl:with-param name="attrValue">
- <xsl:call-template name="PrintGroupRef">
- <xsl:with-param name="ref" select="normalize-space(@ref)"/>
- </xsl:call-template>
- </xsl:with-param>
- </xsl:call-template>
- <!-- Other attributes -->
- <xsl:call-template name="DisplayOtherAttributes">
- <xsl:with-param name="component" select="."/>
- <xsl:with-param name="attrsNotToDisplay">*ref+</xsl:with-param>
- </xsl:call-template>
- </xsl:with-param>
- <xsl:with-param name="excludeFilter">*annotation+</xsl:with-param>
- </xsl:call-template>
- </xsl:template>
-
- <!--
- Prints out schema component representation of
- 'appinfo' and 'documentation' elements.
- Param(s):
- margin (nonNegativeInteger) optional
- Number of 'em' to indent from left
- -->
- <xsl:template match="xsd:appinfo | xsd:documentation" mode="schemaComponent">
- <xsl:param name="margin">0</xsl:param>
-
- <xsl:call-template name="DisplaySchemaComponent">
- <xsl:with-param name="component" select="."/>
- <xsl:with-param name="margin" select="$margin"/>
- <xsl:with-param name="attributes">
- <!-- Attribute: source -->
- <xsl:if test="@source">
- <xsl:call-template name="DisplayAttr">
- <xsl:with-param name="attrName">source</xsl:with-param>
- <xsl:with-param name="attrValue">
- <xsl:call-template name="PrintURI">
- <xsl:with-param name="uri" select="normalize-space(@source)"/>
- </xsl:call-template>
- </xsl:with-param>
- </xsl:call-template>
- </xsl:if>
- <!-- Other attributes -->
- <xsl:call-template name="DisplayOtherAttributes">
- <xsl:with-param name="component" select="."/>
- <xsl:with-param name="attrsNotToDisplay">*source+</xsl:with-param>
- </xsl:call-template>
- </xsl:with-param>
- <xsl:with-param name="hasAnyContent">true</xsl:with-param>
- </xsl:call-template>
- </xsl:template>
-
- <!--
- Prints out schema component representation of
- key reference constraints.
- Param(s):
- margin (nonNegativeInteger) optional
- Number of 'em' to indent from left
- -->
- <xsl:template match="xsd:keyref" mode="schemaComponent">
- <xsl:param name="margin">0</xsl:param>
-
- <xsl:call-template name="DisplaySchemaComponent">
- <xsl:with-param name="component" select="."/>
- <xsl:with-param name="margin" select="$margin"/>
- <xsl:with-param name="attributes">
- <!-- Attribute: name -->
- <xsl:call-template name="DisplayAttr">
- <xsl:with-param name="attrName">name</xsl:with-param>
- <xsl:with-param name="attrValue" select="normalize-space(@name)"/>
- </xsl:call-template>
- <!-- Attribute: refers -->
- <xsl:call-template name="DisplayAttr">
- <xsl:with-param name="attrName">refer</xsl:with-param>
- <xsl:with-param name="attrValue">
- <xsl:call-template name="PrintKeyRef">
- <xsl:with-param name="ref">
- <xsl:value-of select="normalize-space(@refer)"/>
- </xsl:with-param>
- </xsl:call-template>
- </xsl:with-param>
- </xsl:call-template>
- <!-- Other attributes -->
- <xsl:call-template name="DisplayOtherAttributes">
- <xsl:with-param name="component" select="."/>
- <xsl:with-param name="attrsNotToDisplay">*name+*refer+</xsl:with-param>
- </xsl:call-template>
- </xsl:with-param>
- <xsl:with-param name="excludeFilter">*annotation+</xsl:with-param>
- </xsl:call-template>
- </xsl:template>
-
- <!--
- Prints out schema component representation of
- derivations by extension and restrictions.
- Param(s):
- margin (nonNegativeInteger) optional
- Number of 'em' to indent from left
- -->
- <xsl:template match="xsd:extension | xsd:restriction" mode="schemaComponent">
- <xsl:param name="margin">0</xsl:param>
-
- <xsl:call-template name="DisplaySchemaComponent">
- <xsl:with-param name="component" select="."/>
- <xsl:with-param name="margin" select="$margin"/>
- <xsl:with-param name="attributes">
- <!-- Attribute: base -->
- <xsl:if test="@base">
- <xsl:call-template name="DisplayAttr">
- <xsl:with-param name="attrName">base</xsl:with-param>
- <xsl:with-param name="attrValue">
- <xsl:call-template name="PrintTypeRef">
- <xsl:with-param name="ref" select="normalize-space(@base)"/>
- </xsl:call-template>
- </xsl:with-param>
- </xsl:call-template>
- </xsl:if>
- <!-- Other attributes -->
- <xsl:call-template name="DisplayOtherAttributes">
- <xsl:with-param name="component" select="."/>
- <xsl:with-param name="attrsNotToDisplay">*base+</xsl:with-param>
- </xsl:call-template>
- </xsl:with-param>
- <xsl:with-param name="excludeFilter">*annotation+</xsl:with-param>
- </xsl:call-template>
- </xsl:template>
-
- <!--
- Prints out schema component representation of
- derivations by list.
- Param(s):
- margin (nonNegativeInteger) optional
- Number of 'em' to indent from left
- -->
- <xsl:template match="xsd:list" mode="schemaComponent">
- <xsl:param name="margin">0</xsl:param>
-
- <xsl:call-template name="DisplaySchemaComponent">
- <xsl:with-param name="component" select="."/>
- <xsl:with-param name="margin" select="$margin"/>
- <xsl:with-param name="attributes">
- <!-- Attribute: itemType-->
- <xsl:if test="@itemType">
- <xsl:call-template name="DisplayAttr">
- <xsl:with-param name="attrName">itemType</xsl:with-param>
- <xsl:with-param name="attrValue">
- <xsl:call-template name="PrintTypeRef">
- <xsl:with-param name="ref" select="normalize-space(@itemType)"/>
- </xsl:call-template>
- </xsl:with-param>
- </xsl:call-template>
- </xsl:if>
- <!-- Other attributes -->
- <xsl:call-template name="DisplayOtherAttributes">
- <xsl:with-param name="component" select="."/>
- <xsl:with-param name="attrsNotToDisplay">*itemType+</xsl:with-param>
- </xsl:call-template>
- </xsl:with-param>
- <xsl:with-param name="excludeFilter">*annotation+</xsl:with-param>
- </xsl:call-template>
- </xsl:template>
-
- <!--
- Prints out schema component representation of
- derivations by union.
- Param(s):
- margin (nonNegativeInteger) optional
- Number of 'em' to indent from left
- -->
- <xsl:template match="xsd:union" mode="schemaComponent">
- <xsl:param name="margin">0</xsl:param>
-
- <xsl:call-template name="DisplaySchemaComponent">
- <xsl:with-param name="component" select="."/>
- <xsl:with-param name="margin" select="$margin"/>
- <xsl:with-param name="attributes">
- <!-- Attribute: memberTypes-->
- <xsl:if test="@memberTypes">
- <xsl:call-template name="DisplayAttr">
- <xsl:with-param name="attrName">memberTypes</xsl:with-param>
- <xsl:with-param name="attrValue">
- <xsl:call-template name="PrintWhitespaceList">
- <xsl:with-param name="value" select="normalize-space(@memberTypes)"/>
- <xsl:with-param name="compType">type</xsl:with-param>
- </xsl:call-template>
- </xsl:with-param>
- </xsl:call-template>
- </xsl:if>
- <!-- Other attributes -->
- <xsl:call-template name="DisplayOtherAttributes">
- <xsl:with-param name="component" select="."/>
- <xsl:with-param name="attrsNotToDisplay">*memberTypes+</xsl:with-param>
- </xsl:call-template>
- </xsl:with-param>
- <xsl:with-param name="excludeFilter">*annotation+</xsl:with-param>
- </xsl:call-template>
- </xsl:template>
-
- <!--
- Prints out schema component representation of
- the root schema element.
- Param(s):
- margin (nonNegativeInteger) optional
- Number of 'em' to indent from left
- -->
- <xsl:template match="xsd:schema" mode="schemaComponent">
- <xsl:param name="margin">0</xsl:param>
-
- <xsl:call-template name="DisplaySchemaComponent">
- <xsl:with-param name="component" select="."/>
- <xsl:with-param name="margin" select="$margin"/>
- <xsl:with-param name="attributes">
- <!-- Attribute: source -->
- <xsl:if test="@xml:lang">
- <xsl:call-template name="DisplayAttr">
- <xsl:with-param name="attrName">xml:lang</xsl:with-param>
- <xsl:with-param name="attrValue" select="normalize-space(@xml:lang)"/>
- </xsl:call-template>
- </xsl:if>
- <!-- Other attributes -->
- <xsl:call-template name="DisplayOtherAttributes">
- <xsl:with-param name="component" select="."/>
- <xsl:with-param name="attrsNotToDisplay">*lang+</xsl:with-param>
- </xsl:call-template>
- </xsl:with-param>
- <xsl:with-param name="includeFilter">*include+*import+*redefine+</xsl:with-param>
- </xsl:call-template>
- </xsl:template>
-
- <!--
- Default way to print out schema component representation.
- Param(s):
- margin (nonNegativeInteger) optional
- Number of 'em' to indent from left
- -->
- <xsl:template match="*" mode="schemaComponent">
- <xsl:param name="margin">0</xsl:param>
-
- <xsl:call-template name="DisplaySchemaComponent">
- <xsl:with-param name="component" select="."/>
- <xsl:with-param name="margin" select="$margin"/>
- <xsl:with-param name="attributes">
- <xsl:call-template name="DisplayOtherAttributes">
- <xsl:with-param name="component" select="."/>
- </xsl:call-template>
- </xsl:with-param>
- <xsl:with-param name="excludeFilter">*annotation+</xsl:with-param>
- </xsl:call-template>
- </xsl:template>
-
- <!--
- Prints out comments in schema component representation.
- Param(s):
- margin (nonNegativeInteger) optional
- Number of 'em' to indent from left
- -->
- <xsl:template match="comment()" mode="schemaComponent">
- <xsl:param name="margin">0</xsl:param>
-
- <div class="comment" style="margin-left: {$margin}em">
- <xsl:text>&lt;--</xsl:text>
- <xsl:value-of select="."/>
- <xsl:text>--&gt;</xsl:text>
- </div>
- </xsl:template>
-
- <!--
- Displays a schema element in the correct format
- for the Schema Component Representation table, e.g.
- tags are one color, and content are another.
- Param(s):
- component (Node) required
- Schema element to be displayed
- attributes (Result Tree Fragment) optional
- Pre-formatted attributes of schema element
- margin (nonNegativeInteger) optional
- Number of 'em' to indent from left
- hasAnyContent (boolean) optional
- Set to true if schema element can accept
- child elements from namespaces other than
- the schema namespace, e.g. 'documentation'
- and 'appinfo'
- includeFilter (String) optional
- List of element names, sandwiched between the
- characters, '*' and '+'. If specified, only the
- child elements of the component with tags in
- the list will be displayed.
- excludeFilter (String) optional
- List of element names, sandwiched between the
- characters, '*' and '+'. If specified, display
- all child elements of the component, except
- those with tags in the list.
- -->
- <xsl:template name="DisplaySchemaComponent">
- <xsl:param name="component"/>
- <xsl:param name="attributes"/>
- <xsl:param name="margin">0</xsl:param>
- <xsl:param name="hasAnyContent">false</xsl:param>
- <xsl:param name="includeFilter"/>
- <xsl:param name="excludeFilter"/>
-
- <xsl:variable name="tag">
- <xsl:call-template name="PrintNSPrefix">
- <xsl:with-param name="prefix">
- <xsl:call-template name="GetXSDPrefix"/>
- </xsl:with-param>
- <xsl:with-param name="nolink">true</xsl:with-param>
- </xsl:call-template>
- <xsl:value-of select="local-name($component)"/>
- </xsl:variable>
-
- <div style="margin-left: {$margin}em">
- <!-- Start Tag -->
- <xsl:text>&lt;</xsl:text>
- <span class="scTag">
- <xsl:copy-of select="$tag"/>
- </span>
- <!-- Attributes -->
- <xsl:copy-of select="$attributes"/>
- <!-- Content -->
- <xsl:variable name="content">
- <xsl:choose>
- <!-- Include filter is on -->
- <xsl:when test="$includeFilter!=''">
- <xsl:apply-templates select="$component/xsd:*[contains($includeFilter, concat('*', local-name(.), '+'))]" mode="schemaComponent">
- <xsl:with-param name="margin" select="$ELEM_INDENT"/>
- </xsl:apply-templates>
- <div class="scContent" style="margin-left: {$ELEM_INDENT}em">...</div>
- </xsl:when>
- <!-- Exclude filter is on -->
- <xsl:when test="$excludeFilter!=''">
- <xsl:apply-templates select="comment() | $component/xsd:*[not(contains($excludeFilter, concat('*', local-name(.), '+')))]" mode="schemaComponent">
- <xsl:with-param name="margin" select="$ELEM_INDENT"/>
- </xsl:apply-templates>
- </xsl:when>
- <!-- Permits any content -->
- <xsl:when test="$hasAnyContent='true'">
- <div class="scContent" style="margin-left: {$ELEM_INDENT}em">
- <xsl:apply-templates select="comment() | $component/* | $component/text()" mode="xpp"/>
- </div>
- </xsl:when>
- <!-- Contains schema elements -->
- <xsl:otherwise>
- <xsl:apply-templates select="comment() | $component/xsd:*" mode="schemaComponent">
- <xsl:with-param name="margin" select="$ELEM_INDENT"/>
- </xsl:apply-templates>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:variable>
-
- <xsl:choose>
- <!-- Has content -->
- <xsl:when test="normalize-space($content)!=''">
- <!-- End of start tag -->
- <xsl:text>></xsl:text>
-
- <!-- Content -->
- <xsl:copy-of select="$content"/>
-
- <!-- End Tag -->
- <xsl:text>&lt;/</xsl:text>
- <span class="scTag">
- <xsl:copy-of select="$tag"/>
- </span>
- <xsl:text>></xsl:text>
- </xsl:when>
- <!-- Empty content -->
- <xsl:otherwise>
- <!-- End of start tag -->
- <xsl:text>/></xsl:text>
- </xsl:otherwise>
- </xsl:choose>
- </div>
- </xsl:template>
-
- <!--
- Displays a schema attribute in the correct format
- for the Schema Component Representation table, e.g.
- tags are one color, and content are another.
- Param(s):
- attrName (String) required
- Name of attribute
- attrValue (Result Tree Fragment) required
- Value of attribute, which may be links
- -->
- <xsl:template name="DisplayAttr">
- <xsl:param name="attrName"/>
- <xsl:param name="attrValue"/>
-
- <xsl:text> </xsl:text>
- <span class="scTag">
- <xsl:value-of select="$attrName"/>
- </span>
- <xsl:text>="</xsl:text>
- <xsl:if test="normalize-space($attrValue)!=''">
- <span class="scContent">
- <xsl:copy-of select="$attrValue"/>
- </span>
- </xsl:if>
- <xsl:text>"</xsl:text>
- </xsl:template>
-
- <!--
- Displays attributes from a schema element, unless
- otherwise specified, in the correct format
- for the Schema Component Representation table, e.g.
- tags are one color, and content are another.
- Param(s):
- component (Node) required
- Schema element whose attributes are to be displayed
- attrsNotToDisplay (String) required
- List of attributes not to be displayed
- Each attribute name should prepended with '*'
- and appended with '+'
- -->
- <xsl:template name="DisplayOtherAttributes">
- <xsl:param name="component"/>
- <xsl:param name="attrsNotToDisplay"/>
-
- <xsl:for-each select="$component/attribute::*">
- <xsl:variable name="attrName" select="local-name(.)"/>
- <xsl:if test="not(contains($attrsNotToDisplay, concat('*', $attrName, '+')))">
- <xsl:call-template name="DisplayAttr">
- <xsl:with-param name="attrName" select="normalize-space($attrName)"/>
- <xsl:with-param name="attrValue" select="normalize-space(.)"/>
- </xsl:call-template>
- </xsl:if>
- </xsl:for-each>
- </xsl:template>
-
-
- <!-- ******** XML Pretty Printer ******** -->
-
- <!--
- Puts XHTML elements into the result.
- -->
- <xsl:template match="html:*" mode="html">
- <xsl:element name="{local-name(.)}">
- <xsl:for-each select="@*">
- <xsl:copy-of select="."/>
- </xsl:for-each>
- <xsl:apply-templates select="* | text()" mode="html"/>
- </xsl:element>
- </xsl:template>
-
- <!--
- Displays non-XHTML elements found within XHTML elements.
- -->
- <xsl:template match="*" mode="html">
- <xsl:call-template name="WriteElement">
- <xsl:with-param name="element" select="."/>
- <xsl:with-param name="mode">html</xsl:with-param>
- </xsl:call-template>
- </xsl:template>
-
- <!--
- Displays text node.
- -->
- <xsl:template match="text()" mode="html">
- <xsl:value-of select="."/>
- </xsl:template>
-
- <!--
- Displays an arbitrary XML element.
- -->
- <xsl:template match="*" mode="xpp">
- <code>
- <xsl:call-template name="WriteElement">
- <xsl:with-param name="element" select="."/>
- <xsl:with-param name="mode">xpp</xsl:with-param>
- </xsl:call-template>
- </code>
- </xsl:template>
-
- <!--
- Displays an arbitrary XML text node.
- -->
- <xsl:template match="text()" mode="xpp">
- <xsl:value-of select="."/>
- </xsl:template>
-
- <!--
- Displays an XML comment.
- -->
- <xsl:template match="comment()" mode="xpp">
- <div class="comment">
- <xsl:text>&lt;--</xsl:text>
- <xsl:value-of select="."/>
- <xsl:text>--&gt;</xsl:text>
- </div>
- </xsl:template>
-
- <!--
- Displays an XML element in the documentation, e.g.
- tags are escaped.
- Param(s):
- element (Node) required
- XML element to display
- mode (xpp|html) required
- Which mode to invoke for child elements
- -->
- <xsl:template name="WriteElement">
- <xsl:param name="element"/>
- <xsl:param name="mode">xpp</xsl:param>
-
- <!-- Start Tag -->
- <xsl:text>&lt;</xsl:text>
- <xsl:call-template name="PrintNSPrefix">
- <xsl:with-param name="prefix">
- <xsl:call-template name="GetRefPrefix">
- <xsl:with-param name="ref" select="name($element)"/>
- </xsl:call-template>
- </xsl:with-param>
- </xsl:call-template>
- <xsl:value-of select="local-name($element)"/>
- <!-- Attributes -->
- <xsl:for-each select="$element/@*">
- <xsl:text> </xsl:text>
- <xsl:value-of select="name(.)"/>
- <xsl:text>="</xsl:text>
- <xsl:value-of select="."/>
- <xsl:text>"</xsl:text>
- </xsl:for-each>
-
- <xsl:choose>
- <xsl:when test="$element/* | $element/text()">
- <!-- Close Start Tag -->
- <xsl:text>> </xsl:text>
- <!-- Content -->
- <xsl:choose>
- <xsl:when test="$mode!='xpp'">
- <xsl:apply-templates select="$element/* | $element/text()" mode="html"/>
- </xsl:when>
- <xsl:otherwise>
- <div style="margin-left: {$ELEM_INDENT}em">
- <xsl:apply-templates select="$element/* | $element/text()" mode="xpp"/>
- </div>
- </xsl:otherwise>
- </xsl:choose>
- <!-- End Tag -->
- <xsl:text>&lt;/</xsl:text>
- <xsl:call-template name="PrintNSPrefix">
- <xsl:with-param name="prefix">
- <xsl:call-template name="GetRefPrefix">
- <xsl:with-param name="ref" select="name($element)"/>
- </xsl:call-template>
- </xsl:with-param>
- </xsl:call-template>
- <xsl:value-of select="local-name($element)"/>
- <xsl:text>></xsl:text>
- </xsl:when>
- <xsl:otherwise>
- <!-- Close Start Tag -->
- <xsl:text>/></xsl:text>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:template>
-
-
- <!-- ******** Templates for Handling References ******** -->
-
- <!--
- Prints out a reference to a term in the glossary section.
- Param(s):
- code (String) required
- Unique ID of glossary term
- term (String) optional
- Glossary term
- -->
- <xsl:template name="PrintGlossaryTermRef">
- <xsl:param name="code"/>
- <xsl:param name="term"/>
-
- <xsl:choose>
- <xsl:when test="$code !='' and normalize-space(translate($printGlossary,'TRUE','true'))='true'">
- <a title="Look up '{$term}' in glossary" href="#{concat($TERM_PREFIX, $code)}">
- <xsl:choose>
- <xsl:when test="$term!=''">
- <xsl:value-of select="$term"/>
- </xsl:when>
- <xsl:otherwise>
- <xsl:text>[term]</xsl:text>
- </xsl:otherwise>
- </xsl:choose>
- </a>
- </xsl:when>
- <xsl:otherwise>
- <xsl:value-of select="$term"/>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:template>
-
- <!--
- Prints out a reference to a namespace in the schema.
- Param(s):
- prefix (String) required
- Namespace prefix referenced
- schemaLoc (String) optional
- Schema file containing this namespace prefix;
- if in current schema, 'schemaLoc' is set to 'this'
- -->
- <xsl:template name="PrintNamespaceRef">
- <xsl:param name="prefix"/>
- <xsl:param name="schemaLoc">this</xsl:param>
-
- <xsl:if test="$prefix!=''">
- <xsl:choose>
- <xsl:when test="/xsd:schema/namespace::*[local-name(.)=normalize-space($prefix)]">
- <xsl:variable name="link">
- <xsl:if test="normalize-space($schemaLoc)!='this'">
- <xsl:call-template name="GetSchemaDocLocation">
- <xsl:with-param name="uri" select="$schemaLoc"/>
- </xsl:call-template>
- </xsl:if>
- <xsl:value-of select="concat('#', $NS_PREFIX, $prefix)"/>
- </xsl:variable>
- <a href="{$link}" title="Find out namespace of '{$prefix}' prefix">
- <xsl:value-of select="$prefix"/>
- </a>
- </xsl:when>
- <xsl:otherwise>
- <xsl:variable name="title">
- <xsl:text>Unknown namespace prefix, </xsl:text>
- <xsl:value-of select="$prefix"/>
- <xsl:text>.</xsl:text>
- </xsl:variable>
- <a href="javascript:void(0)" onclick="alert('{$title}')" title="{$title}">
- <xsl:value-of select="$prefix"/>
- </a>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:if>
- </xsl:template>
-
- <!--
- Generates a link to an attribute.
- Param(s):
- name (String) optional
- Name of attribute
- ref (String) optional
- Reference to attribute
- (One of 'name' and 'ref' must be provided.)
- schemaLoc (String) optional
- Schema file containing this attribute reference
- if in current schema, 'schemaLoc' is set to 'this'
- -->
- <xsl:template name="PrintAttributeRef">
- <xsl:param name="name"/>
- <xsl:param name="ref"/>
- <xsl:param name="schemaLoc">this</xsl:param>
-
- <xsl:choose>
- <xsl:when test="$name!=''">
- <xsl:call-template name="PrintCompName">
- <xsl:with-param name="name" select="$name"/>
- <xsl:with-param name="compType">attribute</xsl:with-param>
- <xsl:with-param name="schemaLoc" select="$schemaLoc"/>
- </xsl:call-template>
- </xsl:when>
- <xsl:when test="$ref!=''">
- <xsl:call-template name="PrintCompRef">
- <xsl:with-param name="ref" select="$ref"/>
- <xsl:with-param name="compType">attribute</xsl:with-param>
- <xsl:with-param name="schemaLoc" select="$schemaLoc"/>
- </xsl:call-template>
- </xsl:when>
- </xsl:choose>
- </xsl:template>
-
- <!--
- Generates a link to an attribute group.
- Param(s):
- name (String) optional
- Name of attribute group
- ref (String) optional
- Reference to attribute group
- (One of 'name' and 'ref' must be provided.)
- schemaLoc (String) optional
- Schema file containing this attribute group reference
- if in current schema, 'schemaLoc' is set to 'this'
- -->
- <xsl:template name="PrintAttributeGroupRef">
- <xsl:param name="name"/>
- <xsl:param name="ref"/>
- <xsl:param name="schemaLoc">this</xsl:param>
-
- <xsl:choose>
- <xsl:when test="$name!=''">
- <xsl:call-template name="PrintCompName">
- <xsl:with-param name="name" select="$name"/>
- <xsl:with-param name="compType">attribute group</xsl:with-param>
- <xsl:with-param name="schemaLoc" select="$schemaLoc"/>
- </xsl:call-template>
- </xsl:when>
- <xsl:when test="$ref!=''">
- <xsl:call-template name="PrintCompRef">
- <xsl:with-param name="ref" select="$ref"/>
- <xsl:with-param name="compType">attribute group</xsl:with-param>
- <xsl:with-param name="schemaLoc" select="$schemaLoc"/>
- </xsl:call-template>
- </xsl:when>
- </xsl:choose>
- </xsl:template>
-
- <!--
- Generates a link to an element.
- Param(s):
- name (String) optional
- Name of element
- ref (String) optional
- Reference to element
- (One of 'name' and 'ref' must be provided.)
- schemaLoc (String) optional
- Schema file containing this element reference
- if in current schema, 'schemaLoc' is set to 'this'
- -->
- <xsl:template name="PrintElementRef">
- <xsl:param name="name"/>
- <xsl:param name="ref"/>
- <xsl:param name="schemaLoc">this</xsl:param>
-
- <xsl:choose>
- <xsl:when test="$name!=''">
- <xsl:call-template name="PrintCompName">
- <xsl:with-param name="name" select="$name"/>
- <xsl:with-param name="compType">element</xsl:with-param>
- <xsl:with-param name="schemaLoc" select="$schemaLoc"/>
- </xsl:call-template>
- </xsl:when>
- <xsl:when test="$ref!=''">
- <xsl:call-template name="PrintCompRef">
- <xsl:with-param name="ref" select="$ref"/>
- <xsl:with-param name="compType">element</xsl:with-param>
- <xsl:with-param name="schemaLoc" select="$schemaLoc"/>
- </xsl:call-template>
- </xsl:when>
- </xsl:choose>
- </xsl:template>
-
- <!--
- Generates a link to a group.
- Param(s):
- name (String) optional
- Name of group
- ref (String) optional
- Reference to group
- (One of 'name' and 'ref' must be provided.)
- schemaLoc (String) optional
- Schema file containing this group reference
- if in current schema, 'schemaLoc' is set to 'this'
- -->
- <xsl:template name="PrintGroupRef">
- <xsl:param name="name"/>
- <xsl:param name="ref"/>
- <xsl:param name="schemaLoc">this</xsl:param>
-
- <xsl:choose>
- <xsl:when test="$name!=''">
- <xsl:call-template name="PrintCompName">
- <xsl:with-param name="name" select="$name"/>
- <xsl:with-param name="compType">group</xsl:with-param>
- <xsl:with-param name="schemaLoc" select="$schemaLoc"/>
- </xsl:call-template>
- </xsl:when>
- <xsl:when test="$ref!=''">
- <xsl:call-template name="PrintCompRef">
- <xsl:with-param name="ref" select="$ref"/>
- <xsl:with-param name="compType">group</xsl:with-param>
- <xsl:with-param name="schemaLoc" select="$schemaLoc"/>
- </xsl:call-template>
- </xsl:when>
- </xsl:choose>
- </xsl:template>
-
- <!--
- Generates a link to a key/uniqueness constraint.
- Param(s):
- name (String) optional
- Name of key/uniqueness constraint
- ref (String) optional
- Reference to key/uniqueness constraint
- (One of 'name' and 'ref' must be provided.)
- schemaLoc (String) optional
- Schema file containing this key/uniqueness constraint
- reference; if in current schema, 'schemaLoc' is set
- to 'this'
- -->
- <xsl:template name="PrintKeyRef">
- <xsl:param name="name"/>
- <xsl:param name="ref"/>
- <xsl:param name="schemaLoc">this</xsl:param>
-
- <xsl:choose>
- <xsl:when test="$name!=''">
- <xsl:call-template name="PrintCompName">
- <xsl:with-param name="name" select="$name"/>
- <xsl:with-param name="compType">uniqueness/key constraint</xsl:with-param>
- <xsl:with-param name="schemaLoc" select="$schemaLoc"/>
- </xsl:call-template>
- </xsl:when>
- <xsl:when test="$ref!=''">
- <xsl:call-template name="PrintCompRef">
- <xsl:with-param name="ref" select="$ref"/>
- <xsl:with-param name="compType">uniqueness/key constraint</xsl:with-param>
- <xsl:with-param name="schemaLoc" select="$schemaLoc"/>
- </xsl:call-template>
- </xsl:when>
- </xsl:choose>
- </xsl:template>
-
- <!--
- Generates a link to a type.
- Param(s):
- name (String) optional
- Name of type
- ref (String) optional
- Reference to type
- (One of 'name' and 'ref' must be provided.)
- schemaLoc (String) optional
- Schema file containing this type reference'
- if in current schema, 'schemaLoc' is set
- to 'this'
- -->
- <xsl:template name="PrintTypeRef">
- <xsl:param name="name"/>
- <xsl:param name="ref"/>
- <xsl:param name="schemaLoc">this</xsl:param>
-
- <xsl:choose>
- <xsl:when test="$name!=''">
- <span class="type">
- <xsl:call-template name="PrintCompName">
- <xsl:with-param name="name" select="$name"/>
- <xsl:with-param name="compType">type</xsl:with-param>
- <xsl:with-param name="schemaLoc" select="$schemaLoc"/>
- </xsl:call-template>
- </span>
- </xsl:when>
- <xsl:when test="$ref!=''">
- <span class="type">
- <xsl:call-template name="PrintCompRef">
- <xsl:with-param name="ref" select="$ref"/>
- <xsl:with-param name="compType">type</xsl:with-param>
- <xsl:with-param name="schemaLoc" select="$schemaLoc"/>
- </xsl:call-template>
- </span>
- </xsl:when>
- </xsl:choose>
- </xsl:template>
-
- <!--
- Prints out a link to a schema component's section.
- Param(s):
- baseFile (String) optional
- Documentation file of schema containing this
- component.
- If this component belongs to the current schema,
- omit this variable.
- If this component is from an included or imported
- schema, provide this variable.
- name (String) required
- Name of schema component
- compType (String) required
- Type of schema component
- errMsg (String) optional
- Sentence fragment.
- If specified, link will open up an alert box with
- an error message. For example, if 'errMsg' was set
- to "could not be found", 'name' was "x", and
- 'compType' was "type", the error message would be:
- "x" type definition could not be found.
- The sentence fragment should not:
- -start with a capital letter.
- -have a space in front
- -end with a period.
- schemaLoc (String) optional
- Schema file containing this component;
- if in current schema, 'schemaLoc' is set to 'this'
- -->
- <xsl:template name="PrintCompName">
- <xsl:param name="baseFile"/>
- <xsl:param name="name"/>
- <xsl:param name="compType"/>
- <xsl:param name="schemaLoc">this</xsl:param>
- <xsl:param name="errMsg"/>
-
- <!-- Get correct terminology for statements -->
- <xsl:variable name="noun">
- <xsl:choose>
- <xsl:when test="$compType='element' or $compType='attribute'">
- <xsl:text>declaration</xsl:text>
- </xsl:when>
- <xsl:otherwise>
- <xsl:text>definition</xsl:text>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:variable>
-
- <!-- Get prefix to use in anchor name. -->
- <xsl:variable name="compPrefix">
- <xsl:choose>
- <xsl:when test="$compType='attribute'">
- <xsl:value-of select="$ATTR_PREFIX"/>
- </xsl:when>
- <xsl:when test="$compType='attribute group'">
- <xsl:value-of select="$ATTR_GRP_PREFIX"/>
- </xsl:when>
- <xsl:when test="$compType='element'">
- <xsl:value-of select="$ELEM_PREFIX"/>
- </xsl:when>
- <xsl:when test="$compType='group'">
- <xsl:value-of select="$GRP_PREFIX"/>
- </xsl:when>
- <xsl:when test="$compType='type'">
- <xsl:value-of select="$TYPE_PREFIX"/>
- </xsl:when>
- <xsl:when test="$compType='uniqueness/key constraint'">
- <xsl:value-of select="$KEY_PREFIX"/>
- </xsl:when>
- </xsl:choose>
- </xsl:variable>
-
- <!-- Get base URI. -->
- <xsl:variable name="baseURI">
- <xsl:choose>
- <xsl:when test="$baseFile!=''">
- <xsl:value-of select="$baseFile"/>
- </xsl:when>
- <xsl:when test="normalize-space($schemaLoc)!='this'">
- <xsl:call-template name="GetSchemaDocLocation">
- <xsl:with-param name="uri" select="$schemaLoc"/>
- </xsl:call-template>
- </xsl:when>
- </xsl:choose>
- </xsl:variable>
-
- <!-- Generate message. -->
- <xsl:variable name="title">
- <xsl:choose>
- <!-- Error message was provided. -->
- <xsl:when test="$errMsg!=''">
- <xsl:text>"</xsl:text><xsl:value-of select="$name"/><xsl:text>" </xsl:text>
- <xsl:value-of select="$compType"/><xsl:text> </xsl:text>
- <xsl:value-of select="$noun"/><xsl:text> </xsl:text>
- <xsl:value-of select="$errMsg"/>
- </xsl:when>
- <!-- There exists a link to the schema component's
- documentation. -->
- <xsl:otherwise>
- <xsl:text>Jump to "</xsl:text>
- <xsl:value-of select="$name"/>
- <xsl:text>" </xsl:text>
- <xsl:value-of select="$compType"/>
- <xsl:text> </xsl:text>
- <xsl:value-of select="$noun"/>
- <!-- External link -->
- <xsl:if test="normalize-space($baseURI)!=''">
- <xsl:text>(located in external schema documentation)</xsl:text>
- </xsl:if>
- </xsl:otherwise>
- </xsl:choose>
- <xsl:text>.</xsl:text>
- </xsl:variable>
-
- <!-- Generate href link -->
- <xsl:variable name="link">
- <xsl:choose>
- <!-- Error message was provided. -->
- <xsl:when test="$errMsg!=''">
- <xsl:text>javascript:void(0)</xsl:text>
- </xsl:when>
- <!-- There exists a link to the schema component's
- documentation. -->
- <xsl:otherwise>
- <!-- Base URI -->
- <xsl:value-of select="normalize-space($baseURI)"/>
- <!-- Anchor within URI -->
- <xsl:value-of select="concat('#',normalize-space($compPrefix),normalize-space($name))"/>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:variable>
-
- <a title="{$title}" href="{$link}">
- <!-- External link -->
- <xsl:if test="normalize-space($baseURI)!=''">
- <xsl:attribute name="class">externalLink</xsl:attribute>
- </xsl:if>
-
- <!-- Error message was provided. -->
- <xsl:if test="$errMsg!=''">
- <xsl:attribute name="onclick">
- <xsl:text>alert('</xsl:text>
- <xsl:value-of select="$title"/>
- <xsl:text>');</xsl:text>
- </xsl:attribute>
- </xsl:if>
-
- <xsl:value-of select="$name"/>
- </a>
- </xsl:template>
-
- <!--
- Prints out a reference to a schema component.
- This template will try to work out which schema that this
- component belongs to and print out the appropriate link.
- component.
- It will also print out the namespace prefix given
- in the reference.
- Param(s):
- ref (String) required
- Reference to schema component
- compType (String) required
- Type of schema component
- schemaLoc (String) optional
- Schema file containing this component reference;
- if in current schema, 'schemaLoc' is set to 'this'
- -->
- <xsl:template name="PrintCompRef">
- <xsl:param name="ref"/>
- <xsl:param name="compType"/>
- <xsl:param name="schemaLoc">this</xsl:param>
-
- <!-- Get correct terminology for statements -->
- <xsl:variable name="noun">
- <xsl:choose>
- <xsl:when test="$compType='element' or $compType='attribute'">
- <xsl:text>declaration</xsl:text>
- </xsl:when>
- <xsl:otherwise>
- <xsl:text>definition</xsl:text>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:variable>
-
- <!-- Get local name -->
- <xsl:variable name="refName">
- <xsl:call-template name="GetRefName">
- <xsl:with-param name="ref" select="$ref"/>
- </xsl:call-template>
- </xsl:variable>
-
- <!-- Get prefix -->
- <xsl:variable name="refPrefix">
- <xsl:call-template name="GetRefPrefix">
- <xsl:with-param name="ref" select="$ref"/>
- </xsl:call-template>
- </xsl:variable>
-
- <!-- Get prefix of this schema's target namespace -->
- <xsl:variable name="tnPrefix">
- <xsl:call-template name="GetThisPrefix"/>
- </xsl:variable>
-
- <!-- Get file location of the schema component that is
- being referenced. -->
- <xsl:variable name="compLoc">
- <xsl:call-template name="FindComponent">
- <xsl:with-param name="ref" select="$ref"/>
- <xsl:with-param name="compType" select="$compType"/>
- </xsl:call-template>
- </xsl:variable>
-
- <!-- Print prefix -->
- <xsl:call-template name="PrintNSPrefix">
- <xsl:with-param name="prefix" select="$refPrefix"/>
- <xsl:with-param name="schemaLoc" select="$schemaLoc"/>
- </xsl:call-template>
-
- <!-- Print local name -->
- <xsl:choose>
- <!-- Component from XML Schema's or XML's namespace -->
- <xsl:when test="normalize-space($compLoc)='xsd' or normalize-space($compLoc)='xml'">
- <xsl:value-of select="$refName"/>
- </xsl:when>
- <!-- Component found in this schema. -->
- <xsl:when test="normalize-space($compLoc)='this'">
- <xsl:call-template name="PrintCompName">
- <xsl:with-param name="name" select="$refName"/>
- <xsl:with-param name="compType" select="$compType"/>
- <xsl:with-param name="schemaLoc" select="$schemaLoc"/>
- </xsl:call-template>
- </xsl:when>
- <!-- Component not found. -->
- <xsl:when test="normalize-space($compLoc)='' or normalize-space($compLoc)='none'">
- <xsl:call-template name="PrintCompName">
- <xsl:with-param name="name" select="$refName"/>
- <xsl:with-param name="compType" select="$compType"/>
- <xsl:with-param name="errMsg">could not be found</xsl:with-param>
- </xsl:call-template>
- </xsl:when>
- <!-- Component found in an external schema. -->
- <xsl:otherwise>
- <!-- Get documentation file for included schema. -->
- <xsl:variable name="docFile">
- <xsl:call-template name="GetSchemaDocLocation">
- <xsl:with-param name="uri" select="$compLoc"/>
- </xsl:call-template>
- </xsl:variable>
-
- <xsl:call-template name="PrintCompName">
- <xsl:with-param name="baseFile" select="$docFile"/>
- <xsl:with-param name="name" select="$refName"/>
- <xsl:with-param name="compType" select="$compType"/>
- <xsl:with-param name="schemaLoc" select="$schemaLoc"/>
- </xsl:call-template>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:template>
-
-
- <!-- ******** Templates for Finding Components in Different
- Schema documents ******** -->
-
- <!-- Special key words: xml, xsd, this, none -->
- <xsl:template name="FindComponent">
- <xsl:param name="ref"/>
- <xsl:param name="compType"/>
-
- <!-- Get local name -->
- <xsl:variable name="refName">
- <xsl:call-template name="GetRefName">
- <xsl:with-param name="ref" select="$ref"/>
- </xsl:call-template>
- </xsl:variable>
-
- <!-- Get prefix -->
- <xsl:variable name="refPrefix">
- <xsl:call-template name="GetRefPrefix">
- <xsl:with-param name="ref" select="$ref"/>
- </xsl:call-template>
- </xsl:variable>
-
- <!-- Get prefix of this schema's target namespace -->
- <xsl:variable name="tnPrefix">
- <xsl:call-template name="GetThisPrefix"/>
- </xsl:variable>
-
- <!-- Get prefix of XML Schema -->
- <xsl:variable name="xsdPrefix">
- <xsl:call-template name="GetXSDPrefix"/>
- </xsl:variable>
-
- <xsl:choose>
- <!-- Schema component from XML Schema's namespace,
- unless this schema is for XML Schema -->
- <xsl:when test="$refPrefix=$xsdPrefix and $xsdPrefix!=$tnPrefix">
- <xsl:text>xsd</xsl:text>
- </xsl:when>
- <!-- Schema component from XML's namespace -->
- <xsl:when test="$refPrefix='xml'">
- <xsl:text>xml</xsl:text>
- </xsl:when>
- <!-- Schema component from current schema's namespace -->
- <xsl:when test="$refPrefix=$tnPrefix">
- <xsl:call-template name="FindComponentInSchema">
- <xsl:with-param name="name" select="$refName"/>
- <xsl:with-param name="compType" select="$compType"/>
- <xsl:with-param name="schema" select="/xsd:schema"/>
- <xsl:with-param name="schemaFileLoc">this</xsl:with-param>
- </xsl:call-template>
- </xsl:when>
- <!-- Schema component from imported namespace -->
- <xsl:when test="normalize-space(translate($searchImportedSchemas, 'TRUE', 'true'))='true'">
- <xsl:variable name="refNS" select="/xsd:schema/namespace::*[local-name(.)=normalize-space($refPrefix)]"/>
- <xsl:call-template name="FindComponentInImportedSchemas">
- <xsl:with-param name="name" select="$refName"/>
- <xsl:with-param name="compType" select="$compType"/>
- <xsl:with-param name="compNS" select="$refNS"/>
- <xsl:with-param name="schema" select="/xsd:schema"/>
- <xsl:with-param name="index">1</xsl:with-param>
- </xsl:call-template>
- </xsl:when>
- </xsl:choose>
- </xsl:template>
-
- <xsl:template name="FindComponentInSchema">
- <xsl:param name="name"/>
- <xsl:param name="compType"/>
- <xsl:param name="schema"/>
- <xsl:param name="schemaFileLoc"/>
- <xsl:param name="schemasSearched"/>
-
- <!-- Don't examine this schema if we've already
- searched it. Prevents infinite recursion.
- Also check if schema actually exists. -->
- <xsl:if test="$schema and not(contains($schemasSearched, concat('*', $schemaFileLoc, '+')))">
- <!-- Find out if the component is in this schema -->
- <xsl:variable name="thisResult">
- <xsl:call-template name="IsComponentInSchema">
- <xsl:with-param name="name" select="$name"/>
- <xsl:with-param name="compType" select="$compType"/>
- <xsl:with-param name="schema" select="$schema"/>
- </xsl:call-template>
- </xsl:variable>
-
- <xsl:choose>
- <!-- Component found -->
- <xsl:when test="normalize-space($thisResult)='true'">
- <xsl:value-of select="$schemaFileLoc"/>
- </xsl:when>
- <!-- Component not found -->
- <xsl:when test="normalize-space(translate($searchIncludedSchemas, 'TRUE', 'true'))='true'">
- <!-- Search included schemas -->
- <xsl:variable name="includeResult">
- <xsl:call-template name="FindComponentInIncludedSchemas">
- <xsl:with-param name="schema" select="$schema"/>
- <xsl:with-param name="name" select="$name"/>
- <xsl:with-param name="compType" select="$compType"/>
- <xsl:with-param name="index">1</xsl:with-param>
- <xsl:with-param name="schemasSearched" select="concat($schemasSearched, '*', $schemaFileLoc, '+')"/>
- </xsl:call-template>
- </xsl:variable>
-
- <xsl:choose>
- <xsl:when test="normalize-space($includeResult)!='' and normalize-space($includeResult)!='none'">
- <xsl:value-of select="$includeResult"/>
- </xsl:when>
- <xsl:otherwise>
- <!-- Search redefined schemas -->
- <xsl:call-template name="FindComponentInRedefinedSchemas">
- <xsl:with-param name="schema" select="$schema"/>
- <xsl:with-param name="name" select="$name"/>
- <xsl:with-param name="compType" select="$compType"/>
- <xsl:with-param name="index">1</xsl:with-param>
- <xsl:with-param name="schemasSearched" select="concat($schemasSearched, '*', $schemaFileLoc, '+')"/>
- </xsl:call-template>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:when>
- </xsl:choose>
- </xsl:if>
- </xsl:template>
-
- <xsl:template name="IsComponentInSchema">
- <xsl:param name="name"/>
- <xsl:param name="compType"/>
- <xsl:param name="schema"/>
-
- <xsl:choose>
- <!-- Schema not found. -->
- <xsl:when test="not($schema)">
- <xsl:text>false</xsl:text>
- </xsl:when>
- <!-- Search for attribute declaration. -->
- <xsl:when test="$compType='attribute' and $schema/xsd:attribute[@name=$name]">
- <xsl:text>true</xsl:text>
- </xsl:when>
- <!-- Search for attribute group definition. -->
- <xsl:when test="$compType='attribute group' and ($schema/xsd:attributeGroup[@name=$name] or $schema/xsd:redefine/xsd:attributeGroup[@name=$name])">
- <xsl:text>true</xsl:text>
- </xsl:when>
- <!-- Search for element declaration. -->
- <xsl:when test="$compType='element' and $schema/xsd:element[@name=$name]">
- <xsl:text>true</xsl:text>
- </xsl:when>
- <!-- Search for group definition. -->
- <xsl:when test="$compType='group' and ($schema/xsd:group[@name=$name] or $schema/xsd:redefine/xsd:group[@name=$name])">
- <xsl:text>true</xsl:text>
- </xsl:when>
- <!-- Search for complex type definition. -->
- <xsl:when test="($compType='type' or $compType='complex type') and ($schema/xsd:complexType[@name=$name] or $schema/xsd:redefine/xsd:complexType[@name=$name])">
- <xsl:text>true</xsl:text>
- </xsl:when>
- <!-- Search for simple type definition. -->
- <xsl:when test="($compType='type' or $compType='simple type') and ($schema/xsd:simpleType[@name=$name] or $schema/xsd:redefine/xsd:simpleType[@name=$name])">
- <xsl:text>true</xsl:text>
- </xsl:when>
- <!-- Search for uniqueness/key constraint definition. -->
- <xsl:when test="$compType='uniqueness/key constraint' and ($schema//xsd:element/xsd:key[@name=$name] or $schema//xsd:element/xsd:unique[@name=$name])">
- <xsl:text>true</xsl:text>
- </xsl:when>
- <!-- Component not found. -->
- <xsl:otherwise>
- <xsl:text>false</xsl:text>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:template>
-
- <xsl:template name="FindComponentInIncludedSchemas">
- <xsl:param name="schema"/>
- <xsl:param name="name"/>
- <xsl:param name="compType"/>
- <xsl:param name="schemasSearched"/>
- <xsl:param name="index">1</xsl:param>
-
- <xsl:if test="count($schema/xsd:include) &gt;= number($index)">
- <!-- Get the 'schemaLocation' attribute of the 'include'
- element in this schema at position, 'index'. -->
- <xsl:variable name="schemaLoc" select="$schema/xsd:include[position()=$index]/@schemaLocation"/>
-
- <xsl:variable name="thisResult">
- <!-- Search for the component in the current
- included schema. -->
- <xsl:call-template name="FindComponentInSchema">
- <xsl:with-param name="name" select="$name"/>
- <xsl:with-param name="compType" select="$compType"/>
- <xsl:with-param name="schema" select="document($schemaLoc)/xsd:schema"/>
- <xsl:with-param name="schemaFileLoc" select="$schemaLoc"/>
- <xsl:with-param name="schemasSearched" select="$schemasSearched"/>
- </xsl:call-template>
- </xsl:variable>
-
- <xsl:choose>
- <!-- Component was found, so return result. -->
- <xsl:when test="normalize-space($thisResult)!='' and normalize-space($thisResult)!='none'">
- <xsl:value-of select="$thisResult"/>
- </xsl:when>
- <!-- Component was not found, so keep on searching. -->
- <xsl:otherwise>
- <!-- Examine other included schemas in this schema -->
- <xsl:call-template name="FindComponentInIncludedSchemas">
- <xsl:with-param name="schema" select="$schema"/>
- <xsl:with-param name="name" select="$name"/>
- <xsl:with-param name="compType" select="$compType"/>
- <xsl:with-param name="index" select="number($index)+1"/>
- <xsl:with-param name="schemasSearched" select="concat($schemasSearched, '*', $schemaLoc, '+')"/>
- </xsl:call-template>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:if>
- </xsl:template>
-
- <xsl:template name="FindComponentInRedefinedSchemas">
- <xsl:param name="schema"/>
- <xsl:param name="name"/>
- <xsl:param name="compType"/>
- <xsl:param name="schemasSearched"/>
- <xsl:param name="index">1</xsl:param>
-
- <xsl:if test="count($schema/xsd:redefine) &gt;= number($index)">
- <!-- Get the 'schemaLocation' attribute of the 'redefine'
- element in this schema at position, 'index'. -->
- <xsl:variable name="schemaLoc" select="$schema/xsd:redefine[position()=$index]/@schemaLocation"/>
-
- <xsl:variable name="thisResult">
- <!-- Search for the component in the current
- redefined schema. -->
- <xsl:call-template name="FindComponentInSchema">
- <xsl:with-param name="name" select="$name"/>
- <xsl:with-param name="compType" select="$compType"/>
- <xsl:with-param name="schema" select="document($schemaLoc)/xsd:schema"/>
- <xsl:with-param name="schemaFileLoc" select="$schemaLoc"/>
- <xsl:with-param name="schemasSearched" select="$schemasSearched"/>
- </xsl:call-template>
- </xsl:variable>
-
- <xsl:choose>
- <!-- Component was found, so return result. -->
- <xsl:when test="normalize-space($thisResult)!='' and normalize-space($thisResult)!='none'">
- <xsl:value-of select="$thisResult"/>
- </xsl:when>
- <!-- Component was not found, so keep on searching. -->
- <xsl:otherwise>
- <!-- Examine other redefined schemas in this schema -->
- <xsl:call-template name="FindComponentInRedefinedSchemas">
- <xsl:with-param name="schema" select="$schema"/>
- <xsl:with-param name="name" select="$name"/>
- <xsl:with-param name="compType" select="$compType"/>
- <xsl:with-param name="index" select="number($index)+1"/>
- <xsl:with-param name="schemasSearched" select="concat($schemasSearched, '*', $schemaLoc, '+')"/>
- </xsl:call-template>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:if>
- </xsl:template>
-
- <xsl:template name="FindComponentInImportedSchemas">
- <xsl:param name="schema"/>
- <xsl:param name="name"/>
- <xsl:param name="compType"/>
- <xsl:param name="compNS"/>
- <xsl:param name="schemasSearched"/>
- <xsl:param name="index">1</xsl:param>
-
- <xsl:if test="count($schema/xsd:import) &gt;= number($index)">
- <!-- Get the 'namespace' attribute of the 'import'
- element in this schema at position, 'index'. -->
- <xsl:variable name="schemaNS" select="$schema/xsd:import[position()=$index]/@namespace"/>
- <!-- Get the 'schemaLocation' attribute. -->
- <xsl:variable name="schemaLoc" select="$schema/xsd:import[position()=$index]/@schemaLocation"/>
-
- <xsl:variable name="thisResult">
- <!-- Check that the imported schema has the matching
- namespace as the component that we're looking
- for. -->
- <xsl:if test="normalize-space($compNS)=normalize-space($schemaNS)">
- <!-- Search for the component in the current
- imported schema. -->
- <xsl:call-template name="FindComponentInSchema">
- <xsl:with-param name="name" select="$name"/>
- <xsl:with-param name="compType" select="$compType"/>
- <xsl:with-param name="schema" select="document($schemaLoc)/xsd:schema"/>
- <xsl:with-param name="schemaFileLoc" select="$schemaLoc"/>
- <xsl:with-param name="schemasSearched" select="$schemasSearched"/>
- </xsl:call-template>
- </xsl:if>
- </xsl:variable>
-
- <xsl:choose>
- <!-- Component was found, so return result. -->
- <xsl:when test="normalize-space($thisResult)!='' and normalize-space($thisResult)!='none'">
- <xsl:value-of select="$thisResult"/>
- </xsl:when>
- <!-- Component was not found, so keep on searching. -->
- <xsl:otherwise>
- <!-- Examine other included schemas in this schema -->
- <xsl:call-template name="FindComponentInImportedSchemas">
- <xsl:with-param name="schema" select="$schema"/>
- <xsl:with-param name="name" select="$name"/>
- <xsl:with-param name="compType" select="$compType"/>
- <xsl:with-param name="compNS" select="$compNS"/>
- <xsl:with-param name="index" select="number($index)+1"/>
- <xsl:with-param name="schemasSearched" select="concat($schemasSearched, '*', $schemaLoc, '+')"/>
- </xsl:call-template>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:if>
- </xsl:template>
-
-
- <!-- ******** General Utility Templates ******** -->
-
- <!--
- Creates a box that can be opened and closed, such
- that the contents can be hidden away until a button
- is pressed.
- Param(s):
- id (String) required
- Unique ID of the 'div' box
- caption (String) required
- Text describing the contents of the box;
- it will always be shown even when the box
- is closed
- contents (String) required
- Contents of box, which may appear and disappear
- with the press of a button.
- anchor (String) optional
- Anchor, e.g. <a name="...", for this box
- styleClass (String) optional
- Additional CSS class for the entire collapseable box
- isOpened (String) optional
- Set to true if initially opened, and
- false if initially closed
- -->
- <xsl:template name="CollapseableBox">
- <xsl:param name="id"/>
- <xsl:param name="caption"/>
- <xsl:param name="contents"/>
- <xsl:param name="anchor"/>
- <xsl:param name="styleClass"/>
- <xsl:param name="isOpened">false</xsl:param>
-
- <xsl:variable name="buttonID" select="concat($id, '_button')"/>
-
- <div class="{$styleClass} box">
- <div>
- <!-- Button to control the opening and closing of the 'div' box -->
- <xsl:if test="normalize-space(translate($useJavaScript,'TRUE','true'))='true'">
- <input type="button" id="{$buttonID}" class="control" onclick="switchState('{$id}'); return false;" style="display: none"/>
- <!--
- Button's 'display' property is set to 'none',
- so that button will only be displayed if
- box can be successfully opened and closed.
- -->
- </xsl:if>
- <!-- Box Title -->
- <xsl:text> </xsl:text>
- <span class="caption">
- <xsl:choose>
- <xsl:when test="$anchor != ''">
- <a name="{$anchor}">
- <xsl:value-of select="$caption"/>
- </a>
- </xsl:when>
- <xsl:otherwise>
- <xsl:value-of select="$caption"/>
- </xsl:otherwise>
- </xsl:choose>
- </span>
- </div>
-
- <!-- Box Contents -->
- <div id="{$id}" class="contents">
- <xsl:copy-of select="$contents"/>
- </div>
- <xsl:if test="normalize-space(translate($useJavaScript,'TRUE','true'))='true'">
- <xsl:call-template name="PrintJSCode">
- <xsl:with-param name="code">setState('<xsl:value-of select="$id"/>', <xsl:value-of select="$isOpened"/>);</xsl:with-param>
- </xsl:call-template>
- </xsl:if>
- </div>
- </xsl:template>
-
- <!--
- Returns the namespace of an attribute
- declaration or reference.
- Param(s):
- attribute (Node) required
- Attribute declaration or reference
- -->
- <xsl:template name="GetAttributeNS">
- <xsl:param name="attribute"/>
-
- <xsl:choose>
- <!-- Qualified local attribute declaration -->
- <xsl:when test="$attribute[@name] and (normalize-space(translate($attribute/@form, 'QUALIFED', 'qualifed'))='qualified' or normalize-space(translate(/xsd:schema/@attributeFormDefault, 'QUALIFED', 'qualifed'))='qualified')">
- <xsl:value-of select="/xsd:schema/@targetNamespace"/>
- </xsl:when>
- <!-- Reference to global attribute declaration -->
- <xsl:when test="$attribute[@ref]">
- <xsl:call-template name="GetRefNS">
- <xsl:with-param name="ref" select="$attribute/@ref"/>
- </xsl:call-template>
- </xsl:when>
- <!-- Otherwise, attribute has no namespace -->
- </xsl:choose>
- </xsl:template>
-
- <!--
- Returns the description that can be used in
- headers for a schema component.
- Param(s):
- component (Node) required
- Schema component
- -->
- <xsl:template name="GetComponentDescription">
- <xsl:param name="component"/>
-
- <xsl:choose>
- <xsl:when test="local-name($component)='all'">
- <xsl:text>All Model Group</xsl:text>
- </xsl:when>
- <xsl:when test="local-name($component)='attribute'">
- <xsl:text>Attribute</xsl:text>
- </xsl:when>
- <xsl:when test="local-name($component)='attributeGroup'">
- <xsl:text>Attribute Group</xsl:text>
- </xsl:when>
- <xsl:when test="local-name($component)='choice'">
- <xsl:text>Choice Model Group</xsl:text>
- </xsl:when>
- <xsl:when test="local-name($component)='complexType'">
- <xsl:text>Complex Type</xsl:text>
- </xsl:when>
- <xsl:when test="local-name($component)='element'">
- <xsl:text>Element</xsl:text>
- </xsl:when>
- <xsl:when test="local-name($component)='group'">
- <xsl:text>Model Group</xsl:text>
- </xsl:when>
- <xsl:when test="local-name($component)='notation'">
- <xsl:text>Notation</xsl:text>
- </xsl:when>
- <xsl:when test="local-name($component)='sequence'">
- <xsl:text>Sequence Model Group</xsl:text>
- </xsl:when>
- <xsl:when test="local-name($component)='simpleType'">
- <xsl:text>Simple Type</xsl:text>
- </xsl:when>
- <xsl:otherwise>
- <xsl:call-template name="HandleError">
- <xsl:with-param name="isTerminating">true</xsl:with-param>
- <xsl:with-param name="errorMsg">
-Unknown schema component, <xsl:value-of select="local-name($component)"/>.
- </xsl:with-param>
- </xsl:call-template>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:template>
-
- <!--
- Returns the unique identifier for a top-level schema
- component. Returns the string "schema" if the 'component'
- is the root schema element.
- Param(s):
- component (Node) required
- Schema component
- -->
- <xsl:template name="GetComponentID">
- <xsl:param name="component"/>
-
- <xsl:choose>
- <xsl:when test="local-name($component)='schema'">
- <xsl:text>schema</xsl:text>
- </xsl:when>
- <xsl:otherwise>
- <xsl:variable name="componentPrefix">
- <xsl:call-template name="GetComponentPrefix">
- <xsl:with-param name="component" select="$component"/>
- </xsl:call-template>
- </xsl:variable>
- <xsl:value-of select="concat($componentPrefix, $component/@name)"/>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:template>
-
- <!--
- Returns the prefix to add in front of a schema component
- name when generating anchor names.
- Param(s):
- component (Node) required
- Schema component
- -->
- <xsl:template name="GetComponentPrefix">
- <xsl:param name="component"/>
-
- <xsl:choose>
- <xsl:when test="local-name($component)='attribute'">
- <xsl:value-of select="$ATTR_PREFIX"/>
- </xsl:when>
- <xsl:when test="local-name($component)='attributeGroup'">
- <xsl:value-of select="$ATTR_GRP_PREFIX"/>
- </xsl:when>
- <xsl:when test="local-name($component)='complexType'">
- <xsl:value-of select="$CTYPE_PREFIX"/>
- </xsl:when>
- <xsl:when test="local-name($component)='element'">
- <xsl:value-of select="$ELEM_PREFIX"/>
- </xsl:when>
- <xsl:when test="local-name($component)='group'">
- <xsl:value-of select="$GRP_PREFIX"/>
- </xsl:when>
- <xsl:when test="local-name($component)='notation'">
- <xsl:value-of select="$NOTA_PREFIX"/>
- </xsl:when>
- <xsl:when test="local-name($component)='simpleType'">
- <xsl:value-of select="$STYPE_PREFIX"/>
- </xsl:when>
- <xsl:when test="local-name($component)='key' or local-name($component)='unique'">
- <xsl:value-of select="$KEY_PREFIX"/>
- </xsl:when>
- <xsl:otherwise>
- <xsl:call-template name="HandleError">
- <xsl:with-param name="isTerminating">true</xsl:with-param>
- <xsl:with-param name="errorMsg">
-Unknown schema component, <xsl:value-of select="local-name($component)"/>.
- </xsl:with-param>
- </xsl:call-template>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:template>
-
- <!--
- Returns a glossary term reference for the
- schema component type, if applicable.
- Param(s):
- component (Node) required
- Schema component
- -->
- <xsl:template name="GetComponentTermRef">
- <xsl:param name="component"/>
-
- <xsl:choose>
- <xsl:when test="local-name($component)='notation'">
- <xsl:text>Notation</xsl:text>
- </xsl:when>
- </xsl:choose>
- </xsl:template>
-
- <!--
- Returns the namespace prefix of an attribute.
- Param(s):
- attribute (Node) required
- Attribute declaration or reference
- -->
- <xsl:template name="GetAttributePrefix">
- <xsl:param name="attribute"/>
-
- <xsl:choose>
- <!-- Element reference -->
- <xsl:when test="$attribute/@ref">
- <xsl:call-template name="GetRefPrefix">
- <xsl:with-param name="ref" select="$attribute/@ref"/>
- </xsl:call-template>
- </xsl:when>
- <!-- Global element declaration -->
- <xsl:when test="local-name($attribute/..)='schema'">
- <xsl:call-template name="GetThisPrefix"/>
- </xsl:when>
- <!-- Local element declaration -->
- <xsl:otherwise>
- <xsl:if test="($attribute/@form and normalize-space($attribute/@form)='qualified') or (/xsd:schema/@attributeFormDefault and normalize-space(/xsd:schema/@attributeFormDefault)='qualified')">
- <xsl:call-template name="GetThisPrefix"/>
- </xsl:if>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:template>
-
- <!--
- Returns the namespace prefix of an element.
- Param(s):
- element (Node) required
- Element declaration or reference
- -->
- <xsl:template name="GetElementPrefix">
- <xsl:param name="element"/>
-
- <xsl:choose>
- <!-- Element reference -->
- <xsl:when test="$element/@ref">
- <xsl:call-template name="GetRefPrefix">
- <xsl:with-param name="ref" select="$element/@ref"/>
- </xsl:call-template>
- </xsl:when>
- <!-- Global element declaration -->
- <xsl:when test="local-name($element/..)='schema'">
- <xsl:call-template name="GetThisPrefix"/>
- </xsl:when>
- <!-- Local element declaration -->
- <xsl:otherwise>
- <xsl:if test="($element/@form and normalize-space($element/@form)='qualified') or (/xsd:schema/@elementFormDefault and normalize-space(/xsd:schema/@elementFormDefault)='qualified')">
- <xsl:call-template name="GetThisPrefix"/>
- </xsl:if>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:template>
-
- <!--
- Returns the local name of a reference.
- Param(s):
- ref (String) required
- Reference
- -->
- <xsl:template name="GetRefName">
- <xsl:param name="ref"/>
-
- <xsl:choose>
- <xsl:when test="contains($ref, ':')">
- <!-- Ref has namespace prefix -->
- <xsl:value-of select="substring-after($ref, ':')"/>
- </xsl:when>
- <xsl:otherwise>
- <!-- Ref has no namespace prefix -->
- <xsl:value-of select="$ref"/>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:template>
-
- <!--
- Returns the namespace prefix of a reference.
- Param(s):
- ref (String) required
- Reference
- -->
- <xsl:template name="GetRefPrefix">
- <xsl:param name="ref"/>
- <!-- Get namespace prefix -->
- <xsl:value-of select="substring-before($ref, ':')"/>
- </xsl:template>
-
- <!--
- Returns the namespace of a reference.
- Param(s):
- ref (String) required
- Reference
- -->
- <xsl:template name="GetRefNS">
- <xsl:param name="ref"/>
- <!-- Get namespace prefix -->
- <xsl:variable name="refPrefix" select="substring-before($ref, ':')"/>
- <!-- Get namespace -->
- <xsl:value-of select="/xsd:schema/namespace::*[local-name(.)=normalize-space($refPrefix)]"/>
- </xsl:template>
-
- <!--
- Returns the declared prefix of this schema's target namespace.
- -->
- <xsl:template name="GetThisPrefix">
- <xsl:if test="/xsd:schema/@targetNamespace">
- <xsl:value-of select="local-name(/xsd:schema/namespace::*[normalize-space(.)=normalize-space(/xsd:schema/@targetNamespace)])"/>
- </xsl:if>
- </xsl:template>
-
- <!--
- Returns the declared prefix of XML Schema namespace.
- -->
- <xsl:template name="GetXSDPrefix">
- <xsl:value-of select="local-name(/xsd:schema/namespace::*[normalize-space(.)=$XSD_NS])"/>
- </xsl:template>
-
- <!--
- Returns the schema documentation file location for a
- given URI for a schema, done by looking up the file
- specified in 'linksFile' variable.
- It'll throw a fatal error if a value for 'linksFile' was
- provided and the documentation file for 'uri' could not be
- found.
- Param(s):
- uri (String) required
- Location of schema file
- -->
- <xsl:template name="GetSchemaDocLocation">
- <xsl:param name="uri"/>
-
- <xsl:if test="$linksFile!=''">
- <xsl:variable name="schemaDocFile" select="document($linksFile)/ppp:links/ppp:schema[@file-location=$uri]/@docfile-location"/>
- <xsl:if test="$schemaDocFile=''">
- <xsl:call-template name="HandleError">
- <xsl:with-param name="isTerminating">true</xsl:with-param>
- <xsl:with-param name="errorMsg">
-Documentation file for the schema at, <xsl:value-of select="$uri"/>,
-was not specified in the links file, <xsl:value-of select="$linksFile"/>.
- </xsl:with-param>
- </xsl:call-template>
- </xsl:if>
- <xsl:value-of select="$schemaDocFile"/>
- </xsl:if>
- </xsl:template>
-
- <!--
- Prints out a boolean value.
- Param(s):
- boolean (String) required
- Boolean value
- -->
- <xsl:template name="PrintBoolean">
- <xsl:param name="boolean"/>
-
- <xsl:choose>
- <xsl:when test="normalize-space(translate($boolean,'TRUE', 'true'))='true' or normalize-space($boolean)='1'">
- <xsl:text>yes</xsl:text>
- </xsl:when>
- <xsl:otherwise>
- <xsl:text>no</xsl:text>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:template>
-
- <!--
- Prints out a link to the namespace of a prefix,
- and tacks on a colon in the end.
- Param(s):
- prefix (String) required
- Namespace prefix
- nolink (boolean) optional
- If true, doesn't provide a link to the
- namespace in the namespaces table.
- schemaLoc (String) optional
- Schema file containing this namespace prefix;
- if in current schema, 'schemaLoc' is set to 'this'
- -->
- <xsl:template name="PrintNSPrefix">
- <xsl:param name="prefix"/>
- <xsl:param name="nolink">false</xsl:param>
- <xsl:param name="schemaLoc">this</xsl:param>
-
- <xsl:if test="$prefix!='' and normalize-space(translate($printNSPrefixes,'TRUE','true'))='true'">
- <xsl:choose>
- <xsl:when test="$nolink='false'">
- <xsl:call-template name="PrintNamespaceRef">
- <xsl:with-param name="prefix" select="$prefix"/>
- <xsl:with-param name="schemaLoc" select="$schemaLoc"/>
- </xsl:call-template>
- </xsl:when>
- <xsl:otherwise>
- <xsl:value-of select="$prefix"/>
- </xsl:otherwise>
- </xsl:choose>
- <xsl:text>:</xsl:text>
- </xsl:if>
- </xsl:template>
-
- <!--
- Prints out the min/max occurrences of a schema component.
- Param(s):
- component (Node) optional
- Schema component
- minOccurs (String) optional
- Minimum occurrences
- maxOccurs (String) optional
- Maximum occurrences
- -->
- <xsl:template name="PrintOccurs">
- <xsl:param name="component"/>
- <xsl:param name="minOccurs"/>
- <xsl:param name="maxOccurs"/>
-
- <!-- Get min occurs -->
- <xsl:variable name="min">
- <xsl:choose>
- <xsl:when test="$component and local-name($component)='attribute'">
- <xsl:choose>
- <xsl:when test="normalize-space($component/@use)='required'">
- <xsl:text>1</xsl:text>
- </xsl:when>
- <xsl:otherwise>
- <xsl:text>0</xsl:text>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:when>
- <xsl:otherwise>
- <xsl:choose>
- <xsl:when test="$component and $component/@minOccurs">
- <xsl:value-of select="$component/@minOccurs"/>
- </xsl:when>
- <xsl:when test="$minOccurs != ''">
- <xsl:value-of select="$minOccurs"/>
- </xsl:when>
- <xsl:otherwise>
- <xsl:text>1</xsl:text>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:variable>
- <!-- Get max occurs -->
- <xsl:variable name="max">
- <xsl:choose>
- <xsl:when test="$component and local-name($component)='attribute'">
- <xsl:choose>
- <xsl:when test="normalize-space($component/@use)='prohibited'">
- <xsl:text>0</xsl:text>
- </xsl:when>
- <xsl:otherwise>
- <xsl:text>1</xsl:text>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:when>
- <xsl:otherwise>
- <xsl:choose>
- <xsl:when test="($component and normalize-space($component/@maxOccurs)='unbounded') or $maxOccurs='unbounded'">
- <xsl:text>*</xsl:text>
- </xsl:when>
- <xsl:when test="$component and $component/@maxOccurs">
- <xsl:value-of select="$component/@maxOccurs"/>
- </xsl:when>
- <xsl:when test="$maxOccurs != ''">
- <xsl:value-of select="$maxOccurs"/>
- </xsl:when>
- <xsl:otherwise>
- <xsl:text>1</xsl:text>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:variable>
-
- <span class="occurs">
- <xsl:choose>
- <xsl:when test="number($min)=1 and number($max)=1">
- <xsl:text>[1]</xsl:text>
- </xsl:when>
- <xsl:otherwise>
- <xsl:text>[</xsl:text>
- <xsl:value-of select="$min"/>
- <xsl:text>..</xsl:text>
- <xsl:value-of select="$max"/>
- <xsl:text>]</xsl:text>
- </xsl:otherwise>
- </xsl:choose>
- </span>
- </xsl:template>
-
- <!--
- Translates occurrence of '#all' in 'block' value
- of element declarations.
- Param(s):
- EBV (String) required
- Value
- -->
- <xsl:template name="PrintBlockSet">
- <xsl:param name="EBV"/>
-
- <xsl:choose>
- <xsl:when test="normalize-space($EBV)='#all'">
- <xsl:text>restriction, extension, substitution</xsl:text>
- </xsl:when>
- <xsl:otherwise>
- <xsl:value-of select="$EBV"/>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:template>
-
- <!--
- Translates occurrence of '#all' in 'final' value
- of element declarations, and 'block' and 'final' values
- in complex type definitions.
- Param(s):
- EBV (String) required
- Value
- -->
- <xsl:template name="PrintDerivationSet">
- <xsl:param name="EBV"/>
-
- <xsl:choose>
- <xsl:when test="normalize-space($EBV)='#all'">
- <xsl:text>restriction, extension</xsl:text>
- </xsl:when>
- <xsl:otherwise>
- <xsl:value-of select="$EBV"/>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:template>
-
- <!--
- Translates occurrence of '#all' in 'final' value
- of simple type definitions.
- Param(s):
- EBV (String) required
- Value
- -->
- <xsl:template name="PrintSimpleDerivationSet">
- <xsl:param name="EBV"/>
-
- <xsl:choose>
- <xsl:when test="normalize-space($EBV)='#all'">
- <xsl:text>restriction, list, union</xsl:text>
- </xsl:when>
- <xsl:when test="normalize-space($EBV)!=''">
- <xsl:value-of select="$EBV"/>
- </xsl:when>
- </xsl:choose>
- </xsl:template>
-
- <!--
- Print out a URI. If it starts with 'http', a link is provided.
- Param(s):
- uri (String) required
- URI to be printed
- -->
- <xsl:template name="PrintURI">
- <xsl:param name="uri"/>
-
- <xsl:choose>
- <xsl:when test="starts-with($uri, 'http')">
- <a title="{$uri}" href="{$uri}">
- <xsl:value-of select="$uri"/>
- </a>
- </xsl:when>
- <xsl:otherwise>
- <xsl:value-of select="$uri"/>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:template>
-
- <!--
- Print out a link to the documentation of schema document.
- For this happen, the 'linksFile' variable must be provided,
- it must point to an actual file, and in that file, there
- must be a mapping from the schema file location to the
- schema documentation file location.
- Param(s):
- uri (String) required
- Location of schema file
- -->
- <xsl:template name="PrintSchemaLink">
- <xsl:param name="uri"/>
-
- <xsl:variable name="docFileLoc">
- <xsl:call-template name="GetSchemaDocLocation">
- <xsl:with-param name="uri" select="$uri"/>
- </xsl:call-template>
- </xsl:variable>
-
- <xsl:choose>
- <xsl:when test="$docFileLoc!=''">
- <a title="Jump to schema documentation for '{$uri}'." href="{$docFileLoc}">
- <xsl:value-of select="$uri"/>
- </a>
- </xsl:when>
- <xsl:otherwise>
- <xsl:value-of select="$uri"/>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:template>
-
- <!--
- Tokenises a whitespace-separated list of values, and
- displays them appropriately.
- Param(s):
- value (String) required
- Whitespace-separated list
- compType (String) optional
- Specify schema component type if values in list are
- schema components, so appropriate links can be provided.
- isInList (boolean) optional
- If true, place each value within 'li' tags.
- Assumes that this template is called within an HTML
- list element.
- separator (String) optional
- Character(s) to use to separate resulting values in list.
- Only used if 'isInList' is false.
- If none is provided, uses a space character, ' '.
- isFirst (boolean) optional
- If false, it's a recursive call from 'PrintWhitespaceList'.
- schemaLoc (String) optional
- Schema file containing this all model group;
- if in current schema, 'schemaLoc' is set to 'this'
- -->
- <xsl:template name="PrintWhitespaceList">
- <xsl:param name="value"/>
- <xsl:param name="compType"/>
- <xsl:param name="isInList">false</xsl:param>
- <xsl:param name="separator"/>
- <xsl:param name="isFirst">true</xsl:param>
- <xsl:param name="schemaLoc">this</xsl:param>
-
- <xsl:variable name="token" select="normalize-space(substring-before($value, ' '))"/>
- <xsl:choose>
- <xsl:when test="$token!=''">
- <!-- Whitespace found in value -->
- <!-- Print out token -->
- <xsl:call-template name="PrintWhitespaceListToken">
- <xsl:with-param name="token" select="$token"/>
- <xsl:with-param name="compType" select="$compType"/>
- <xsl:with-param name="isInList" select="$isInList"/>
- <xsl:with-param name="separator" select="$separator"/>
- <xsl:with-param name="isFirst" select="$isFirst"/>
- <xsl:with-param name="schemaLoc" select="$schemaLoc"/>
- </xsl:call-template>
- <!-- Continue parsing -->
- <xsl:variable name="rest" select="normalize-space(substring-after($value, $token))"/>
- <xsl:if test="$rest!=''">
- <xsl:call-template name="PrintWhitespaceList">
- <xsl:with-param name="value" select="$rest"/>
- <xsl:with-param name="compType" select="$compType"/>
- <xsl:with-param name="isInList" select="$isInList"/>
- <xsl:with-param name="separator" select="$separator"/>
- <xsl:with-param name="isFirst">false</xsl:with-param>
- <xsl:with-param name="schemaLoc" select="$schemaLoc"/>
- </xsl:call-template>
- </xsl:if>
- </xsl:when>
- <xsl:otherwise>
- <!-- No more whitespaces -->
- <!-- Print out one last token -->
- <xsl:if test="normalize-space($value)!=''">
- <xsl:call-template name="PrintWhitespaceListToken">
- <xsl:with-param name="token" select="$value"/>
- <xsl:with-param name="compType" select="$compType"/>
- <xsl:with-param name="isInList" select="$isInList"/>
- <xsl:with-param name="separator" select="$separator"/>
- <xsl:with-param name="isFirst" select="$isFirst"/>
- <xsl:with-param name="schemaLoc" select="$schemaLoc"/>
- </xsl:call-template>
- </xsl:if>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:template>
-
- <!--
- Helper template for 'PrintWhitespaceList' template,
- which prints out one token in the list.
- Param(s):
- token (String) required
- Token to be printed
- compType (String) optional
- Schema component type of token, if applicable.
- isInList (boolean) optional
- If true, place token within 'li' tags.
- separator (String) optional
- Character(s) use to separate one token from another.
- Only used if 'isInList' is false.
- If none is provided, uses a space character, ' '.
- isFirst (boolean) optional
- If true, token is the first value in the list.
- schemaLoc (String) optional
- Schema file containing this all model group;
- if in current schema, 'schemaLoc' is set to 'this'
- -->
- <xsl:template name="PrintWhitespaceListToken">
- <xsl:param name="token"/>
- <xsl:param name="compType"/>
- <xsl:param name="isInList">false</xsl:param>
- <xsl:param name="separator"/>
- <xsl:param name="isFirst">true</xsl:param>
- <xsl:param name="schemaLoc">this</xsl:param>
-
- <xsl:variable name="displayValue">
- <xsl:choose>
- <xsl:when test="$compType!=''">
- <xsl:call-template name="PrintCompRef">
- <xsl:with-param name="ref" select="normalize-space($token)"/>
- <xsl:with-param name="compType" select="$compType"/>
- <xsl:with-param name="schemaLoc" select="$schemaLoc"/>
- </xsl:call-template>
- </xsl:when>
- <xsl:otherwise>
- <xsl:value-of select="normalize-space($token)"/>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:variable>
-
- <xsl:choose>
- <xsl:when test="$isInList!='false'">
- <li>
- <xsl:copy-of select="$displayValue"/>
- </li>
- </xsl:when>
- <xsl:when test="$isFirst!='true'">
- <xsl:choose>
- <xsl:when test="$separator!=''">
- <xsl:value-of select="$separator"/>
- </xsl:when>
- <xsl:otherwise>
- <xsl:text> </xsl:text>
- </xsl:otherwise>
- </xsl:choose>
- <xsl:copy-of select="$displayValue"/>
- </xsl:when>
- <xsl:otherwise>
- <xsl:copy-of select="$displayValue"/>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:template>
-
- <!--
- Print out a wildcard.
- Param(s):
- componentType (attribute|element) required
- XML Schema component type
- namespaces (String) required
- Namespace attribute of wildcard
- processContents (String) required
- Process contents attribute of wildcard
- namespaces (String) required
- Namespace attribute of wildcard
- -->
- <xsl:template name="PrintWildcard">
- <xsl:param name="componentType">element</xsl:param>
- <xsl:param name="namespace"/>
- <xsl:param name="processContents"/>
- <xsl:param name="minOccurs"/>
- <xsl:param name="maxOccurs"/>
-
- <xsl:text>Allow any </xsl:text>
- <xsl:value-of select="$componentType"/>
- <xsl:text>s from </xsl:text>
-
- <xsl:choose>
- <!-- ##any -->
- <xsl:when test="not($namespace) or normalize-space($namespace)='##any'">
- <xsl:text>any namespace</xsl:text>
- </xsl:when>
- <!-- ##other -->
- <xsl:when test="normalize-space($namespace)='##other'">
- <xsl:text>a namespace other than this schema's namespace</xsl:text>
- </xsl:when>
- <!-- ##targetNamespace, ##local, specific namespaces -->
- <xsl:otherwise>
- <!-- ##targetNamespace -->
- <xsl:variable name="hasTargetNS">
- <xsl:if test="contains($namespace, '##targetNamespace')">
- <xsl:text>true</xsl:text>
- </xsl:if>
- </xsl:variable>
- <!-- ##local -->
- <xsl:variable name="hasLocalNS">
- <xsl:if test="contains($namespace, '##local')">
- <xsl:text>true</xsl:text>
- </xsl:if>
- </xsl:variable>
- <!-- Specific namespaces -->
- <!-- Remove '##targetNamespace' string if any-->
- <xsl:variable name="temp">
- <xsl:choose>
- <xsl:when test="$hasTargetNS='true'">
- <xsl:value-of select="concat(substring-before($namespace, '##targetNamespace'), substring-after($namespace, '##targetNamespace'))"/>
- </xsl:when>
- <xsl:otherwise>
- <xsl:value-of select="$namespace"/>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:variable>
- <!-- Remove '##local' string if any -->
- <xsl:variable name="specificNS">
- <xsl:choose>
- <xsl:when test="$hasLocalNS='true'">
- <xsl:value-of select="concat(substring-before($temp, '##local'), substring-after($temp, '##local'))"/>
- </xsl:when>
- <xsl:otherwise>
- <xsl:value-of select="$temp"/>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:variable>
- <xsl:variable name="hasSpecificNS">
- <xsl:if test="normalize-space($specificNS)!=''">
- <xsl:text>true</xsl:text>
- </xsl:if>
- </xsl:variable>
-
- <xsl:if test="$hasLocalNS='true'">
- <xsl:text>no namespace</xsl:text>
- </xsl:if>
-
- <xsl:if test="$hasTargetNS='true'">
- <xsl:choose>
- <xsl:when test="$hasLocalNS='true' and $hasSpecificNS!='true'">
- <xsl:text> and </xsl:text>
- </xsl:when>
- <xsl:when test="$hasLocalNS='true'">
- <xsl:text>, </xsl:text>
- </xsl:when>
- </xsl:choose>
- <xsl:text>this schema's namespace</xsl:text>
- </xsl:if>
-
- <xsl:if test="$hasSpecificNS='true'">
- <xsl:choose>
- <xsl:when test="$hasTargetNS='true' and $hasLocalNS='true'">
- <xsl:text>, and </xsl:text>
- </xsl:when>
- <xsl:when test="$hasTargetNS='true' or $hasLocalNS='true'">
- <xsl:text> and </xsl:text>
- </xsl:when>
- </xsl:choose>
- <xsl:text>the following namespace(s): </xsl:text>
- <xsl:call-template name="PrintWhitespaceList">
- <xsl:with-param name="value" select="normalize-space($specificNS)"/>
- <xsl:with-param name="separator">,</xsl:with-param>
- </xsl:call-template>
- </xsl:if>
- </xsl:otherwise>
- </xsl:choose>
- <!-- Process contents -->
- <xsl:text> (</xsl:text>
- <xsl:choose>
- <xsl:when test="$processContents">
- <xsl:value-of select="normalize-space($processContents)"/>
- </xsl:when>
- <xsl:otherwise>
- <xsl:text>strict</xsl:text>
- </xsl:otherwise>
- </xsl:choose>
- <xsl:text> validation)</xsl:text>
- <xsl:text>.</xsl:text>
-
- <!-- Print min/max occurs -->
- <xsl:if test="$componentType='element'">
- <xsl:text> </xsl:text>
- <xsl:call-template name="PrintOccurs">
- <xsl:with-param name="minOccurs" select="$minOccurs"/>
- <xsl:with-param name="maxOccurs" select="$maxOccurs"/>
- </xsl:call-template>
- </xsl:if>
- </xsl:template>
-
- <!--
- Print out the pattern property for derivations by
- restriction on simple content.
- Param(s):
- simpleRestrict (Node) required
- 'restriction' element
- -->
- <xsl:template name="PrintPatternFacet">
- <xsl:param name="simpleRestrict"/>
-
- <xsl:if test="$simpleRestrict/xsd:pattern">
- <em>pattern</em>
- <xsl:text> = </xsl:text>
- <xsl:value-of select="$simpleRestrict/xsd:pattern/@value"/>
- </xsl:if>
- </xsl:template>
-
- <!--
- Print out the total digits property for derivations by
- restriction on simple content.
- Param(s):
- simpleRestrict (Node) required
- 'restriction' element
- -->
- <xsl:template name="PrintTotalDigitsFacet">
- <xsl:param name="simpleRestrict"/>
-
- <xsl:if test="$simpleRestrict/xsd:totalDigits">
- <em>total no. of digits</em>
- <xsl:text> = </xsl:text>
- <xsl:value-of select="$simpleRestrict/xsd:totalDigits/@value"/>
- </xsl:if>
- </xsl:template>
-
- <!--
- Print out the fraction digits property for derivations by
- restriction on simple content.
- Param(s):
- simpleRestrict (Node) required
- 'restriction' element
- -->
- <xsl:template name="PrintFractionDigitsFacet">
- <xsl:param name="simpleRestrict"/>
-
- <xsl:if test="$simpleRestrict/xsd:fractionDigits">
- <em>
- <xsl:text>no. of fraction digits</xsl:text>
- </em>
- <xsl:text> = </xsl:text>
- <xsl:value-of select="$simpleRestrict/xsd:fractionDigits/@value"/>
- </xsl:if>
- </xsl:template>
-
- <!--
- Print out the enumeration list for derivations by
- restriction on simple content.
- Param(s):
- simpleRestrict (Node) required
- 'restriction' element
- -->
- <xsl:template name="PrintEnumFacets">
- <xsl:param name="simpleRestrict"/>
-
- <xsl:if test="$simpleRestrict/xsd:enumeration">
- <em>value</em>
- <xsl:text> comes from list: {</xsl:text>
-
- <xsl:for-each select="$simpleRestrict/xsd:enumeration">
- <xsl:if test="position()!=1">
- <xsl:text>|</xsl:text>
- </xsl:if>
- <xsl:text>'</xsl:text>
- <xsl:value-of select="@value"/>
- <xsl:text>'</xsl:text>
- </xsl:for-each>
-
- <xsl:text>}</xsl:text>
- </xsl:if>
- </xsl:template>
-
- <!--
- Print out the length property for derivations by
- restriction on simple content.
- Param(s):
- simpleRestrict (Node) required
- 'restriction' element
- -->
- <xsl:template name="PrintLengthFacets">
- <xsl:param name="simpleRestrict"/>
-
- <xsl:choose>
- <xsl:when test="$simpleRestrict/xsd:length">
- <em>
- <xsl:text>length</xsl:text>
- </em>
- <xsl:text> = </xsl:text>
- <xsl:value-of select="$simpleRestrict/xsd:length/@value"/>
- </xsl:when>
- <xsl:when test="$simpleRestrict/xsd:minLength">
- <em>
- <xsl:text>length</xsl:text>
- </em>
- <xsl:text> >= </xsl:text>
- <xsl:value-of select="$simpleRestrict/xsd:minLength/@value"/>
- </xsl:when>
- <xsl:when test="$simpleRestrict/xsd:maxLength">
- <em>
- <xsl:text>length</xsl:text>
- </em>
- <xsl:text> &lt;= </xsl:text>
- <xsl:value-of select="$simpleRestrict/xsd:maxLength/@value"/>
- </xsl:when>
- </xsl:choose>
- </xsl:template>
-
- <!--
- Print out the whitespace property for derivations by
- restriction on simple content.
- Param(s):
- simpleRestrict (Node) required
- 'restriction' element
- -->
- <xsl:template name="PrintWhitespaceFacet">
- <xsl:param name="simpleRestrict"/>
-
- <xsl:variable name="facetValue" select="normalize-space(translate($simpleRestrict/xsd:whiteSpace/@value, 'ACELOPRSV', 'aceloprsv'))"/>
-
- <xsl:choose>
- <xsl:when test="$facetValue='preserve'">
- <em>Whitespace policy: </em>
- <xsl:call-template name="PrintGlossaryTermRef">
- <xsl:with-param name="code">PreserveWS</xsl:with-param>
- <xsl:with-param name="term">preserve</xsl:with-param>
- </xsl:call-template>
- </xsl:when>
- <xsl:when test="$facetValue='replace'">
- <em>Whitespace policy: </em>
- <xsl:call-template name="PrintGlossaryTermRef">
- <xsl:with-param name="code">ReplaceWS</xsl:with-param>
- <xsl:with-param name="term">replace</xsl:with-param>
- </xsl:call-template>
- </xsl:when>
- <xsl:when test="$facetValue='collapse'">
- <em>Whitespace policy: </em>
- <xsl:call-template name="PrintGlossaryTermRef">
- <xsl:with-param name="code">CollapseWS</xsl:with-param>
- <xsl:with-param name="term">collapse</xsl:with-param>
- </xsl:call-template>
- </xsl:when>
- </xsl:choose>
- </xsl:template>
-
- <!--
- Print out the value ranges for derivations by
- restriction on simple content.
- Param(s):
- simpleRestrict (Node) required
- 'restriction' element
- -->
- <xsl:template name="PrintRangeFacets">
- <xsl:param name="simpleRestrict"/>
-
- <xsl:choose>
- <xsl:when test="($simpleRestrict/xsd:minInclusive or $simpleRestrict/xsd:minExclusive) and ($simpleRestrict/xsd:maxInclusive or $simpleRestrict/xsd:maxExclusive)">
- <xsl:choose>
- <xsl:when test="$simpleRestrict/xsd:minInclusive">
- <xsl:value-of select="$simpleRestrict/xsd:minInclusive/@value"/>
- <xsl:text> &lt;= </xsl:text>
- </xsl:when>
- <xsl:otherwise>
- <xsl:value-of select="$simpleRestrict/xsd:minExclusive/@value"/>
- <xsl:text> &lt; </xsl:text>
- </xsl:otherwise>
- </xsl:choose>
- <em>
- <xsl:text>value</xsl:text>
- </em>
- <xsl:choose>
- <xsl:when test="$simpleRestrict/xsd:maxInclusive">
- <xsl:text> &lt;= </xsl:text>
- <xsl:value-of select="$simpleRestrict/xsd:maxInclusive/@value"/>
- </xsl:when>
- <xsl:otherwise>
- <xsl:text> &lt; </xsl:text>
- <xsl:value-of select="$simpleRestrict/xsd:maxExclusive/@value"/>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:when>
- <xsl:when test="$simpleRestrict/xsd:minInclusive">
- <em>
- <xsl:text>value</xsl:text>
- </em>
- <xsl:text> >= </xsl:text>
- <xsl:value-of select="$simpleRestrict/xsd:minInclusive/@value"/>
- </xsl:when>
- <xsl:when test="$simpleRestrict/xsd:minExclusive">
- <em>
- <xsl:text>value</xsl:text>
- </em>
- <xsl:text> > </xsl:text>
- <xsl:value-of select="$simpleRestrict/xsd:minExclusive/@value"/>
- </xsl:when>
- <xsl:when test="$simpleRestrict/xsd:maxInclusive">
- <em>
- <xsl:text>value</xsl:text>
- </em>
- <xsl:text> &lt;= </xsl:text>
- <xsl:value-of select="$simpleRestrict/xsd:maxInclusive/@value"/>
- </xsl:when>
- <xsl:when test="$simpleRestrict/xsd:maxExclusive">
- <em>
- <xsl:text>value</xsl:text>
- </em>
- <xsl:text> &lt; </xsl:text>
- <xsl:value-of select="$simpleRestrict/xsd:maxExclusive/@value"/>
- </xsl:when>
- </xsl:choose>
- </xsl:template>
-
- <!--
- Prints out JavaScript code.
- NOTE: Javascript code is placed within comments to make it
- work with current browsers. In strict XHTML, JavaScript code
- should be placed within CDATA sections. However, most
- browsers generate a syntax error if the page contains
- CDATA sections. Placing Javascript code within comments
- means that the code cannot contain two dashes.
- Param(s):
- code (Result Tree Fragment) required
- Javascript code
- -->
- <xsl:template name="PrintJSCode">
- <xsl:param name="code"/>
-
- <script type="text/javascript">
- <!-- If browsers start supporting CDATA sections,
- uncomment the following piece of code. -->
- <!-- <xsl:text disable-output-escaping="yes">
-&lt;![CDATA[
-</xsl:text> -->
- <!-- If browsers start supporting CDATA sections,
- remove the following piece of code. -->
- <xsl:text disable-output-escaping="yes">
-&lt;!--
-</xsl:text>
-
- <xsl:value-of select="$code" disable-output-escaping="yes"/>
- <!-- If browsers start supporting CDATA sections,
- remove the following piece of code. -->
- <xsl:text disable-output-escaping="yes">
-// --&gt;
-</xsl:text>
- <!-- If browsers start supporting CDATA sections,
- uncomment the following piece of code. -->
- <!-- <xsl:text disable-output-escaping="yes">
-]]&gt;
-</xsl:text> -->
- </script>
- </xsl:template>
-
- <!--
- Translates occurrences of a string
- in a piece of text with another string.
- Param(s):
- value (String) required
- Text to translate
- strToReplace (String) required
- String to be replaced
- replacementStr (String) required
- Replacement text
- -->
- <xsl:template name="TranslateStr">
- <xsl:param name="value"/>
- <xsl:param name="strToReplace"/>
- <xsl:param name="replacementStr"/>
-
- <xsl:if test="$value != ''">
- <xsl:variable name="beforeText" select="substring-before($value, $strToReplace)"/>
- <xsl:choose>
- <xsl:when test="$beforeText != ''">
- <xsl:value-of select="$beforeText"/>
- <xsl:value-of select="$replacementStr"/>
- <xsl:call-template name="TranslateStr">
- <xsl:with-param name="value" select="substring-after($value, $strToReplace)"/>
- <xsl:with-param name="strToReplace" select="$strToReplace"/>
- <xsl:with-param name="replacementStr" select="$replacementStr"/>
- </xsl:call-template>
- </xsl:when>
- <xsl:otherwise>
- <xsl:value-of select="$value"/>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:if>
- </xsl:template>
-
- <xsl:template name="HandleError">
- <xsl:param name="errorMsg"/>
- <xsl:param name="isTerminating">false</xsl:param>
-
- <xsl:choose>
- <xsl:when test="$isTerminating='true'">
- <xsl:message terminate="yes">
- <xsl:text>XS3P ERROR: </xsl:text>
- <xsl:value-of select="$errorMsg"/>
- </xsl:message>
- </xsl:when>
- <xsl:otherwise>
- <span style="font-weight: bold; color: red">
- <xsl:text>ERROR: </xsl:text>
- <xsl:value-of select="$errorMsg"/>
- </span>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:template>
-</xsl:stylesheet> \ No newline at end of file
diff --git a/setup.py b/setup.py
index e486afb5f..3fb42e585 100755
--- a/setup.py
+++ b/setup.py
@@ -1,11 +1,7 @@
#!/usr/bin/env python
from setuptools import setup
-from setuptools import Command
-from fnmatch import fnmatch
from glob import glob
-import os
-import os.path
import sys
vfile = 'src/lib/Bcfg2/version.py'
@@ -22,114 +18,11 @@ version = sys.version_info[:2]
if version < (2, 6):
need_m2crypto = True
-
-class BuildDTDDoc (Command):
- """Build DTD documentation"""
-
- description = "Build DTD documentation"
-
- # List of option tuples: long name, short name (None if no short
- # name), and help string.
- user_options = [
- ('links-file=', 'l', 'Links file'),
- ('source-dir=', 's', 'Source directory'),
- ('build-dir=', None, 'Build directory'),
- ('xslt=', None, 'XSLT file'),
- ]
-
- def initialize_options(self):
- """Set default values for all the options that this command
- supports."""
-
- self.build_links = False
- self.links_file = None
- self.source_dir = None
- self.build_dir = None
- self.xslt = None
-
- def finalize_options(self):
- """Set final values for all the options that this command
- supports."""
- if self.source_dir is None:
- if os.path.isdir('schemas'):
- for root, dirnames, filenames in os.walk('schemas'):
- for filename in filenames:
- if fnmatch(filename, '*.xsd'):
- self.source_dir = root
- self.announce('Using source directory %s' % root)
- break
- self.ensure_dirname('source_dir')
- self.source_dir = os.path.abspath(self.source_dir)
-
- if self.build_dir is None:
- build = self.get_finalized_command('build')
- self.build_dir = os.path.join(build.build_base, 'dtd')
- self.mkpath(self.build_dir)
-
- if self.links_file is None:
- self.links_file = "links.xml"
- if os.path.isfile(os.path.join(self.source_dir, "links.xml")):
- self.announce("Using linksFile links.xml")
- else:
- self.build_links = True
-
- if self.xslt is None:
- xsl_files = glob(os.path.join(self.source_dir, '*.xsl'))
- if xsl_files:
- self.xslt = xsl_files[0]
- self.announce("Using XSLT file %s" % self.xslt)
- self.ensure_filename('xslt')
-
- def run(self):
- """Perform XSLT transforms, writing output to self.build_dir"""
-
- xslt = lxml.etree.parse(self.xslt).getroot()
- transform = lxml.etree.XSLT(xslt)
-
- if self.build_links:
- self.announce("Building linksFile %s" % self.links_file)
- links_xml = \
- lxml.etree.Element('links',
- attrib={'xmlns': "http://titanium.dstc.edu.au/xml/xs3p"})
- for filename in glob(os.path.join(self.source_dir, '*.xsd')):
- attrib = {'file-location': os.path.basename(filename),
- 'docfile-location': os.path.splitext(os.path.basename(filename))[0] + ".html"}
- links_xml.append(lxml.etree.Element('schema', attrib=attrib))
- open(os.path.join(self.source_dir, self.links_file),
- "w").write(lxml.etree.tostring(links_xml))
-
- # build parameter dict
- params = {'printLegend': "'false'",
- 'printGlossary': "'false'",
- 'sortByComponent': "'false'"}
- if self.links_file is not None:
- params['linksFile'] = "'%s'" % self.links_file
- params['searchIncludedSchemas'] = "'true'"
-
- for filename in glob(os.path.join(self.source_dir, '*.xsd')):
- outfile = \
- os.path.join(self.build_dir,
- os.path.splitext(os.path.basename(filename))[0] +
- ".html")
- self.announce("Transforming %s to %s" % (filename, outfile))
- xml = lxml.etree.parse(filename).getroot()
- xhtml = str(transform(xml, **params))
- open(outfile, 'w').write(xhtml)
-
-cmdclass = {}
-
-try:
- import lxml.etree
- cmdclass['build_dtddoc'] = BuildDTDDoc
-except ImportError:
- pass
-
inst_reqs = ['lxml']
if need_m2crypto:
inst_reqs.append('M2Crypto')
-setup(cmdclass=cmdclass,
- name="Bcfg2",
+setup(name="Bcfg2",
version="1.3.0pre2",
description="Bcfg2 Server",
author="Narayan Desai",
diff --git a/src/lib/Bcfg2/Client/Tools/POSIX/Hardlink.py b/src/lib/Bcfg2/Client/Tools/POSIX/Hardlink.py
index 64a0b1e15..896ca5f49 100644
--- a/src/lib/Bcfg2/Client/Tools/POSIX/Hardlink.py
+++ b/src/lib/Bcfg2/Client/Tools/POSIX/Hardlink.py
@@ -12,4 +12,5 @@ class POSIXHardlink(POSIXLinkTool):
return os.path.samefile(entry.get('name'), entry.get('to'))
def _link(self, entry):
+ ## TODO: set permissions
return os.link(entry.get('to'), entry.get('name'))
diff --git a/src/lib/Bcfg2/Client/Tools/VCS.py b/src/lib/Bcfg2/Client/Tools/VCS.py
index 6c4c77426..fa3d22e1d 100644
--- a/src/lib/Bcfg2/Client/Tools/VCS.py
+++ b/src/lib/Bcfg2/Client/Tools/VCS.py
@@ -28,7 +28,6 @@ import Bcfg2.Client.Tools
class VCS(Bcfg2.Client.Tools.Tool):
"""VCS support."""
- name = 'VCS'
__handles__ = [('Path', 'vcs')]
__req__ = {'Path': ['name',
'type',
@@ -36,10 +35,6 @@ class VCS(Bcfg2.Client.Tools.Tool):
'sourceurl',
'revision']}
- def __init__(self, logger, cfg, setup):
- Bcfg2.Client.Tools.Tool.__init__(self, logger, cfg, setup)
- self.cfg = cfg
-
def git_write_index(self, entry):
"""Write the git index"""
pass
@@ -72,7 +67,7 @@ class VCS(Bcfg2.Client.Tools.Tool):
else:
os.remove(destname)
except OSError:
- self.logger.info('Failed to remove %s' % \
+ self.logger.info('Failed to remove %s' %
destname)
return False
diff --git a/src/lib/Bcfg2/Server/Plugins/Metadata.py b/src/lib/Bcfg2/Server/Plugins/Metadata.py
index 0ab72f2c5..5519d42b5 100644
--- a/src/lib/Bcfg2/Server/Plugins/Metadata.py
+++ b/src/lib/Bcfg2/Server/Plugins/Metadata.py
@@ -358,15 +358,15 @@ class MetadataGroup(tuple):
""" representation of a metadata group. basically just a named tuple """
# pylint: disable=R0913,W0613
- def __new__(cls, name, bundles=None, category=None,
- is_profile=False, is_public=False, is_private=False):
+ def __new__(cls, name, bundles=None, category=None, is_profile=False,
+ is_public=False):
if bundles is None:
bundles = set()
return tuple.__new__(cls, (bundles, category))
# pylint: enable=W0613
- def __init__(self, name, bundles=None, category=None,
- is_profile=False, is_public=False, is_private=False):
+ def __init__(self, name, bundles=None, category=None, is_profile=False,
+ is_public=False):
if bundles is None:
bundles = set()
tuple.__init__(self)
@@ -375,7 +375,6 @@ class MetadataGroup(tuple):
self.category = category
self.is_profile = is_profile
self.is_public = is_public
- self.is_private = is_private
# record which clients we've warned about category suppression
self.warned = []
# pylint: enable=R0913
@@ -795,8 +794,7 @@ class Metadata(Bcfg2.Server.Plugin.Metadata,
for b in grp.findall("Bundle")],
category=grp.get("category"),
is_profile=grp.get("profile", "false") == "true",
- is_public=grp.get("public", "false") == "true",
- is_private=grp.get("public", "true") == "false")
+ is_public=grp.get("public", "false") == "true")
if grp.get('default', 'false') == 'true':
self.default = grp.get('name')
diff --git a/testsuite/Testschema/test_schema.py b/testsuite/Testschema/test_schema.py
index 56fe76205..ddfe4775f 100644
--- a/testsuite/Testschema/test_schema.py
+++ b/testsuite/Testschema/test_schema.py
@@ -1,7 +1,7 @@
import os
-import re
import sys
import glob
+import lxml.etree
from subprocess import Popen, PIPE, STDOUT
# add all parent testsuite directories to sys.path to allow (most)
@@ -27,14 +27,46 @@ except OSError:
HAS_XMLLINT = False
+XS = "http://www.w3.org/2001/XMLSchema"
+XS_NS = "{%s}" % XS
+NSMAP = dict(xs=XS)
+
+
class TestSchemas(Bcfg2TestCase):
schema_url = "http://www.w3.org/2001/XMLSchema.xsd"
@skipUnless(HAS_XMLLINT, "xmllint not installed")
def test_valid(self):
- schemas = [s for s in glob.glob(os.path.join(srcpath,'*.xsd'))]
+ schemas = [s for s in glob.glob(os.path.join(srcpath, '*.xsd'))]
xmllint = Popen(['xmllint', '--xinclude', '--noout', '--schema',
self.schema_url] + schemas,
stdout=PIPE, stderr=STDOUT)
print(xmllint.communicate()[0])
self.assertEqual(xmllint.wait(), 0)
+
+ def test_duplicates(self):
+ entities = dict()
+ for root, _, files in os.walk(srcpath):
+ for fname in files:
+ if not fname.endswith(".xsd"):
+ continue
+ path = os.path.join(root, fname)
+ relpath = path[len(srcpath):].strip("/")
+ schema = lxml.etree.parse(path).getroot()
+ ns = schema.get("targetNamespace")
+ if ns not in entities:
+ entities[ns] = dict(group=dict(),
+ attributeGroup=dict(),
+ simpleType=dict(),
+ complexType=dict())
+ for entity in schema.xpath("//xs:*[@name]", namespaces=NSMAP):
+ tag = entity.tag[len(XS_NS):]
+ if tag not in entities[ns]:
+ continue
+ name = entity.get("name")
+ if name in entities[ns][tag]:
+ self.assertNotIn(name, entities[ns][tag],
+ "Duplicate %s %s (in %s and %s)" %
+ (tag, name, fname,
+ entities[ns][tag][name]))
+ entities[ns][tag][name] = fname
diff --git a/testsuite/Testsrc/Testlib/TestServer/TestPlugins/TestMetadata.py b/testsuite/Testsrc/Testlib/TestServer/TestPlugins/TestMetadata.py
index 430368238..f627e4465 100644
--- a/testsuite/Testsrc/Testlib/TestServer/TestPlugins/TestMetadata.py
+++ b/testsuite/Testsrc/Testlib/TestServer/TestPlugins/TestMetadata.py
@@ -807,9 +807,6 @@ class TestMetadata(_TestMetadata, TestStatistics, TestDatabaseBacked):
self.assertTrue(metadata.groups['group1'].is_public)
self.assertTrue(metadata.groups['group2'].is_public)
self.assertFalse(metadata.groups['group3'].is_public)
- self.assertFalse(metadata.groups['group1'].is_private)
- self.assertFalse(metadata.groups['group2'].is_private)
- self.assertTrue(metadata.groups['group3'].is_private)
self.assertTrue(metadata.groups['group1'].is_profile)
self.assertTrue(metadata.groups['group2'].is_profile)
self.assertFalse(metadata.groups['group3'].is_profile)