I have a very generic "GetItemXml" template building block that basically reads the current item being rendered and outputs the item's xml to the delivery tier.

Component component = (Component)engine.GetObject(package.GetByName(Package.ComponentName));
output = package.CreateXmlDocumentItem(
           ContentType.Xml,component.ToXml(XmlFormat.R6Native, XmlSections.All)

This outputs the xml correctly, but keyword fields are output like this:


Is there any way - short of controlling the XML output myself - to ask Tridion to include additional information in the XML like an xlink:href to the keyword ID?

  • This answer from @KahTang on StackOverlow is nice as well, though. Then you can use it in your Dreamweaver or xslt Templating as well. Feb 21, 2013 at 15:36

1 Answer 1


You just need to Load component with proper LoadFlags, like this:

Component component = (Component)engine.GetObject(package.GetByName(Package.ComponentName));
output = package.CreateXmlDocumentItem(
    ContentType.Xml,component.ToXml(XmlFormat.R6Native, XmlSections.All).OwnerDocument);

It will look like this:

<keyword xlink:href="tcm:2-83-1024" xlink:title="b" 

See Coreservice and ReadOptions for more info about LoadFlags

  • Awesome answer - Really wish I had know this when we built the XSLT Mediator for R5.3 Feb 21, 2013 at 12:22
  • 3
    What? Why is this not in any manual? This has been an issue since R5.3, and people have been coming up with crazy stuff to get this information... Feb 21, 2013 at 12:52
  • Awesome. I now get <ContentCategory xlink:href="tcm:5-239-1024" xmlns:xlink="w3.org/1999/xlink" xlink:title="tridion 2011">tridion 2011</ContentCategory>
    – Nuno Linhares
    Feb 21, 2013 at 13:55
  • 2
    Something about Tridion Nuno didn't know. I'm shocked! Feb 21, 2013 at 14:02
  • @user978511, you should update this Stackoverflow question as well, Or redirect it to this answer when the site goes live! Feb 21, 2013 at 15:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.