<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[StyleSheet per Sitemaps]]></title><description><![CDATA[<p dir="auto">Sto cercando di implementare un foglio di stile per la mia sitemap ma non sembra funzionare.<br />
Ho preso come esempio la sitemap di questo sito qui: view-source:computer-acquisti.com/blog/sitemap.xml</p>
<p dir="auto">la definizione che richiama il foglio di stile è:</p>
<pre><code>&lt;?xml-stylesheet type="text/xsl" href="computer-acquisti.com/blog/wp-content/plugins/google-sitemap-generator/sitemap.xsl"?&gt;
</code></pre>
<p dir="auto">questo sitemap.xsl è un file generato da un plugin wordpress.<br />
L'ho preso ad esempio e l'ho ricreato sul mio sito, la mia sitemap comincia così:</p>
<pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt; 
&lt;?xml-stylesheet href="mioSito/css/sitemap.xsl" type="text/xsl"?&gt; 
&lt;urlset xmlns=".sitemaps.org/schemas/sitemap/0.9" xmlns:xsi="w3.org/2001/XMLSchema-instance" xsi:schemaLocation=".sitemaps.org/schemas/sitemap/0.9 .sitemaps.org/schemas/sitemap/0.9/sitemap.xsd"&gt; 
  &lt;url&gt; 
    &lt;loc&gt;mioSito/catalogo&lt;/loc&gt; 
    &lt;lastmod&gt;2011-05-25T00:00:00+02:00&lt;/lastmod&gt; 
    &lt;changefreq&gt;daily&lt;/changefreq&gt; 
    &lt;priority&gt;1&lt;/priority&gt; 
  &lt;/url&gt; 
[... etc ...]
&lt;/urlset&gt;
</code></pre>
<p dir="auto">se vado all'indirizzo mioSito/css/sitemap.xsl vedo correttamente il mio template<br />
(così come lo vedreste andando all'indirizzo <a href="http://computer-acquisti.com/blog/wp-content/plugins/google-sitemap-generator/sitemap.xsl" rel="nofollow ugc">computer-acquisti.com/blog/wp-content/plugins/google-sitemap-generator/sitemap.xsl</a>)</p>
<p dir="auto">ma nella mia sitemap (mioSito/sitemap.xml) non risulta nessuna stilizzazione, anzi, gli elementi vengono sparati in output senza nemmeno la dicitura "This XML file does not appear to have any style information associated with it"<br />
come da questo esempio qui:<br />
.emilianovestri.it/sitemap.xml</p>
<p dir="auto">questo mi fa pensare che la mia sitemap non è corretta, ma né trovo errori nella sitemap né validatori che funzionino offline...</p>
<p dir="auto">Qualche suggerimento?</p>
<p dir="auto">PS: per generare la sitemap uso lo Zend Framework con qualche modifica.<br />
PPS: per poter postare ho dovuto omettere tutte le intestazioni dei link</p>
]]></description><link>https://dev.connect.gt/topic/152835/stylesheet-per-sitemaps</link><generator>RSS for Node</generator><lastBuildDate>Thu, 26 Nov 2026 01:38:31 GMT</lastBuildDate><atom:link href="https://dev.connect.gt/topic/152835.rss" rel="self" type="application/rss+xml"/><pubDate>Tue, 07 Jun 2011 11:15:37 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to StyleSheet per Sitemaps on Wed, 08 Jun 2011 09:15:14 GMT]]></title><description><![CDATA[<p dir="auto">Il problema era dello Zend Framework.</p>
<p dir="auto">Vi riporto la souzione:</p>
<p dir="auto">Bisogna impostare un router statico in questo modo:</p>
<pre><code>routes.sitemap.type 										= "Zend_Controller_Router_Route_Static"
routes.sitemap.route 										= "sitemap.xml"
routes.sitemap.defaults.module	 							= "default"
routes.sitemap.defaults.controller 							= "index"
routes.sitemap.defaults.action	 							= "sitemap"
routes.sitemap.defaults.format 								= "xml"
</code></pre>
<p dir="auto">Nell'Index controller:</p>
<pre><code>public function init()
    {
        parent::init();
		$this-&gt;_helper-&gt;contextSwitch 
			-&gt;addActionContext('sitemap', 'xml') 
			-&gt;initContext(); 
    }
public function sitemapAction(){ }
</code></pre>
<p dir="auto">e nel sitemap.xml.phtml:</p>
<pre><code>$this-&gt;navigation()
      -&gt;sitemap()
      -&gt;setUseSchemaValidation(true)
      -&gt;setUseSitemapValidators(true)
      -&gt;setFormatOutput(false);
 
$domDoc = $this-&gt;navigation()-&gt;sitemap()-&gt;getDomSitemap();

$styleheetParams = 'href="/css/sitemap.xsl" type="text/xsl"';

$xmlstylesheet = new DOMProcessingInstruction( 'xml-stylesheet', $styleheetParams);

$urlset = $domDoc-&gt;getElementsByTagName('urlset')-&gt;item(0);
$urlset-&gt;setAttribute('xmlns:xsi', 'hppp://wmw.w3.org/2001/XMLSchema-instance');
$urlset-&gt;setAttribute('xsi:schemaLocation', 'hppp://wmw.sitemaps.org/schemas/sitemap/0.9 hppp://wmw.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd');

$domDoc-&gt;insertBefore($xmlstylesheet, $urlset);

echo $domDoc-&gt;saveXML();
</code></pre>
<p dir="auto">PPS: sempre per il solito motivo ho dovuto inserire hppp://wmw apposta degli originali</p>
]]></description><link>https://dev.connect.gt/post/1008564</link><guid isPermaLink="true">https://dev.connect.gt/post/1008564</guid><dc:creator><![CDATA[adamquadmon]]></dc:creator><pubDate>Wed, 08 Jun 2011 09:15:14 GMT</pubDate></item></channel></rss>