doc: adjust views processing for schema documentation

The acrn:views processing for showing which tabs an option would display
on wasn't quite right when an element AND a parent both had a views
attribute (specifically when the parent had "basic, advanced" but the
element only had "basic" or "advanced").

Signed-off-by: David B. Kinder <david.b.kinder@intel.com>
This commit is contained in:
David B. Kinder 2022-05-25 13:49:18 -07:00 committed by David Kinder
parent 957e9f8143
commit a6a8f08854
1 changed files with 21 additions and 9 deletions

View File

@ -56,6 +56,9 @@
<!-- Only visit elements having complex types. Those having simple types are
described as an option -->
<xsl:choose>
<xsl:when test="xs:annotation/@acrn:views=''">
<!-- don't document elements if not viewable -->
</xsl:when>
<xsl:when test="//xs:complexType[@name=$ty]">
<!-- The section header -->
<xsl:if test="$level &lt;= 4">
@ -80,9 +83,6 @@
<xsl:with-param name="parent" select="."/>
</xsl:apply-templates>
</xsl:when>
<xsl:when test="xs:annotation/@acrn:views=''">
<!-- don't document elements if not viewable -->
</xsl:when>
<xsl:otherwise>
<xsl:if test="$level = 3">
<!-- No longer writing a section header for elements with a simple type
@ -135,12 +135,24 @@
<xsl:text>|icon-not-available| </xsl:text>
</xsl:when>
<xsl:otherwise>
<xsl:if test="count((ancestor-or-self::node()|$parent)[xs:annotation[contains(@acrn:views,'basic')]][1])!=0">
<xsl:text>|icon-basic| </xsl:text>
</xsl:if>
<xsl:if test="count((ancestor-or-self::node()|$parent)[xs:annotation[contains(@acrn:views,'advanced')]][1])!=0">
<xsl:text>|icon-advanced| </xsl:text>
</xsl:if>
<xsl:choose>
<xsl:when test="count(ancestor-or-self::node()[xs:annotation[@acrn:views]])!=0">
<xsl:if test="count((ancestor-or-self::node())[xs:annotation[contains(@acrn:views,'basic')]][1])!=0">
<xsl:text>|icon-basic| </xsl:text>
</xsl:if>
<xsl:if test="count((ancestor-or-self::node())[xs:annotation[contains(@acrn:views,'advanced')]][1])!=0">
<xsl:text>|icon-advanced| </xsl:text>
</xsl:if>
</xsl:when>
<xsl:otherwise>
<xsl:if test="count(($parent)[xs:annotation[contains(@acrn:views,'basic')]][1])!=0">
<xsl:text>|icon-basic| </xsl:text>
</xsl:if>
<xsl:if test="count(($parent)[xs:annotation[contains(@acrn:views,'advanced')]][1])!=0">
<xsl:text>|icon-advanced| </xsl:text>
</xsl:if>
</xsl:otherwise>
</xsl:choose>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>