]> granicus.if.org Git - docbook-dsssl/commitdiff
Flatten groups of optional attributes
authorNorman Walsh <ndw@nwalsh.com>
Fri, 9 Jan 2004 15:56:04 +0000 (15:56 +0000)
committerNorman Walsh <ndw@nwalsh.com>
Fri, 9 Jan 2004 15:56:04 +0000 (15:56 +0000)
docbook/relaxng/tools/rngdocxml-multipass.xsl

index ea8d5b4ed739245187a1fd3f09a4cd724910f8ba..8ce0b163a20f9f21d9e54999724d8b32710297f3 100644 (file)
     </xsl:copy>
   </xsl:template>
 
+  <xsl:template match="rng:group" mode="flatten">
+    <xsl:choose>
+      <xsl:when test="ancestor::doc:attributes
+                     and count(*) = count(rng:optional[rng:attribute])">
+       <xsl:apply-templates mode="flatten"/>
+      </xsl:when>
+      <xsl:otherwise>
+       <xsl:copy>
+         <xsl:copy-of select="@*"/>
+         <xsl:apply-templates mode="flatten"/>
+       </xsl:copy>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>
+
   <xsl:template match="doc:content-model//rng:choice/rng:choice
                       |doc:content-model//rng:zeroOrMore/rng:choice
                       |doc:content-model//rng:oneOrMore/rng:choice