config_tools: add a slicer of XML schema

We plan to add the following attributes to element definitions in the XML
schema:

  - acrn:applicable-vms, which specify if an element applies to a
    pre-launched VM, the service VM or a post-launched VM

  - acrn:views, which specify if an element shall appear in the basic or
    advanced tab in the configurator.

In order to reduce the attributes above to existing XML technologies, we
need to create new complex types that lists all config items that applies
to a pre-launched VM, the service VM or a post-launched VM, or that should
be shown in the basic or advanced view. Such types can then be used to
replace the original, all-in-one type during validation or configurator
rendering.

When unspecified, an element always applies under all possible
circumstances.

To realize this slicing mechanism, this patch adds a generic class
implementing the common part of slicing XML schema types and two
specific-purpose slicers according to the applicable VMs or views
attributes.

v2 -> v3:

  * Update configdoc.xsl to recognize types in xs:alternative nodes.

Tracked-On: #6690
Signed-off-by: Junjie Mao <junjie.mao@intel.com>
This commit is contained in:
Junjie Mao
2022-02-12 16:24:32 +08:00
committed by acrnsi-robot
parent 433b37b1a8
commit 0e225c4b23
5 changed files with 266 additions and 2 deletions

View File

@@ -39,7 +39,16 @@
<xsl:param name="level"/>
<xsl:param name="prefix"/>
<xsl:variable name="ty" select="@type"/>
<xsl:variable name="ty">
<xsl:choose>
<xsl:when test="@type">
<xsl:value-of select="@type" />
</xsl:when>
<xsl:otherwise>
<xsl:value-of select=".//xs:alternative[1]/@type" />
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<!-- Only visit elements having complex types. Those having simple types are
described as an option.. -->