View Single Post
  #6 (permalink)  
Old March 8th, 2007, 06:46 PM
kwilliams kwilliams is offline
Banned
Points: 1,561, Level: 16
Points: 1,561, Level: 16 Points: 1,561, Level: 16 Points: 1,561, Level: 16
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jul 2005
Location: , , .
Posts: 317
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Ok, I've been working with a user from another forum (http://w3schools.invisionzone.com/in...t=0#entry62376), and this is the solution that he's got working:
Web.sitemap
[code]
<?xml version="1.0" encoding="utf-8" ?>
<siteMap xmlns="http://schemas.microsoft.com/AspNet/SiteMap-File-1.0" >
  <siteMapNode url="~/default.aspx" title="Home Page" id="default">
    <siteMapNode url="~/aboutus/aboutus.aspx" title="About Us" description="This page contains links to information about us." id="aboutus">
  </siteMapNode>
</siteMap>

aboutus.xsl
Code:
<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:sm="http://schemas.microsoft.com/AspNet/SiteMap-File-1.0" exclude-result-prefixes="sm">
<xsl:output method="xml" encoding="UTF-8" indent="yes"/>
<xsl:include href="siteMap.xsl" />
    <xsl:template match="/">
        <div id="navigation">
            <xsl:for-each select="document('Web.sitemap')">
                <xsl:apply-templates select="sm:siteMap" />
            </xsl:for-each>
        </div>
        <div id="content">
            <xsl:apply-templates/>
        </div>
    </xsl:template>
</xsl:stylesheet>
sitemap.xsl
Code:
<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:sm="http://schemas.microsoft.com/AspNet/SiteMap-File-1.0" exclude-result-prefixes="sm">
    <xsl:output method="xml" encoding="UTF-8" indent="yes"/>
    <xsl:template name="map" match="sm:siteMap">
        [list]
            <xsl:apply-templates/>
        </ul>
    </xsl:template>
    <xsl:template match="sm:siteMapNode">
        <li>
            <a id="{@id}" href="{@url}">
                <xsl:if test="@description">
                    <xsl:attribute name="title">
                        <xsl:value-of select="@description"/>
                    </xsl:attribute>
                </xsl:if>
                <xsl:value-of select="@title"/>
                <xsl:if test="sm:siteMapNode">
                    <xsl:call-template name="map"/>
                </xsl:if>
            </a>
        </li>
    </xsl:template>
</xsl:stylesheet>
...but it's not working on my side. These two documents are transformed using an ASP.NET Master Page method, like this:

MasterPage.master.vb:
Code:
Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs)
    xslTransform_mc.DocumentSource = "docs/xml/aboutus/aboutus.xml" 'xml doc
        xslTransform_mc.TransformSource = "docs/xslt/aboutus/aboutus.xsl" 'xsl doc
End Sub
MasterPage.master:
Code:
<%@ Master Language="VB" CodeFile="MasterPage.master.vb" Inherits="MasterPage" Debug="True" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<body>
    <form id="form1" runat="server">
        <asp:Xml id="xslTransform_mc" runat="server"></asp:Xml>
    </form>
</body>
</html>
If anyone can let me know what I'm doing wrong, it would be very appreciated. Thanks for any and all help.

KWilliams
Reply With Quote