Just a quick tip for all you xslt cowboys. I am currently
working on an existing Umbraco installation. This site utilises
webservices that return datasets. The display of data has
been done using .net usercontrols that make calls to the
webservices, unfortunately for me alot of the layout has been done
with codebehinds and stringbuilder.
The client wanted new subsites with different layout, so rather
than hacking around with the existing usercontrols I decided to use
xslt macros instead this gives me greater flexilbity to customise
layout without having to also rebuild and deploy dlls.
As all you umbraco gurus know to use custom third party data in
umbraco xslts you need to write xslt extensions and provided your
method returns XPathNodeIterator it will all work.
So at first I was going to just create a method that got the
dataset from the webservice then read that into and xml document
then return XPathNodeIterator from the xml document. However
I did a quick google and found DataSetNavigator so instead I created an
extension method that looks like
public static XPathNodeIterator CreateNavigatorOnDataSet(this
DataSet ds)
{
var nav = new DataSetNavigator(ds);
return nav.CreateNavigator().Select("/");
}
and my xslt extension method looks like
public static XPathNodeIterator GetPracticePeopleXml()
{
DataSet people = WebHelper.GetPracticePeople();
return people.CreateNavigatorOnDataSet();
}