XML/XSL question

  • seularts
  • Graduate
  • Graduate
  • User avatar
  • Posts: 153
  • Loc: Romania

Post 3+ Months Ago

How can i make a xsl style for this xml:
Code: [ Select ]
<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="b.xsl"?>
<urlset
      xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9
            http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd">
 
<url><loc>http://http://www.tzr.ro/seularts/index.php</loc><priority>1</priority><lastmod>2007-10-05</lastmod><changefreq>hourly</changefreq></url>
<url><loc>http://www.tzr.ro/seularts/contact.php</loc><priority>0.75</priority><lastmod>2007-10-05</lastmod><changefreq>hourly</changefreq></url>
<url><loc>http://http://www.tzr.ro/seularts/portofoliu.php</loc><priority>0.75</priority><lastmod>2007-10-05</lastmod><changefreq>hourly</changefreq></url>
<url><loc>http://http://www.tzr.ro/seularts/resurse.php</loc><priority>0.75</priority><lastmod>2007-10-05</lastmod><changefreq>hourly</changefreq></url>
<url><loc>http://http://www.tzr.ro/seularts/map.php</loc><priority>0.75</priority><lastmod>2007-10-05</lastmod><changefreq>hourly</changefreq></url>
<url><loc>http://http://www.tzr.ro/seularts/calendar.php</loc><priority>0.75</priority><lastmod>2007-10-05</lastmod><changefreq>hourly</changefreq></url>
<url><loc>http://www.tzr.ro/seularts/admx/cal.php</loc><priority>0.5</priority><lastmod>2007-10-05</lastmod><changefreq>hourly</changefreq></url>
<url><loc>http://http://www.tzr.ro/seularts/rss.xml</loc><priority>0.75</priority><lastmod>2007-10-05</lastmod><changefreq>hourly</changefreq></url>
<url><loc>http://http://www.tzr.ro/seularts/copy.php</loc><priority>0.75</priority><lastmod>2007-10-05</lastmod><changefreq>hourly</changefreq></url>
<url><loc>http://http://www.tzr.ro/seularts/admx/index.php</loc><priority>0.75</priority><lastmod>2007-10-05</lastmod><changefreq>hourly</changefreq></url>
<url><loc>http://http://www.tzr.ro/seularts/admx/core/core.php</loc><priority>0.5</priority><lastmod>2007-10-05</lastmod><changefreq>hourly</changefreq></url>
<url><loc>http://jigsaw.w3.org/css-validator/check/referer</loc><priority>0.75</priority><lastmod>2007-10-05</lastmod><changefreq>hourly</changefreq></url>
<url><loc>http://validator.w3.org/check?uri=referer</loc><priority>0.75</priority><lastmod>2007-10-05</lastmod><changefreq>hourly</changefreq></url>
 
</urlset>
 
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <?xml-stylesheet type="text/xsl" href="b.xsl"?>
  3. <urlset
  4.       xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"
  5.       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  6.       xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9
  7.             http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd">
  8.  
  9. <url><loc>http://http://www.tzr.ro/seularts/index.php</loc><priority>1</priority><lastmod>2007-10-05</lastmod><changefreq>hourly</changefreq></url>
  10. <url><loc>http://www.tzr.ro/seularts/contact.php</loc><priority>0.75</priority><lastmod>2007-10-05</lastmod><changefreq>hourly</changefreq></url>
  11. <url><loc>http://http://www.tzr.ro/seularts/portofoliu.php</loc><priority>0.75</priority><lastmod>2007-10-05</lastmod><changefreq>hourly</changefreq></url>
  12. <url><loc>http://http://www.tzr.ro/seularts/resurse.php</loc><priority>0.75</priority><lastmod>2007-10-05</lastmod><changefreq>hourly</changefreq></url>
  13. <url><loc>http://http://www.tzr.ro/seularts/map.php</loc><priority>0.75</priority><lastmod>2007-10-05</lastmod><changefreq>hourly</changefreq></url>
  14. <url><loc>http://http://www.tzr.ro/seularts/calendar.php</loc><priority>0.75</priority><lastmod>2007-10-05</lastmod><changefreq>hourly</changefreq></url>
  15. <url><loc>http://www.tzr.ro/seularts/admx/cal.php</loc><priority>0.5</priority><lastmod>2007-10-05</lastmod><changefreq>hourly</changefreq></url>
  16. <url><loc>http://http://www.tzr.ro/seularts/rss.xml</loc><priority>0.75</priority><lastmod>2007-10-05</lastmod><changefreq>hourly</changefreq></url>
  17. <url><loc>http://http://www.tzr.ro/seularts/copy.php</loc><priority>0.75</priority><lastmod>2007-10-05</lastmod><changefreq>hourly</changefreq></url>
  18. <url><loc>http://http://www.tzr.ro/seularts/admx/index.php</loc><priority>0.75</priority><lastmod>2007-10-05</lastmod><changefreq>hourly</changefreq></url>
  19. <url><loc>http://http://www.tzr.ro/seularts/admx/core/core.php</loc><priority>0.5</priority><lastmod>2007-10-05</lastmod><changefreq>hourly</changefreq></url>
  20. <url><loc>http://jigsaw.w3.org/css-validator/check/referer</loc><priority>0.75</priority><lastmod>2007-10-05</lastmod><changefreq>hourly</changefreq></url>
  21. <url><loc>http://validator.w3.org/check?uri=referer</loc><priority>0.75</priority><lastmod>2007-10-05</lastmod><changefreq>hourly</changefreq></url>
  22.  
  23. </urlset>
  24.  


i have tried:
Code: [ Select ]
<?xml version="1.0" encoding="ISO-8859-1"?>
 
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
 
<xsl:template match="/">
  <html>
  <body>
    <h2>Site Map</h2>
    <table border="1">
    <tr bgcolor="#9acd32">
      <th align="left">URL</th>
    </tr>
    <xsl:for-each select="urlset/url">
    <tr>
      <td><xsl:value-of select="loc"/></td>
    </tr>
    </xsl:for-each>
    </table>
  </body>
  </html>
</xsl:template>
 
</xsl:stylesheet>
  1. <?xml version="1.0" encoding="ISO-8859-1"?>
  2.  
  3. <xsl:stylesheet version="1.0"
  4. xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
  5.  
  6. <xsl:template match="/">
  7.   <html>
  8.   <body>
  9.     <h2>Site Map</h2>
  10.     <table border="1">
  11.     <tr bgcolor="#9acd32">
  12.       <th align="left">URL</th>
  13.     </tr>
  14.     <xsl:for-each select="urlset/url">
  15.     <tr>
  16.       <td><xsl:value-of select="loc"/></td>
  17.     </tr>
  18.     </xsl:for-each>
  19.     </table>
  20.   </body>
  21.   </html>
  22. </xsl:template>
  23.  
  24. </xsl:stylesheet>


the only way that it responds is if i remove the atributes from the urlset tag, but that is not a good option, especialy for validation of the xml..:)
  • Anonymous
  • Bot
  • No Avatar
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post 3+ Months Ago

  • seularts
  • Graduate
  • Graduate
  • User avatar
  • Posts: 153
  • Loc: Romania

Post 3+ Months Ago

Anyone!?

Post Information

  • Total Posts in this topic: 2 posts
  • Users browsing this forum: No registered users and 3 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
 

© 1998-2014. Ozzu® is a registered trademark of Unmelted, LLC.