TrueBlue
asked on
make three columns instead of one
Hi!
We are using the below listed XSLT to display our XML sitemap.
We have alot of links, so we think it would be easier to read if there were three columns.
Any specific modifications so that the XSLT would display these links in three columns (in a grid if possible) instead of one would be greatly appreciated.
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:sm="http://www.sitemaps.org/schemas/sitemap/0.9"
version="1.0">
<xsl:output method="html" indent="yes"/>
<xsl:strip-space elements="*"/>
<xsl:template match="sm:urlset">
<html>
<body>
<xsl:apply-templates select="sm:url">
<xsl:sort select="sm:alt" order="ascending" data-type="text"/>
</xsl:apply-templates>
</body>
</html>
</xsl:template>
<xsl:template match="sm:url">
<p>
<a href="{sm:loc}">
<xsl:value-of select="sm:alt"/>
</a>
</p>
</xsl:template>
</xsl:stylesheet>
We are using the below listed XSLT to display our XML sitemap.
We have alot of links, so we think it would be easier to read if there were three columns.
Any specific modifications so that the XSLT would display these links in three columns (in a grid if possible) instead of one would be greatly appreciated.
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:sm="http://www.sitemaps.org/schemas/sitemap/0.9"
version="1.0">
<xsl:output method="html" indent="yes"/>
<xsl:strip-space elements="*"/>
<xsl:template match="sm:urlset">
<html>
<body>
<xsl:apply-templates select="sm:url">
<xsl:sort select="sm:alt" order="ascending" data-type="text"/>
</xsl:apply-templates>
</body>
</html>
</xsl:template>
<xsl:template match="sm:url">
<p>
<a href="{sm:loc}">
<xsl:value-of select="sm:alt"/>
</a>
</p>
</xsl:template>
</xsl:stylesheet>
ASKER
Gertone,
I know you mentioned that the alt tag was not strict XSLT.
Google webtools gave an error like below for each occurence of the alt tag in our XML sitemap page:
Invalid XML tag
This tag was not recognized. Please fix it and resubmit. Parent tag: url
Tag: alt
Would these errors go away by using the namespace method you suggested?
TIA
I know you mentioned that the alt tag was not strict XSLT.
Google webtools gave an error like below for each occurence of the alt tag in our XML sitemap page:
Invalid XML tag
This tag was not recognized. Please fix it and resubmit. Parent tag: url
Tag: alt
Would these errors go away by using the namespace method you suggested?
TIA
yes, these errors would go away with a different namespace
(at least when the validator supports sitemap extensions, most will)
(at least when the validator supports sitemap extensions, most will)
ASKER
Gertone,
Apparently Google does not support sitemap extensions because I tried the method with a different namespace and Google gives the same errors.
Does everyone have to maintain two sitemaps?
One for search engines and one for users.
Apparently Google does not support sitemap extensions because I tried the method with a different namespace and Google gives the same errors.
Does everyone have to maintain two sitemaps?
One for search engines and one for users.
I don't know actually, I never worked with XML sitemaps before and I must say that I was shocked to find out that a sidemap has no way of adding user friendly information to it.
I started reading into this and yes, xml sitemaps are meant for search engines only, not for human consumption.
No, you don't need to maintain two sitemaps.
I would recommend to make one sitemap as you did, but filter out the alt field
You can use the XSLT we worked on so far to create the HTML three column sitemap
You can use the XSLT that I include with this message for generating the google xml sitemap
(assuming you did not put the alt in a different namespace
All from your one source sitemap
Hope this helps
I started reading into this and yes, xml sitemaps are meant for search engines only, not for human consumption.
No, you don't need to maintain two sitemaps.
I would recommend to make one sitemap as you did, but filter out the alt field
You can use the XSLT we worked on so far to create the HTML three column sitemap
You can use the XSLT that I include with this message for generating the google xml sitemap
(assuming you did not put the alt in a different namespace
All from your one source sitemap
Hope this helps
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:sm="http://www.sitemaps.org/schemas/sitemap/0.9"
version="1.0">
<xsl:output method="xml" indent="yes"/>
<xsl:strip-space elements="*"/>
<xsl:template match="node()">
<xsl:copy>
<xsl:copy-of select="@*"/>
<xsl:apply-templates select="node()"></xsl:apply-templates>
</xsl:copy>
</xsl:template>
<xsl:template match="sm:alt"/>
</xsl:stylesheet>
ASKER
Gertone,
First, thank you for your exceelent help.
Are you saying have two xslt files?
If so, currently I call only one from the XML page.
So how would I know which one to call?
TIA
First, thank you for your exceelent help.
Are you saying have two xslt files?
If so, currently I call only one from the XML page.
So how would I know which one to call?
TIA
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
I removed the ordering because that would make things substantially more difficult.
Let me know if the sorting is crucial
Open in new window