Depending on what you're trying to do you can use either xsl:import or xsl:include. You can also use the umbraco.library:RenderMacro() extension to call a macro within a XSLT file.
Awe yes the old RenderMacro. I can't include because the XSLT search requires or adds properties. From my understanding I can't put properties in the import or include.
If I do do the RenderMacro and it has the multiple properties, how would I include the multiple properties.
I am going off of this example of using the RenderMacro in the XSLT file.
Argh yes, I forgot about the parameters that needs to be passed to xsltsearch. But can't you do the opposite? Include the other macro in the xsltSearch macro instead?
If not you should look into perhaps importing xslt search in your other xslt file. In order to do that you should remove the $currentpage from xslt search and then copy the elements within the xsl:template match="/" template into the xsl:template match="/" template in the xslt file wher you import xslt search. When that is done you should remove the xsl:template match="/" from the xslt search xslt file.
This is from the top of my head, so I'm not sure if it'll work or not but I think it's worth the try.
Thanks for the response. I am just going to use a work around in the template itself using the Node Factory and getting the doctype. Just writing an IF statement to add the macro to the page if it of a certain doctype. The whole thing with adding it to the XSLT just seems a bit too much work.
Looking forward to working with Razor soon so we can start to not run into issues with Macros inside XSLT. Kind of a pain.
You've probably already solved your problem, but for future reference - it is possible to include XSLTsearch within separate XSLT file - I wrote a blog post about this very thing a few days ago: http://leekelleher.com/2012/02/21/manipulate-xsltsearch/
How to put XSLT search inside of an XSLT file.
How would I go about adding the XSLTsearch Macro into an XSLT file? With all of the properties.
It should be easy I am sure, but I am drawing a blank.
Any help is greatly appreciated.
Hi Carlos
Depending on what you're trying to do you can use either xsl:import or xsl:include. You can also use the umbraco.library:RenderMacro() extension to call a macro within a XSLT file.
Hope this helps.
/Jan
Jan,
Awe yes the old RenderMacro. I can't include because the XSLT search requires or adds properties. From my understanding I can't put properties in the import or include.
If I do do the RenderMacro and it has the multiple properties, how would I include the multiple properties.
I am going off of this example of using the RenderMacro in the XSLT file.
http://our.umbraco.org/wiki/reference/umbracolibrary/rendermacrocontent
My macro for my XSLT with properties are as below
<umbraco:Macro Alias="XSLTsearch-TeacherPrograms" runat="server"
macroAlias="XSLTsearch-TeacherPrograms"
source="-1"
searchFields="gradeLevelRange,contentType,programTypeList"
previewFields="bodyText,metaDescription"
previewType="beginning"
searchBoxLocation="none"
resultsPerPage="5"
previewChars="255"
showPageRange="0"
showOrdinals="0"
showScores="0"
showStats="0">
</umbraco:Macro>
Help please???
This is what I did to get my Macro try to render in my XSLT
<xsl:value-of select="umbraco.library:RenderMacroContent('<?UMBRACO_MACRO Alias="XSLTsearch-TeacherPrograms"
macroAlias="XSLTsearch-TeacherPrograms"
source="-1"
searchFields="gradeLevelRange,contentType,programTypeList"
previewFields="bodyText,metaDescription"
previewType="beginning"
searchBoxLocation="none"
resultsPerPage="5"
previewChars="255"
showPageRange="0"
showOrdinals="0"
showScores="0"
showStats="0" >
</?UMBRACO_MACRO>')" />
However, it does not work because on the front end it is spitting out Error parsing XSLT file: \myFile.xslt
Any ideas?
Do I need runat server in the UMBRACO_MACRO? or does that even matter?
Hi Carlos
Argh yes, I forgot about the parameters that needs to be passed to xsltsearch. But can't you do the opposite? Include the other macro in the xsltSearch macro instead?
If not you should look into perhaps importing xslt search in your other xslt file. In order to do that you should remove the $currentpage from xslt search and then copy the elements within the xsl:template match="/" template into the xsl:template match="/" template in the xslt file wher you import xslt search. When that is done you should remove the xsl:template match="/" from the xslt search xslt file.
This is from the top of my head, so I'm not sure if it'll work or not but I think it's worth the try.
/Jan
Thanks for the response. I am just going to use a work around in the template itself using the Node Factory and getting the doctype. Just writing an IF statement to add the macro to the page if it of a certain doctype. The whole thing with adding it to the XSLT just seems a bit too much work.
Looking forward to working with Razor soon so we can start to not run into issues with Macros inside XSLT. Kind of a pain.
Thanks
Hi Carlos
Ah, yes that's probably a better solution in this case - indeed Razor has some benefits over XSLT and vice versa :)
/Jan
Hi Carlos,
Bumping up an old thread.
You've probably already solved your problem, but for future reference - it is possible to include XSLTsearch within separate XSLT file - I wrote a blog post about this very thing a few days ago: http://leekelleher.com/2012/02/21/manipulate-xsltsearch/
Cheers, Lee.
Thanks Lee,
I did figure out my issue. But your solution does help with anyone else trying to do the same thing.
I did mine a bit differently.
With 4.7.1 looks like and 5.0 coming out. XSLT search may see the way of the past. Razor is good and XSLT is good too. Both very powerful.
Trying to learn Razor has been a bit of a challenge since I am not used to any ASP.net. Mainly XHTML, HTML5 and XML. XSLT was easy to pick up.
But Razor is oh so much less code.
is working on a reply...