title: XSL and namespaces
body: <p>Parsing the following with the php xlst processor result in this error:</p>
  
  <pre><code>`Warning: DOMDocument::load(): Namespace prefix g on id is not defined in /var/www    /mistermatic/spider/resources/xslt/car/google.xsl, line: 32 in /var/www/mistermatic/ads/PublicXML/makeXML.php on line 91`
  </code></pre>
  
  <p>How do I correctly define the namespace inside the rss node so that I can apply it to all the children I'm gonna manipulate?</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"&gt;
      &lt;xsl:strip-space elements="*"/&gt;
      &lt;xsl:output method="xml" version="1.0" encoding="UTF-8" omit-xml-declaration="no" indent="yes"/&gt;
  
      &lt;xsl:template match="/"&gt;
          &lt;rss xmlns:g="http://base.google.com/ns/1.0" version="2.0"&gt;
              &lt;channel&gt;
          &lt;title&gt;Mistermatic&lt;/title&gt;
          &lt;link&gt;http://www.mistermatic.it&lt;/link&gt;
          &lt;description&gt;Multipubblicazione di annunci di automobili nuove ed usate&lt;/description&gt;
  
                  &lt;xsl:for-each select="//ad"&gt;
                      &lt;item xmlns:g="http://base.google.com/ns/1.0" version="2.0"&gt;
                          &lt;xsl:apply-templates select="itemId"/&gt;
                          &lt;g:availability&gt;in stock&lt;/g:availability&gt;
                          &lt;g:google_product_category&gt;&lt;![CDATA[Veicoli a motore &gt; Veicoli &gt; Auto, autocarri e furgoni]]&gt;&lt;/g:google_product_category&gt;
                      &lt;/item&gt;
                  &lt;/xsl:for-each&gt;
              &lt;/channel&gt;
          &lt;/rss&gt;
      &lt;/xsl:template&gt;
  
      &lt;xsl:template match="itemId"&gt;
          &lt;g:id&gt;
              &lt;xsl:text disable-output-escaping="yes"&gt;&amp;lt;![CDATA[&lt;/xsl:text&gt;
              &lt;xsl:value-of select="@value"/&gt;
              &lt;xsl:text disable-output-escaping="yes"&gt;]]&amp;gt;&lt;/xsl:text&gt;
          &lt;/g:id&gt;
      &lt;/xsl:template&gt;
  
  &lt;/xsl:stylesheet&gt;
  </code></pre>