]> granicus.if.org Git - docbook-dsssl/commitdiff
Handle attribute default values
authorNorman Walsh <ndw@nwalsh.com>
Sun, 29 Jan 2006 21:55:49 +0000 (21:55 +0000)
committerNorman Walsh <ndw@nwalsh.com>
Sun, 29 Jan 2006 21:55:49 +0000 (21:55 +0000)
docbook/relaxng/tools/doc2dtd.xsl
docbook/relaxng/tools/xml2dtd.xsl

index 7e10a6c45d546ba9aa265fb9cd0a7568acb90a53..d0237ee9a14fa2b13bf04d776987a0cdfea949bd 100644 (file)
@@ -5,6 +5,7 @@
                xmlns:doc="http://nwalsh.com/xmlns/schema-doc/"
                xmlns:ctrl="http://nwalsh.com/xmlns/schema-control/"
                xmlns:dtd="http://nwalsh.com/xmlns/dtd/"
+               xmlns:a="http://relaxng.org/ns/compatibility/annotations/1.0"
                exclude-result-prefixes="exsl rng doc ctrl"
                version="1.0">
 
 
        <xsl:otherwise>
          <dtd:attribute name="{@name}">
+           <xsl:if test="@a:defaultValue">
+             <xsl:attribute name="default">
+               <xsl:value-of select="@a:defaultValue"/>
+             </xsl:attribute>
+           </xsl:if>
            <xsl:attribute name="occurs">
              <xsl:choose>
                <xsl:when test="ancestor::rng:optional">optional</xsl:when>
index 557a353758498936cf1cc90b2e027aa80e4a00c0..8c55eca6e28160c1df245c2c9a536abd1cf6ca2c 100644 (file)
       </xsl:choose>
       <xsl:text>&#9;</xsl:text>
       <xsl:choose>
+       <xsl:when test="@default">
+         <xsl:text>"</xsl:text>
+         <xsl:value-of select="@default"/>
+         <xsl:text>"</xsl:text>
+       </xsl:when>
        <xsl:when test="@occurs='optional'">
          <xsl:text>#IMPLIED</xsl:text>
        </xsl:when>