Calling Web.Sitemap from XSLT

admin

Administrator
Staff member
I have a site that uses the Master Page method in ASP.NET, and it contains a Web.sitemap doc that contains all of the navigation for the site. The Web.sitemap doc is basically an XML doc, so I was hoping that I could pull data from it using the XSLT document method, like this:

Web.sitemap:
<?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 basic information about us." id="aboutus" />
</siteMapNode>
</siteMap>

XSLT doc:
<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" encoding="UTF-8" indent="yes"/>
<!-- PAGE-SPECIFIC VARIABLES -->
<xsl:variable name="websitemap" select="document('http://localhost:1309/phase3/Web.sitemap')" />
<xsl:template match="/">
Link: <xsl:value-of select="$websitemap/siteMap/siteMapNode/siteMapNode[@id='aboutus']" /><br />
</xsl:template>
</xsl:stylesheet>

...but it's not working. Is this setup possible? If so, what am I doing wrong? Thanks for any help.
 
Back
Top