Sure! But why would you want to? It would need to follow the xml schema that Umbraco uses (compare with the site's ~/app_data/umbraco.config file).
Assuming you have an xml file that follows the correct schema then you'd load the xml file into the $source variable rather than getting it directly from Umbraco.
The easy way to do that would be to make sure the external xml file were downloadable via some url (either on your site or someone else's) and use the umbraco.library:GetXmlDocumentByUrl() and pass in the url to the xml file you want to load. Or you could try to use <xsl:import> if the file is local.
<?xml version="1.0" encoding="UTF-8"?>
<pages>
<page link="http://www.entitledto.co.uk/help/benefitscharity.aspx" id="benefitscharity">
<title> Income from voluntary or charity sources</title><content> Income from voluntary or charity sources</content>
</page>
<page link="http://www.entitledto.co.uk/help/accessibilitystatement.aspx" id="accessibilitystatement"><title>Accessibility Statement</title>
<content>Accessibility Statement</content>
</page>
That's possible, but you'd need to change the xpath throughout XSLTsearch.xslt to use your schema. Though if you really only have a <title> and <content> element it would also be considerably simplified from what is needed for Umbraco content. You'd also need to update the results display to use the page link="" for the urls in the results.
Definitely possible but not a trivial change. The benefit of course is you keep all the logic about ranking results, searching for terms, paged results, etc etc.
I suppose it depends on how the external xml file is generated an if it's easy to change its schema. Not sure how you'd handle the external links conveniently tho; there is no equivalent property in the umbraco schema. So that would be an update to the one or two places I use umbraco.library:NiceUrl() in the xsltsearch.xslt file.
If you're not overly strong with xslt then modifying xsltsearch.xslt may be quite a lot of effort. It is well-commented but even so it is a rather involved bit of xslt.
Search in external xml file
Hi,
Could XSLTSearch do search in the external xml file?
Thanks,
Alex
Hi, Alex,
Sure! But why would you want to? It would need to follow the xml schema that Umbraco uses (compare with the site's ~/app_data/umbraco.config file).
Assuming you have an xml file that follows the correct schema then you'd load the xml file into the $source variable rather than getting it directly from Umbraco.
The easy way to do that would be to make sure the external xml file were downloadable via some url (either on your site or someone else's) and use the umbraco.library:GetXmlDocumentByUrl() and pass in the url to the xml file you want to load. Or you could try to use <xsl:import> if the file is local.
cheers,
doug.
Hi Douglas,
We have xml file in such format:
It is from our other site.
We want to create search for this content.
Thanks,
Alex
That's possible, but you'd need to change the xpath throughout XSLTsearch.xslt to use your schema. Though if you really only have a <title> and <content> element it would also be considerably simplified from what is needed for Umbraco content. You'd also need to update the results display to use the page link="" for the urls in the results.
Definitely possible but not a trivial change. The benefit of course is you keep all the logic about ranking results, searching for terms, paged results, etc etc.
Let me know how you get on with the project.
cheers,
doug.
Do you think to change external xml file format is faster way to do this ?
I'm not very strong in xslt )
THanks,
Alex
I suppose it depends on how the external xml file is generated an if it's easy to change its schema. Not sure how you'd handle the external links conveniently tho; there is no equivalent property in the umbraco schema. So that would be an update to the one or two places I use umbraco.library:NiceUrl() in the xsltsearch.xslt file.
If you're not overly strong with xslt then modifying xsltsearch.xslt may be quite a lot of effort. It is well-commented but even so it is a rather involved bit of xslt.
cheers,
doug.
is working on a reply...