Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

problem creating xslt for sitemap xml 1

Status
Not open for further replies.

janwane

MIS
Dec 11, 2009
2
US
I am a beginner with XML. I just created a sitemap using the sample protocol on sitemaps.org. I spent 5 hours yesterday reading about and trying out examples to transform it with xslt with no success. I am at my wits end. Following is my (abbreviated) xml file. Can someone write me a simple xslt that successfully reads it? Thank you.

<?xml version="1.0" encoding="UTF-8"?>
<!--<?xml-stylesheet type="text/xsl" href="Sitemap.xslt"?>-->
<urlset xmlns=" <url>
<loc> <lastmod>2009-11-10</lastmod>
<changefreq>monthly</changefreq>
<priority>0.8</priority>
</url>
<url>
<loc> <lastmod>2009-11-10</lastmod>
<changefreq>yearly</changefreq>
<priority>0.7</priority>
</url>
</urlset>
 
What have you tried?! The question is: are you ready?
[tt]
<xsl:stylesheet version="1.0" xmlns:xsl="[ignore][/ignore]"
xmlns:sm="[ignore][/ignore]"
exclude-result-prefixes="sm"
>
<xsl:eek:utput method="html" encoding="utf-8" indent="yes" />
<xsl:template match="/sm:urlset">
<xsl:for-each select="sm:url/sm:loc">
<a href="{.}"><xsl:value-of select="." /></a><br />
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>
[/tt]
 
I cannot thank you enough! I tested your response and it works...and not only that but the href works. I had researched that too. I will study your code and try to learn from it. You saved me countless hours. Thank you again.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top