Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • aito 6 posts 26 karma points
    Mar 04, 2011 @ 01:48
    aito
    0

    How to reference XSLTsearch in my page

    I  can correctly installed the XSLTsearch,But I don't know How to reference XSLTsearch in my page,Who can give me a simple example?thank you very much

  • Douglas Robar 3558 posts 4556 karma points admin mvp c-trib
    Mar 04, 2011 @ 10:58
    Douglas Robar
    0

    All you need to do is browse to the http://localhost/searc.aspx page and XSLTsearch will work with its default settings. Customize the appearance and what is searched with the various macro parameters as described in the PDF documentation.

    cheers,
    doug.

  • aito 6 posts 26 karma points
    Mar 04, 2011 @ 14:30
    aito
    0

    Thanks Doug,

    when I am browse to the http://localhost/search.aspx page,

    it work a error "Cannot find ContentPlaceHolder 'RunwayMasterContentPlaceHolder' in the master page '/umbraco/masterpages/default.master', verify content control's ContentPlaceHolderID attribute in the content page."

  • Douglas Robar 3558 posts 4556 karma points admin mvp c-trib
    Mar 04, 2011 @ 14:46
    Douglas Robar
    0

    Ah. The error is caused because you don't have Runway installed.

    Open the XSLTsearch template in the umbraco admin interface. On the third line you'll see an <asp:Content ....> tag. The ContentPlaceHolderID= parameter needs to be updated to match a placeholder that your site has. Right now it is looking for a Runway-specific placeholder that you don't have.

    The easy way to get the right placeholder id is to position cursor on the empty line 2 and click the toolbar icon that looks like an empty box (near the right-hand side of the toolbar). This will bring up a dialog box with a dropdown list of all the placeholder id's that are valid. Probably you will only have one. Select the appropriate placeholder id. 

    You will now have an empty <asp:Content ...> </asp:Content> tag with the correct placeholder id. You'll also have your original <asp:Content ...> tag below it. 

    Leave the first/correct opening <asp:Content ...> tag and then delete the comment, closing </asp:Content> tag, and the original/incorrect <asp:Content ...> tag. 

    That should do it!

     

    If you have more questions about template please feel free to ask in the template section of the forum. I hope you enjoy XSLTsearch!

    cheers,
    doug.

  • aito 6 posts 26 karma points
    Mar 04, 2011 @ 14:53
    aito
    0

    Thanks Doug,

    I think I can do it

  • Garrett Fisher 341 posts 494 karma points
    Jul 17, 2012 @ 16:19
    Garrett Fisher
    0

    Hi Doug--

    I had the same error, followed your instructions, error went away.  New error: "Error parsing XSLT file: \xslt\XSLTsearch.xslt".  Nothing further.  Any ideas?  Seen this one?  This is a new installation.  Perhaps there is a conflict?

    Thanks,

    Garrett

  • Garrett Fisher 341 posts 494 karma points
    Jul 17, 2012 @ 16:21
    Garrett Fisher
    0

    When I try to save the XSLTSearch XSLT file in the UI I get:

    Error occured

    System.Xml.Xsl.XslTransformException: Cannot find a script or an extension object associated with namespace 'urn:PS.XSLTsearch'. at System.Xml.Xsl.Runtime.XmlQueryContext.InvokeXsltLateBoundFunction(String name, String namespaceUri, IList`1[] args) at startTime(XmlQueryRuntime {urn:schemas-microsoft-com:xslt-debug}runtime) at Execute(XmlQueryRuntime {urn:schemas-microsoft-com:xslt-debug}runtime) at System.Xml.Xsl.XmlILCommand.Execute(Object defaultDocument, XmlResolver dataSources, XsltArgumentList argumentList, XmlWriter writer) at System.Xml.Xsl.XslCompiledTransform.Transform(IXPathNavigable input, XsltArgumentList arguments, TextWriter results) at umbraco.presentation.webservices.codeEditorSave.SaveXslt(String fileName, String oldName, String fileContents, Boolean ignoreDebugging)

  • Douglas Robar 3558 posts 4556 karma points admin mvp c-trib
    Jul 17, 2012 @ 18:26
    Douglas Robar
    0

    Hi, Garrett,

    The problem is most likely because the /app_code/xsltsearch.cs file is either: 

    A) missing

    B) can't be read by the application pool identity

     

    If missing, you can either re-install the XSLTsearch package, or open the xsltesarch package zip file manually and copy the xsltsearch.cs file to the site's /app_code folder.

    If the .cs file is there then you'll want to double-check the file permissions on the file and app_code folder to be sure that the site's application pool identity can read the .cs file.

     

    The last option of what might go wrong is that the site's application pool identity can't create, read, update, and delete from the ASP.NET temporary folder, which is where the compiled version of the .cs file will get put. You'll want to double-check the file permissions on the asp.net temporary folder, which will typically be located at C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files. (or whatever version of .net your site is running if not v2.0.xxxx).

     

    Let us know how you get on.

    cheers,
    doug. 

  • Garrett Fisher 341 posts 494 karma points
    Jul 17, 2012 @ 21:08
    Garrett Fisher
    0

    Well, the *.cs file was not in fact there in /App_Code for whatever reason.  I added it there from teh original package.  Permissions are correct.  Here is the error I am getting now:

    http://31.222.157.191/search.aspx

    By the way, assumign we get this error fixed, I have CWS installed and I'd like to replace that search with XSLT search since it's more powerful.  How would I go about that?

    Thanks,

    Garrett

  • Douglas Robar 3558 posts 4556 karma points admin mvp c-trib
    Jul 19, 2012 @ 11:15
    Douglas Robar
    0

    Once you have XSLTsearch running on the /search.aspx page you'll only need to change the <form action="/search.aspx" ...> tag in the template to send search queries to the XSLTsearch page instead of the builtin cws search page.

    cheers,
    doug. 

  • Garrett Fisher 341 posts 494 karma points
    Jul 19, 2012 @ 20:21
    Garrett Fisher
    0

    Thanks again Doug.  I've placed the following code into my Master template:

    <umbraco:Macro runat="server" Alias="XSLTsearch"
                          macroAlias="XSLTsearch"
                          source="-1"
                          searchFields="@nodeName,metaKeywords,metaDescription,bodyText"
                          previewFields="bodyText,metaDescription"
                          previewType="beginning"
                          searchBoxLocation="bottom"
                          resultsPerPage="5"
                          previewChars="255"
                          showPageRange="0"
                          showOrdinals="0"
                          showScores="0"
                          showStats="1">
    </umbraco:Macro>

    And it doesn't create a form tag so the (non-)form doesn't submit.  Here is the HTML the Macro puts out:

    <div class="xsltsearch_form">
    <input name="search" type="text" class="input" value="">&nbsp;
    <input type="submit" class="submit" value="Search">
    </div>

    That's it.  Where's the form?  What am I doing wrong here?

    Thanks,

    Garrett

     

     

  • Douglas Robar 3558 posts 4556 karma points admin mvp c-trib
    Jul 20, 2012 @ 16:52
    Douglas Robar
    0

    Hi, Garrett,

    You don't want to put the full XSLTsearch macro on the your master template. You only want the macro on the search page itself (typically the /search.aspx page)

    In the html markup of your banner, that's where you would manually code the <form> tag and create the search text box, something like the below. Or keep the original html markup from the cws site and only change the action="" parameter in the form tag and be sure the name of the intput box is "search" as that's the parameter XSLTsearch will be looking for.

    <form action="/search.aspx"><input name="search" type="text" /><input type="submit" value="Search"/></form>

    cheers,
    doug. 

  • Garrett Fisher 341 posts 494 karma points
    Jul 23, 2012 @ 17:41
    Garrett Fisher
    0

    Huh, ok.  I've now performed those changes and this is the exception I'm getting in my event log:

    Cannot find ContentPlaceHolder 'RunwayMasterContentPlaceHolder' in the master page '/umbraco/masterpages/default.master'

    I don't have Runway as it is actually no longer offered during the Umbracio install, so I know this is why I am getting the error; trouble is that I'm not sure what to replace this reference with.   Truthfully, I don't have a very good understanding of what ContentPlaceHolders are.  For example, if I remove this one:

    <asp:ContentPlaceHolder Id="headerLinksContent" runat="server" />

    My whole site breaks -- and I don't even know what the "headerLinks" even are. 

    Thanks again,

    Garrett

  • Douglas Robar 3558 posts 4556 karma points admin mvp c-trib
    Jul 23, 2012 @ 18:53
    Douglas Robar
    0

    Hi, Garrett,

    I figured the easiest way to explain this was make a blog post. Check it out. You should be going in no time.

    http://blog.percipientstudios.com/2012/7/23/using-xsltsearch-with-cws.aspx

    cheers,
    doug. 

  • Garrett Fisher 341 posts 494 karma points
    Jul 23, 2012 @ 20:52
    Garrett Fisher
    0

    I really appreciate your attention on this Doug -- followed your instructions on the blog post but I'm still getting the same error:

    Cannot find ContentPlaceHolder 'RunwayMasterContentPlaceHolder' in the master page '/umbraco/masterpages/default.master', verify content control's ContentPlaceHolderID attribute in the content page.

    Do I simply add this ContentPlaceHolder on default.master?  I don't think I should have to edit a core template, should I?

  • Garrett Fisher 341 posts 494 karma points
    Jul 23, 2012 @ 21:02
    Garrett Fisher
    0

    Actually, now that i have deleted the XSLT template, the search page in the Content seciton, and the XSLT doctype as indicated, I amsimply getting:

    An error occurred while processing your request.

    And nothing in the log, unfortunately.  Here is my Search (only called with template alias) template:

    <%@ Master Language="C#" MasterPageFile="~/masterpages/CWS_Master.master" AutoEventWireup="true" %>

    <asp:content ContentPlaceHolderId="headerLinksContent" runat="server">  
    </asp:content>

    <asp:content ContentPlaceHolderId="SideBarContent" runat="server">  
    </asp:content>

    <asp:content ContentPlaceHolderId="ChildContent" runat="server">
        <div id="main" class="content oneCol left clearfix" role="main">
          <!-- <umbraco:Macro runat="server" Alias="CWS_ExamineSearch" /> -->
          <umbraco:Macro runat="server" Alias="XSLTsearch"
            macroAlias="XSLTsearch"
            source="-1"
            searchFields="@nodeName,metaKeywords,metaDescription,bodyText"
            previewFields="bodyText,metaDescription"
            previewType="beginning"
            searchBoxLocation="none"
            resultsPerPage="5"
            previewChars="255"
            showPageRange="0"
            showOrdinals="0"
            showScores="0"
            showStats="1">
          </umbraco:Macro>
      </div>
    </asp:content>

    However, I can't help but notice that this template has an alias of CWS_Search, which seems suspect.  Seems like I should be changing either the alias of this template to "search," OR changing the action on the form tag to CWS_Search.aspx, no?  I think your directions are for people who didn't already change out the form action....

    A very sincere thanks once again,

    Garrett

  • Garrett Fisher 341 posts 494 karma points
    Jul 23, 2012 @ 21:16
    Garrett Fisher
    0

    Got it working by changing the template alias -- however I am using the Razor sitemap macro on my Master template and although it works / looks great on every other template I am getting a Macro Engine error on the search results page ("Error loading MacroEngine script (file: )".  Does this indicate some sort of conflict? 

    <umbraco:Macro runat="server" language="cshtml">
                @inherits umbraco.MacroEngines.DynamicNodeContext
                
                @helper traverse(dynamic node) {
                  var maxLevelForSitemap = String.IsNullOrEmpty(Parameter.MaxLevelForSitemap) ? 3 : int.Parse(Parameter.MaxLevelForSitemap);
                
                  var values = new Dictionary<string,object>();
                  values.Add("maxLevelForSitemap", maxLevelForSitemap);
                
                  @* var items = node.Children.Where("Visible").Where("Level <= maxLevelForSitemap", values); *@
                  var items = node.Children.Where("Level <= maxLevelForSitemap", values);
                  var classextender = "";
                
                  if (items.Count() > 0) {
                <ul id="sitemap">
                    @foreach (var item in items) {
                    if (@Model.AncestorOrSelf(2).Id == @item.Id) {
                        classextender = "current";
                    }
                    <li>
                      <a class="@classextender" href="@item.Url">@item.Name</a>
                      @traverse(item)
                  
                    </li>
                    }
                </ul>
                  }
                }
                    <div class="sitemap">
                        @traverse(@Model.AncestorOrSelf())
                    </div>
                
                
                </umbraco:Macro>

    Nothing jumps out at me here so I thought I'd float it past the Umbraco guru.

    //Garrett

  • Douglas Robar 3558 posts 4556 karma points admin mvp c-trib
    Jul 24, 2012 @ 10:53
    Douglas Robar
    0

    Hi, Garrett,

    Something is out of sync here somewhere with all our gyrations and attempts, with a mix of the original exame search and xsltsearch. Any chance you would give me an admin login to your site and I can probably fix it up in much less time than guessing about the situation. I'm pretty sure it's just a few tidbits here and there that aren't lining up rather than something serious. But seeing it first hand would be helpful.

    Rather than posting the login info on the forum, can you drop me a note through my website at http://www.percipientstudios.com/about/contact.aspx

    cheers,
    doug. 

  • Garrett Fisher 341 posts 494 karma points
    Jul 25, 2012 @ 17:00
    Garrett Fisher
    0

    I got it fixed, Doug.  All I need to do was to change the Search (only called with template alias) alias to search!  Also, I ditched the Razor sitemap because it was too difficult to treat the different levels of navigation differently.  Thanks again for all your repsonses on this -- I'm sure we'll talk again soon!

    //Garrett

  • Douglas Robar 3558 posts 4556 karma points admin mvp c-trib
    Jul 25, 2012 @ 18:21
    Douglas Robar
    0

    Congratulations and well done!!

    I know it's been a frustrating and sometimes confusing journey but I hope that some things have become clearer -- how macros work, how templates work, etc. and so not completely wasted.

    cheers,
    doug. 

  • Garrett Fisher 341 posts 494 karma points
    Jul 25, 2012 @ 18:28
    Garrett Fisher
    0

    Not in the slightest, Mr. Robar.  This is my third Umbraco implementation but the last one was over a year ago so I'm a little rusty ;)  Hey -- any ideas on how you would approach a customizable Sidebar?  Something where you've got a Document Type called SidebarElement, for example, and you would associate these with many pages on an individual basis?  Maybe create a datatype using an xPath CheckBoxList to select the elements and then you would check the boxes on each page for which ones you want to show up?  And then the XSLT macro would use Relations / GetRelatedNodesAsXml() to show them?

    The only thing I've find with a similar goal in mind uses a usercontrol and I'm not sure I'm ready for / have time for that.

    Thoughts?

    //Garrett

  • Douglas Robar 3558 posts 4556 karma points admin mvp c-trib
    Jul 25, 2012 @ 18:38
    Douglas Robar
    0

    Excellent!

    There are a couple ways to do what you want (a few packages as well). But this is outside the scope of the original post and where it should be made (the question isn't about an XSLTsearch bug). Do post it again in the proper place and you'll get more people seeing it and offering suggestions.

    cheers,
    doug. 

Please Sign in or register to post replies

Write your reply to:

Draft