I generate xhtml but validator (http://validator.w3.org/check) give me error "document type does not allow element "li" here; missing one of "ul", "ol" start-tag"

Code is:

<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>

Any idea how generate valid xhtml? Thanks.

有帮助吗?

解决方案

Put a list around your list items.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top