Jump to content

kwilliams

Members
  • Posts

    229
  • Joined

  • Last visited

Profile Information

  • Gender
    Male

kwilliams's Achievements

Member

Member (2/7)

2

Reputation

  1. I created a simple Stored Procedure (SP) that queries a table and renames the column names, and I'm able to push those results out to a CSV file *with* those header names when done manually.But when I try to export the results to a CSV file by running the same SP using xp_cmdshell with bcp, the header row (Col1, Col2, and Col3) does not appear in the resulting CSV file.ORIGINAL TABLE:ColumnName1-----ColumnName2-----ColumnName3Joe Schmo CustomerJane Doe CustomerTim Tiny MusicianQUERY WITHIN SP:SELECT ColumnName1 AS Col1, ColumnName2 AS Col2, ColumnName3 AS Col3FROM TABLENAMEQUERY RESULT:Col1-----Col2-----Col3 <<<<----- WHAT I WANT!Joe Schmo CustomerJane Doe CustomerTiny Tim MusicianHere's the code I'm using within the job:EXEC xp_cmdshell 'bcp "EXEC DATABASENAME.dbo.STOREDPROCEDURENAME" QUERYOUT "\\MYSERVERNAME\files\export.csv" -c -t, -T -S'CSV FILE RESULT USING BCP:Joe Schmo CustomerJane Doe CustomerTim Tiny MusicianAs you can see the headers are missing. What am I doing wrong?
  2. Hallelujah! I've found an answer by looking at one of the sources of my CSS menu...suckerfish. And it works great.Here's an article on how to do exactly what I needed: http://tanny.ica.com/ICA/TKO/tkoblog.nsf/d...p-in-ie-part-ii...and here's an example page that they created to show how it works: http://tanny.ica.com/ICA/TKO/test.nsf/####.../examplefix.htm This solution uses the iframe method mentioned previously in this post, while allowing only part of the select menu to be hidden. Hopefully this will help other developers in the future. Thanks for all of your help.
  3. My problem is that my application properly pulls an ASP.NET file on my machine using Visual Web Developer 2005, but it doesn't pull it properly when a copy of the application was uploaded to our test server. On my machine, I listed the entire path for the ASP.NET doc to be pulled (c:\Documents and Settings\MYUSERNAME\My Documents\Visual Studio 2005\Projects\DIRECTORY\SUBDIRECTORY\PAGE.aspx). On the test server, I'm attempting to pull the ASP.NET doc with a UNC share (\\SERVERNAME\DIRECTORY\SUBDIRECTORY\PAGE.aspx).I'm using the FileInfo Class to do this, and I've included the two versions of code below. If anyone could please let me know what I'm doing wrong, that would be great. (Hopefully it's something obvious) Thanks.OLD METHOD ON MACHINE: Partial Class MasterPage Inherits System.Web.UI.MasterPage Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs) 'Assign page path to string value Dim strPagePath = Request.ServerVariables("PATH_INFO") Response.Write("<strong>strPagePath: </strong>" & strPagePath & "<br />") 'test 'Assign full page path Dim strFullPagePath = "c:\Documents and Settings\MYUSERNAME\My Documents\Visual Studio 2005\Projects" & strPagePath 'Assign path to FileInfo Class Dim fi As FileInfo = New FileInfo(strFullPagePath) Dim strPageId As String, strPathNoFileName As String Dim strXMLPath_mc As String, strXSLPath_mc As String, strCSSPath As String 'Check if files exist If Not fi.Exists Then strPageId = "default" strPathNoFileName = "http://localhost:1309/DIRECTORYNAME" Else strPageId = fi.Name.Replace(fi.Extension, "") 'without extension strPathNoFileName = strPagePath.Replace(fi.Name, "") 'Assign dynamic page paths strXMLPath_mc = strPathNoFileName + "docs/xml/" & strPageId & ".xml" 'xml doc strXSLPath_mc = strPathNoFileName + "docs/xslt/" & strPageId & ".xsl" 'xsl doc strCSSPath = strPathNoFileName + "docs/css/" & strPageId & ".css" 'css doc End If End SubEnd Class RESULTING VALUE:strFullPagePath = "c:\Documents and Settings\MYUSERNAME\My Documents\Visual Studio 2005\Projects\DIRECTORY\SUBDIRECTORY\PAGE.aspx"NEW METHOD ON TEST SERVER: Partial Class MasterPage Inherits System.Web.UI.MasterPage Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs) 'Assign page path to string value Dim strPagePath = Request.ServerVariables("PATH_INFO") Dim strPagePath_fi As String = strPagePath.Replace("/", "\") 'replace slash Dim strFullPagePath = "\\SERVERNAME\DIRECTORY" & strPagePath_fi '<---THIS IS THE PROBLEM 'Assign path to FileInfo Class Dim fi As FileInfo = New FileInfo(strFullPagePath) Dim strPageId As String, strPathNoFileName As String Dim strXMLPath_mc As String, strXSLPath_mc As String, strCSSPath As String 'Check if files exist If Not fi.Exists Then strPageId = "default" strPathNoFileName = "http://SERVERNAME/DIRECTORY" Else strPageId = fi.Name.Replace(fi.Extension, "") 'without extension strPathNoFileName = strPagePath.Replace(fi.Name, "") 'Assign dynamic page paths strXMLPath_mc = strPathNoFileName + "docs/xml/" & strPageId & ".xml" 'xml doc strXSLPath_mc = strPathNoFileName + "docs/xslt/" & strPageId & ".xsl" 'xsl doc strCSSPath = strPathNoFileName + "docs/css/" & strPageId & ".css" 'css doc End If End SubEnd Class RESULTING VALUE:strFullPagePath = "\\SERVERNAME\DIRECTORY\SUBDIRECTORY\PAGE.aspx"
  4. It worked great! Thanks for the quick response.
  5. I'm trying to use the replace method to replace all instances of "a" and "b" characters within a string, but I'm running into a problem. I have accomplished this in my VB version without a problem, but the JavaScript version is only replacing the first instance of the character in the string. I've included all of the referenced code below. If anyone could please let me know what I'm doing wrong, that would be great. Thanks for any and all help.Problem: JS version replaces only the first instance of a character, while the VB version replaces all instances of characters.Example value: bababaVB version (works):'Declare variablesDim strA As String = "ZZ~"Dim strB As String = "YY~"Dim strValue_display As String = strValue_originalstrValue_display = strValue_display.replace("a",strA)Response.Write("strValue_display (a):" & strValue_display & "<br />")strValue_display = strValue_display.replace("b",strB)Response.Write("strValue_display (:" & strValue_display & "<br />")'Resulting value: YY~ZZ~YY~ZZ~YY~ZZ~JScript version (doesn't work)://Declare variablesvar strA = "ZZ~";var strB = "YY~";var strValue_display = strValue_original;strValue_display = strValue_display.replace("a",strA);Response.Write("strValue_display (a):" + strValue_display + "<br />");strValue_display = strValue_display.replace("b",strB);Response.Write("strValue_display (:" + strValue_display + "<br />");//Resulting value: YY~ZZ~baba
  6. jesh...You make a very good point concerning future compatibility with ASP.NET vs. XSLT.What I liked about the web.sitemap feature most was being able to use the navigational features, especially the breadcrumbs. I now realize that I can use the same model for a XSLT transformation of internal_links.xml.boen_robot...I gave your suggested code a try, and this was the output: ...<!-- Dynamic MainColumn --> <div id="screenmain"> <!-- dynamic page title --> <h1><span id="ctl00_lblPageTitle">About Us</span></h1> <br /> <span id="ctl00_SiteMapPath1"><a href="#ctl00_SiteMapPath1_SkipLink"><img alt="Skip Navigation Links" height="0" width="0" src="/phase3/WebResource.axd?d=AvErmV8chiUAyOw6Ne1jOA2&t=632996128439938112" style="border-width:0px;" /></a><span><a href="/phase3/default.aspx">Home Page</a></span><span> > </span><span>About Us</span><a id="ctl00_SiteMapPath1_SkipLink"></a></span> <br /> <hr class="navyblueline" /> <br /> <span id="ctl00_lblPageDesc">This page contains links to information about us.</span> <br /><br /> <?xml version="1.0" encoding="utf-8"?><ul> <li> <a href=""></a>: </li></ul> </div><!-- end screenmain -->... ...but since I'm going to use the original model with the code I already have developed for internal_links.xml, I won't need to use this filter anyway. Again, I really appreciate all of your help, as it's given me some great tools to accomplish what I need to do. I'll make sure to let you know when I have a complete solution so that you can check it out if you wish.Thanks everyone:)
  7. Well, thanks jesh. I'll give that setup a try. I haven't heard any more from other users on the subject of XSLT vs. ASP.NET for display and manipulation of XML data, but hopefully some advice will come in. Thanks for your suggestion and code:)
  8. I want to have a list of keywords on an XML doc, like this:<aboutus> <internal_links> <link>arealinks</link> <link>faqs</link> <link>contactus</link> </internal_links></aboutus>...and then I want to pull only the properties for those specific links using the "id" attribute in Web.sitemap, so that:<ul> <xsl:for-each select="aboutus/internal_link[link != '']"><!-- SOMETHING LIKE THIS --> <xsl:variable name="url" select="$websitemap/siteMap/siteMapNode/@url" /><!-- SOMETHING LIKE THIS --> <xsl:variable name="title" select="$websitemap/siteMap/siteMapNode/@title" /><!-- SOMETHING LIKE THIS --> <xsl:variable name="description" select="$websitemap/siteMap/siteMapNode/@description" /><!-- SOMETHING LIKE THIS --> <li><a href="{$url}><xsl:value-of select="$title" /></a>: <xsl:value-of select="$description" /></li><!-- SOMETHING LIKE THIS --> </xsl:for-each></ul>...but I'm not sure how to call and loop it properly, since all of the nodes in Web.sitemap use a heirchecy. If you know how I can accomplish this, your help would be great. That setup would work great if I was only using ASP.NET with XML, but since I'm using XSLT to process the individual pages and Web.sitemap in addition to the ASP.NET Master Page, that wouldn't work for me. However, I have been thinking of whether or not it would be easier for me to scrap the use of XSLT in favor of using ASP.NET to display the data from XML. Mostly because creating forms in XSLT and passing that data to and from the ASP.NET/VB/NET docs with this setup has been a real pain in the you know what. One concern I'd have with this switch would be the ability to also transform that data into other formats, but the "PageHandlers" method you mentioned sounds interesting. Could you please point me in the right direction to some resources on that method?Also, if anyone can submit a list of pros and cons to XSLT vs. ASP.NET on this post, that would also be great. Thanks for any & all help.
  9. *Hi jesh,I wanted a completely dynamic site that contains the basic properties on one central page (MasterPage.master), and dynamic properties from data stored in XML documents. I also wanted to use XSLT to display the data, so that I can later easily transform the data into other formats, including PDF, RSS, etc. And finally, I wanted the transformation to be able to use code-behind for each of those pages.So I'm converting my entire site to store data in XML, and display it using XSLT with a ASP.NET transformation. I'm using the one central web.sitemap doc to store the entire site's navigation, so that I can use it from the Master page and the XSLT stylesheets. This setup allows one Master Page to process a page's static properties from the Web.sitemap doc by calling specific nodes from that sitemap into the page-specific XSLT stylesheet. So when I'm done, aboutus.xml will only call nodes in Web.sitemap that have an id of "arealinks", which will display a link to the "Area Links" page. I already had this setup with a central XML file called "internal_links.xml", but since I wanted to use the sitemap class throughout the site, I decided to try to figure out a way to do this using "Web.sitemap" instead.My current setup doesn't have a filter for the "id" attribute yet, so it's just displaying the entire sitemap in an unordered list. So this is what my current setup looks like:MasterPage.master<%@ 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"><head runat="server"> <title id="lblBrowserTitle"></title> <link rel="stylesheet" type="text/css" media="screen" href="~/docs/css/screen.css" /></head><body> <form id="form1" runat="server"> <div id="wrapper"> <div id="screenheader"> <div id="seal"> <asp:Image id="Image1" ImageUrl="~/images/gif/seal.gif" Runat="Server" /> </div><!-- end seal --> <div id="header"> <asp:Image id="Image2" ImageUrl="~/images/gif/header.gif" Runat="Server" /> </div><!-- end header --> <div id="graphic"> <asp:Image id="Image4" ImageUrl="~/images/gif/graphic.gif" Runat="Server" /> </div><!-- end graphic --> <div id="blueborder"> <div id="date_today"> <asp:label id="lblCurrDate" runat="server" /> </div> <div id="header_links"> <a class="white" href="">Help</a> | <a class="white" href="">Contact Us</a> | <a class="white" href="">Text-only Version</a> | <a class="white" href="">Printer-friendly Version</a> </div><!-- end header_links --> </div><!-- end blueborder --> <div id="gradientline"> <asp:Image id="Image5" ImageUrl="~/images/gif/gradientline.gif" Runat="Server" /> </div><!-- end gradientline --> <!-- Tab navigation --> <div id="tabs"> <a href="http://localhost:1309/phase3/default.aspx"><asp:Image id="Image7" ImageUrl="images/gif/tab1.gif" Runat="server" /></a> <a href="http://localhost:1309/phase3/aboutus/aboutus.aspx"><asp:Image id="Image8" ImageUrl="images/gif/tab2.gif" Runat="server" /></a> </div><!-- end tabs --> </div><!-- end screenheader --> <!-- Dynamic MainColumn --> <div id="screenmain"> <!-- dynamic page title --> <h1><asp:label id="lblPageTitle" runat="server" /></h1><!-- dynamic page title --> <br /> <asp:SiteMapPath ID="SiteMapPath1" runat="server"></asp:SiteMapPath><!-- dynamic breadcrumbs --> <br /> <hr class="navyblueline" /> <br /> <asp:label id="lblPageDesc" runat="server" /><!-- dynamic page description --> <br /><br /> <asp:Xml id="xslTransform_mc" runat="server"></asp:Xml><!-- dynamic XML/XSLT content --> <asp:contentplaceholder id="MainColumn" runat="server"> </asp:contentplaceholder><!-- link to code behind script(s) for specific page --> </div><!-- end screenmain_modules --> <!-- Footer --> <div id="screenfooter"> <hr class="navyblueline" /> <a href="">Help</a> | <a href="">Contact Us</a> | <a href="">Text-only Version</a> | <a href="">Printer-friendly Version</a> <br /> </div><!-- end screenfooter --> </div><!-- end wrapper --> </form></body></html> MasterPage.master.vb Partial Class MasterPage Inherits System.Web.UI.MasterPage Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs) 'Current date Dim dtCurrDate As DateTime = DateTime.Now 'Assign current date Dim strCurrDate As String = dtCurrDate.ToLongDateString 'format date lblCurrDate.Text = strCurrDate 'Assign date to label 'Pull page path Dim strPagePath = Request.ServerVariables("PATH_INFO") 'Assign full page path Dim strFullPagePath = "c:\Documents and Settings\MYUSERNAME\My Documents\Visual Studio 2005\Projects" & strPagePath 'TEMPORARY 'Assign path to FileInfo Class Dim fi As FileInfo = New FileInfo(strFullPagePath) Dim strPageId As String, strPathNoFileName As String Dim strXMLPath_mc As String, strXSLPath_mc As String, strCSSPath As String 'Check if files exist If Not fi.Exists Then strPageId = "default" strPathNoFileName = "http://localhost:1309/phase3" Else strPageId = fi.Name.Replace(fi.Extension, "") 'without extension strPathNoFileName = strPagePath.Replace(fi.Name, "") 'Assign dynamic page paths strXMLPath_mc = strPathNoFileName + "docs/xml/" & strPageId & ".xml" 'xml doc strXSLPath_mc = strPathNoFileName + "docs/xslt/" & strPageId & ".xsl" 'xsl doc strCSSPath = strPathNoFileName + "docs/css/" & strPageId & ".css" 'css doc End If 'Declare variables from XML nodes Dim page_id As String, page_title As String, sortby As String, sorttype As String, sortorder As String Dim short_description As String, long_description As String Dim meta_keywords As String, meta_description As String Dim leftcolumn As String, rightcolumn As String, css As String Dim strXMLPath_lc As String, strXSLPath_lc As String Dim strXMLPath_rc As String, strXSLPath_rc As String Dim objNodeExists As Object = False 'Load MainContent XML file internal_links.xml and assign page properties Dim il_xmld As XmlDocument Dim il_nodelist As XmlNodeList Dim il_node As XmlNode 'Create the XML Document il_xmld = New XmlDocument() 'Load the Xml file il_xmld.Load("http://SERVERNAME/docs/xml/internal_links.xml") 'Get the list of name nodes il_nodelist = il_xmld.SelectNodes("/internal_links/page[@id = '" & strPageId & "']") 'Loop through the nodes For Each il_node In il_nodelist 'Assign object if node is not empty objNodeExists = True 'Get an Attribute Value page_id = il_node.Attributes.GetNamedItem("id").Value 'Pull XML nodes page_title = il_node.Item("title").InnerText sortby = il_node.Item("sortby").InnerText sorttype = il_node.Item("sorttype").InnerText sortorder = il_node.Item("sortorder").InnerText short_description = il_node.Item("short_description").InnerText long_description = il_node.Item("long_description").InnerText meta_keywords = il_node.Item("meta_keywords").InnerText meta_description = il_node.Item("meta_description").InnerText css = il_node.Item("css").InnerText Next 'end loop 'Assign page-specific properties lblBrowserTitle.Text = SiteMap.CurrentNode.Title 'Page title label lblPageTitle.Text = SiteMap.CurrentNode.Title 'Page title label lblPageDesc.Text = SiteMap.CurrentNode.Description 'Page desc. label 'Assign maincolumn XML/XSLT transformation properties xslTransform_mc.DocumentSource = strXMLPath_mc xslTransform_mc.TransformSource = strXSLPath_mc End SubEnd Class 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" description="This is the home page."> <siteMapNode url="~/aboutus/aboutus.aspx" title="About Us" description="This page contains information about us." id="aboutus"> <siteMapNode url="~/aboutus/arealinks.aspx" title="Area Links" description="This page contains a list of several area links." id="arealinks" /> </siteMapNode> </siteMapNode></siteMap> aboutus.xml <?xml version="1.0" encoding="UTF-8"?><aboutus> <internal_links> <link>arealinks</link> </internal_links></aboutus> aboutus.xsl <?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:variable name="websitemap" select="document('c:\Documents and Settings\MYUSERNAME\My Documents\Visual Studio 2005\Projects\phase3\Web.sitemap')" /><xsl:include href="http://localhost:1309/phase3/aboutdc/docs/xslt/siteMap.xsl" /> <xsl:template match="/"> <div id="navigation"> <xsl:for-each select="$websitemap"> <xsl:apply-templates select="sm:siteMap" /><!-- displays all nodes in web.sitemap --> </xsl:for-each> </div> <div id="content"> <xsl:apply-templates/> </div> </xsl:template></xsl:stylesheet> HTML Output <!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"><head> <title>About Us</title> <link rel="stylesheet" type="text/css" media="screen" href="../docs/css/screen.css" /></head><body> <form name="aspnetForm" method="post" action="aboutus.aspx" id="aspnetForm"> <div> <input type="hidden" name="__VIEWSTATE" id="__VIEWSTATE" value="/wEPDwUJMTgxMjAzNjcwD2QWAmYPZBYEAgEPZBYCAgQPFgIeBGhyZWYFJC9waGFzZTMvYWJvdXRkYy9kb2NzL2Nzcy9hYm91dGRjLmNzc2QCAw9kFgYCCQ8PFgIeBFRleHQFFk1vbmRheSwgTWFyY2ggMTIsIDIwMDdkZAIhDw8WAh8BBRBBYm91dCB0aGUgQ291bnR5ZGQCJQ8PFgIfAQVFVGhpcyBwYWdlIGNvbnRhaW5zIGxpbmtzIHRvIGluZm9ybWF0aW9uIGFib3V0IERvdWdsYXMgQ291bnR5LCBLYW5zYXMuZGRk2g9UZR9pZEK1qBOQCwl68toMwa8=" /> </div> <div id="wrapper"> <div id="screenheader"> <div id="seal"> <img id="ctl00_Image1" src="../images/gif/seal.gif" style="border-width:0px;" /> </div><!-- end seal --> <div id="header"> <img id="ctl00_Image2" src="../images/gif/header.gif" style="border-width:0px;" /> </div><!-- end header --> <div id="graphic"> <img id="ctl00_Image4" src="../images/gif/graphic.gif" style="border-width:0px;" /> </div><!-- end graphic --> <div id="blueborder"> <div id="date_today"> <span id="ctl00_lblCurrDate">Monday, March 12, 2007</span> </div> <div id="header_links"> <a class="white" href="">Help</a> | <a class="white" href="">Contact Us</a> | <a class="white" href="">Text-only Version</a> | <a class="white" href="">Printer-friendly Version</a> </div><!-- end header_links --> </div><!-- end blueborder --> <div id="gradientline"> <img id="ctl00_Image5" src="../images/gif/gradientline.gif" style="border-width:0px;" /> </div><!-- end gradientline --> <!-- Tab navigation --> <div id="tabs"> <a href="http://localhost:1309/phase3/default.aspx"><img id="ctl00_Image7" src="../images/gif/tab1.gif" style="border-width:0px;" /></a> <a href="http://localhost:1309/phase3/aboutus/aboutus.aspx"><img id="ctl00_Image8" src="../images/gif/tab2.gif" style="border-width:0px;" /></a> </div><!-- end tabs --> </div><!-- end screenheader --> <!-- Dynamic MainColumn --> <div id="screenmain_modules"> <!-- dynamic page title --> <h1><span id="ctl00_lblPageTitle">About Us</span></h1> <br /> <span id="ctl00_SiteMapPath1"><a href="#ctl00_SiteMapPath1_SkipLink"><img alt="Skip Navigation Links" height="0" width="0" src="/phase3/WebResource.axd?d=AvErmV8chiUAyOw6Ne1jOA2&t=632996128439938112" style="border-width:0px;" /></a><span><a href="/phase3/default.aspx">Home Page</a></span><span> > </span><span>About Us</span><a id="ctl00_SiteMapPath1_SkipLink"></a></span> <br /> <hr class="navyblueline" /> <br /> <span id="ctl00_lblPageDesc">This page contains links to information about Douglas County, Kansas.</span> <br /><br /> <?xml version="1.0" encoding="utf-8"?> <div id="navigation"> <ul> <li><a id="default" href="~/default.aspx">Home Page<ul> <li><a id="aboutus" href="~/aboutus/aboutus.aspx" title="This page contains links to information about us.">About Us<ul> <li><a id="arealinks" href="~/aboutus/arealinks.aspx" title="This page contains a list of several area links for Douglas County, Kansas.">Area Links</a></li> </ul></a></li> </ul></a></li> </ul> </div> <div id="content"><!-- output from XML doc --> arealinks </div> </div><!-- end screenmain --> <!-- Footer --> <div id="screenfooter"> <hr class="navyblueline" /> <br /> <a href="">Help</a> | <a href="">Contact Us</a> | <a href="">Text-only Version</a> | <a href="">Printer-friendly Version</a> <br /> </div><!-- end screenfooter --> </div><!-- end wrapper --> </form></body></html>
  10. Well, I have some really good news. After messing around with the URI, I found a way to make it work. I had to change the path for the Web.sitemap doc from http://localhost:1309/phase3/Web.sitemap to c:\Documents and Settings\MYUSERNAME\My Documents\Visual Studio 2005\Projects\phase3\Web.sitemap. I guess since I'm testing this all out on my machine, I'll have to put the direct path to the file on my machine until it's launched. At that point, I should be able to use a regular URI, like http://www.mysite.com/Web.sitemap.So now that I have the sitemap file being pulled in, I'm next going to work at filtering a specific node from the sitemap using my custom "id" attribute. I'll post any such code when I get it done. Thanks for all of your help and patience. It's been a very eye-opening experience.
  11. I added the namespace back to aboutus.xsl, but no data appears on the transformed docs. Here's everything that I'm using so far...including the removal of your comment tags:)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 links to information about us." id="aboutus"> </siteMapNode></siteMap>[b]aboutus.xsl[/b][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 <?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"> <ul> <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> And here's the transformation using the ASP.NET Master Page method:MasterPage.master.vb: 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 docEnd Sub MasterPage.master: <%@ 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> I also tried transforming the two docs (aboutus.xml and aboutus.xsl) within a simple static ASP.NET doc, but it's still not showing any data. I added the siteMap.xsl code to the aboutus.xsl page directly, and temporarily removed the include to see if the issue was that it wasn't pulling the siteMap.xsl doc, but it didn't make a difference. And finally, I copied all of the pages to an internal test server to see if it was because it's using my machine's test server, but it made no difference. So I'm basically stuck as to why it's working for you and not me. Please let me know if you see anything that's obviously wrong (hopefully), and thanks for your help.
  12. Good morning boen_robot,Sorry that I didn't notice your comment about removing the slash from the document() function, but I just did so, and the error was gone. But no links or other data is being displayed. I also removed the namspace from aboutus.xsl just to make sure that our code was matching properly. So we're making progress. Obviously the data from the siteMap.xsl stylesheet is not being called from the aboutus.xsl doc, so if you could make sure that I'm calling everything properly on the aboutdc.xsl doc. that would be great. I think that we're almost there...hopefully:)To make sure that we're on the same page, this is what the 2 docs look like now after your suggested revisions:siteMap.xsl<?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"> <ul> <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> aboutus.xsl <?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"/><xsl:include href="siteMap.xsl"/><!-- this includes the file above --> <xsl:template match="/"><!-- this can of course be anything you'd like --> <div id="navigation"> <!--You can change the file's URI from here --> <xsl:for-each select="document('http://localhost:1309/phase3/Web.sitemap')"> <!-- if you want to use templates from the main file during the site map's generation, remove the select attribute --> <xsl:apply-templates select="sm:siteMap"/> </xsl:for-each> </div> <div id="content"> <xsl:apply-templates/> </div> </xsl:template></xsl:stylesheet>
  13. Well, I gave it a try by adding the namespace and adding the prefix to the stylesheet on siteMap.xsl doc, and by adding a prefix to the aboutus.xsl "apply-templates" call, like this:<xsl:apply-templates select="sm:siteMap"/>but I'm still receiving the same error message:Exception Details: System.Xml.XPath.XPathException: Expression must evaluate to a node-set.Since you were able to get it working, next I'm going to create a simple static XSLT transformation within a basic ASP.NET doc, and I'll let you know what happens. Thanks again.
  14. First off, thanks for all of your help boen_robot. It's really appreciated by me.Well, I created an XSLT doc titled siteMap.xsl with the following code: <?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"/> <xsl:template name="map" match="siteMap"> <ul> <xsl:apply-templates/> </ul> </xsl:template> <xsl:template match="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="siteMapNode"> <xsl:call-template name="map"/> </xsl:if> </a> </li> </xsl:template></xsl:stylesheet> ...and I then added the link to that doc inside of the XSLT doc that's calling it (aboutus.xsl), like this (without the HTML tags, since they're already called from the ASP.NET doc): <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:output method="xml" encoding="UTF-8" indent="yes"/> <xsl:include href="siteMap.xsl"/><!-- this includes the sample file that generates the list --> <xsl:template match="/"><!-- this can of course be anything you'd like --> <div id="navigation"> <!--You can change the file's URI from here --> <xsl:for-each select="document('http://localhost:1309/phase3/Web.sitemap')/"> <!-- if you want to use templates from the main file during the site map's generation, remove the select attribute below --> <xsl:apply-templates select="siteMap"/> </xsl:for-each> </div> <div id="content"> <xsl:apply-templates/> </div> </xsl:template></xsl:stylesheet> ...but I received this error message:Exception Details: System.Xml.XPath.XPathException: Expression must evaluate to a node-set.I checked, and it is pulling the correct file siteMap.xsl, but I'm still getting this error. At this point, I'm feeling very frustrated. Hopefully I'm making a stupid mistake that can easily be corrected.
×
×
  • Create New...