Search

I am trying to validate my site, and have discovered that my meta tags are not closed or self closing.

This is the code I am using:

<xsl:template match="seomanager-get-rule/description">
  <xsl:element name="meta">
    <xsl:attribute name="name">
      <xsl:text>description</xsl:text>
    </xsl:attribute>
    <xsl:attribute name="content">
      <xsl:copy-of select="."/>
    </xsl:attribute>
  </xsl:element>
</xsl:template>

Looks right? Well it’s not closing.

Anybody know why?

You’ve probably got your XSL output type set to html, which will give you HTML 4.01 non-self-closing elements. Using xml` will give you XHTML self-closing elements.

<xsl:output method="xml" ... />

Maybe it has to do with the method of your xsl:output element?

If the method is ‘html’ I guess it defaults to HTML syntax instead of XML/XHTML syntax. Changing the output method to xml should return elements with the self-closing />.

haha, and @nickdunn is faster again ;)

FWIW: it does not validate but makes no difference in how browsers render your page.

thanks guys, but I thought of that.

I have this though:

<xsl:output method="xml"
    doctype-public="-//W3C//DTD XHTML 1.0 Strict//EN"
    doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"
    omit-xml-declaration="yes"
    encoding="UTF-8"
    indent="yes" />

That other code by the way I am displaying by this:

<xsl:apply-templates select="/data/seo-manager/entry"/>

Its all sorted, there was a rogue utility that was throwing everything out of sync. All is right with the world now.

Create an account or sign in to comment.

Symphony • Open Source XSLT CMS

Server Requirements

  • PHP 5.3-5.6 or 7.0-7.3
  • PHP's LibXML module, with the XSLT extension enabled (--with-xsl)
  • MySQL 5.5 or above
  • An Apache or Litespeed webserver
  • Apache's mod_rewrite module or equivalent

Compatible Hosts

Sign in

Login details