I am working on templating using XSLT Mediator and wrote custom function to get the ItemXML of Component because leagcy document function not provide category keyword info in generated xml.
public XPathNodeIterator GetItemxml(string tcmID)
{
XPathNodeIterator Xpathnav = null;
XPathNavigator navigator = null;
if (!String.IsNullOrEmpty(tcmID.Trim()) && TcmUri.IsValid(tcmID.Trim()))
{
IdentifiableObject itemObject = (IdentifiableObject)this.Engine.GetObject(tcmID.Trim());
//Get Additional Keyword Information
itemObject.Load(LoadFlags.KeywordXlinks);
if (itemObject != null)
{
navigator = itemObject.ToXml().CreateNavigator();
Xpathnav = navigator.Select("/");
}
}
else
{
XmlDocument doc = new XmlDocument();
navigator = doc.CreateNavigator();
Xpathnav = navigator.Select("*");
}
return Xpathnav;
}
I found that performace of my custom function is not good as default document function if I called custom function multiple time in one template.
Any idea why and how document function create component xml ?