2013-04-04 82 views
-2

我產生XHTML,但驗證器(http://validator.w3.org/check) 給我的錯誤「的文件類型不允許元素‘禮’在這裏;失蹤之一的‘UL’,‘OL’開始標記」XSLT生成XHTML 1.0嚴格

代碼是:

<xsl:template match="/"> 
     <html xmlns="http://www.w3.org/1999/xhtml"> 
      <head> 
       <title>Catalogue</title> 
      </head> 
      <body> 
       <h1>Producers</h1> 
       <div style="margin:1em;background-color:lightgray;padding:0.5em"> 
         <strong>Quick links to producers</strong> 
         <xsl:call-template name="producer" /> 
       </div> 
       <xsl:apply-templates select="//producer[@id]" /> 
       <h1>Products</h1> 
       <xsl:apply-templates select="//product[@id]" /> 
      </body> 
     </html> 
    </xsl:template> 

    <xsl:template name="producer"> 
     <xsl:for-each select="//producer[@id]"> 
      <li> 
       <a href="#{@id}"> 
       <b> 
        <xsl:value-of select="name"/> 
       </b> 
       <xsl:text> (</xsl:text><xsl:value-of select="@id"/><xsl:text>) </xsl:text> 
       </a> 
      </li> 
     </xsl:for-each> 
    </xsl:template> 

    <xsl:template match="producer[@id]"> 
     <a name="{@id}"/> 
     <div style="border: thin solid gray;margin:1em;padding:0.5em;"> 
      <h2> 
       <xsl:value-of select="name"/> 
      </h2> 
       <xsl:text> 
        <xsl:value-of select="description"/> 
       </xsl:text> 
       <xsl:apply-templates select="//producer[@id=current()/@id]/products"/>    
     </div> 
    </xsl:template> 

任何想法如何生成有效的xhtml? 謝謝。

回答

1

列出你的清單項目。