]> granicus.if.org Git - docbook-dsssl/commitdiff
Flatten away groups of optional attributes
authorNorman Walsh <ndw@nwalsh.com>
Fri, 27 Feb 2004 18:20:34 +0000 (18:20 +0000)
committerNorman Walsh <ndw@nwalsh.com>
Fri, 27 Feb 2004 18:20:34 +0000 (18:20 +0000)
docbook/relaxng/tools/rngdocxml.xsl

index 98ec0cca8a6802fd570307a824ea6b9fd623e208..b3a3b4e754d2d0b4a82feb9529c1413eee587fa5 100644 (file)
     <xsl:apply-templates mode="flatten"/>
   </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="rng:notAllowed" mode="flatten">
     <xsl:choose>
       <xsl:when test="parent::rng:choice|parent::rng:zeroOrMore|parent::rng:oneOrMore">