I want to create a custom XML editor that can offer templates or content assists based on the current XPath.
Creating templates using the extension point org.eclipse.ui.editors.templates
makes it available to the entire context type, which is a bit too simple.
When googling I get links to oXygen who can handle this, i.e:
...XPath aware content assistant showing functions and axes (all documented with sections from the W3C specification), variables and parameters as well as name tests for elements and attributes in context.
I am guessing i'll need to use the WTP XML editor?
Need to use the WTP XML? Editor? I don't understand what you mean, given the option you've researched. <oXygen/> is fully-functioned XML editor, either standalone or as an Eclipse plugin; it costs a bit of money ($300+) per license, but if you can afford it, go ahead and use it. It's got the XPath support you're looking for.
I've used it before and was very happy with it.
You can. When the WTP XML Editor's contributions to the org.eclipse.wst.sse.ui.completionProposal
extension point are invoked, they look up the relevant DOM Node and text location and figure out what to propose. There's no artificial limitation on contributing more "computers". You can see how it's done against the DTD of XML Schema grammar using org.eclipse.wst.xml.ui.internal.contentassist.AbstractXMLCompletionProposalComputer#computeCompletionProposals(CompletionProposalInvocationContext, IProgressMonitor)
or from the XML content assist templates that ship in the XML UI plug-in using org.eclipse.wst.xml.ui.internal.contentassist.XMLTemplatesCompletionProposalComputer#computeCompletionProposals(CompletionProposalInvocationContext, IProgressMonitor)
.