Yep, well that was just a typo when I wrote the post. It's there IRL :-) The XSLT in it self should be ok, tag wise.
Debug:
Error parsing XSLT System.Xml.Xsl.XslCompiledTransform
To use a result tree fragment in a path expression, first convert it to a node-set using the msxsl:node-set() function.
at System.Xml.Xsl.Runtime.XsltConvert.EnsureNodeSet(IList`1 listItems)
My guess is that you are trying to iterate $possibleNodes later on.
Try using copy-of instead of value-of in the xsl:choose. You might also have to use msxsl:node-set() around the variable when you iterate it, like this: msxsl:node-set($possibleNodes). Then you also need to add a reference to msxsl at the top of the xslt file (see how it done for msxml and copy that line and change it to msxsl), and also add it to the exclude prefix row.
Check the docs for xsltsearch for more details, but the idea is to set the starting or 'source' node when you insert the xsltsearch macro. By default it uses "-1" unless you specify a start node, and -1 means "everything in the content tree". In your case, you would set the start node in the macro's parameters to the id of the 'site4' node.
In fact, you can create a search page for each of your sites (/site1/search.aspx, /site2/search.aspx, etc.) and restrict the search results to only the nodes within each site by setting the appropriate source node for each search page.
The macro looks something like this:
macroAlias="XSLTSearch" source="1041" <<<<the id of the starting node to search beneath searchFields="metaKeywords,metaDescription,bodyText,sideText" previewFields="bodyText,sideText,metaDescription" searchBoxLocation="NONE" previewType="BEGINNING" resultsPerPage="5" previewChars="255" showPageRange="1" showOrdinals="0" showScores="0" showStats="1"
XSLTsearch hack
Im trying to make a simple hack i XSLTsearch.
I just want to change the variable possibleNodes to be conditional, but how.
Original
[code]
[/code]
I tried the following - dosent work, how can I get this to work ?
[code][/code]
I think there is a missing ] at the end of both select queries in the latter example.
Hi Daniel,
Yep, well that was just a typo when I wrote the post. It's there IRL :-) The XSLT in it self should be ok, tag wise.
Debug:
Error parsing XSLT System.Xml.Xsl.XslCompiledTransform
To use a result tree fragment in a path expression, first convert it to a node-set using the msxsl:node-set() function.
at System.Xml.Xsl.Runtime.XsltConvert.EnsureNodeSet(IList`1 listItems)
My guess is that you are trying to iterate $possibleNodes later on.
Try using copy-of instead of value-of in the xsl:choose. You might also have to use msxsl:node-set() around the variable when you iterate it, like this: msxsl:node-set($possibleNodes). Then you also need to add a reference to msxsl at the top of the xslt file (see how it done for msxml and copy that line and change it to msxsl), and also add it to the exclude prefix row.
Thanks, you right $possibleNodes is iterated later on. Ill try to use node-set, sounds right.
I wrote a blog post on modifying XSLTsearch that should explain what to do.
http://blog.percipientstudios.com/2009/4/7/customizing-xsltsearch.aspx
cheers,
doug.
How can I restrict xsltsearch to a certain level?
I have this currently in my system:
-site1
-site2
-site3
-site4 --> in this site I want xsltsearch, but right now it searches all of the content (including site1-3).
Check the docs for xsltsearch for more details, but the idea is to set the starting or 'source' node when you insert the xsltsearch macro. By default it uses "-1" unless you specify a start node, and -1 means "everything in the content tree". In your case, you would set the start node in the macro's parameters to the id of the 'site4' node.
In fact, you can create a search page for each of your sites (/site1/search.aspx, /site2/search.aspx, etc.) and restrict the search results to only the nodes within each site by setting the appropriate source node for each search page.
The macro looks something like this:
macroAlias="XSLTSearch"
source="1041" <<<<the id of the starting node to search beneath
searchFields="metaKeywords,metaDescription,bodyText,sideText"
previewFields="bodyText,sideText,metaDescription"
searchBoxLocation="NONE"
previewType="BEGINNING"
resultsPerPage="5"
previewChars="255"
showPageRange="1"
showOrdinals="0"
showScores="0"
showStats="1"
cheers,
doug.
Thanks doug. I knew it should be easy. Great piece of functionality you provided!
is working on a reply...