XSLTOperation replacing the root element not working
Post here questions and problems related to oXygen frameworks/document types.
-
- Posts: 280
- Joined: Thu Nov 28, 2013 9:32 am
- Location: Hamburg/Germany
- Contact:
XSLTOperation replacing the root element not working
Hi,
I want to apply an XSLTOperation on the root element replacing the previous one. I don't get any error messages but the content is not being replaced.
I guess there is a special behavior required in TransformOperation for the case that the root node needs to be replaced instead of the following lines:
Is there any easy way I can fix this behavior?
Thanks and regards,
Patrik
I want to apply an XSLTOperation on the root element replacing the previous one. I don't get any error messages but the content is not being replaced.
I guess there is a special behavior required in TransformOperation for the case that the root node needs to be replaced instead of the following lines:
Code: Select all
// Put the result of the XSLT transformation back into the document.
if (ACTION_REPLACE.equals(action)) {
authorAccess.getDocumentController().insertXMLFragment(result, targetNode, ACTION_INSERT_BEFORE);
authorAccess.getDocumentController().deleteNode(targetNode);
} else [...]
Thanks and regards,
Patrik
-
- Posts: 1016
- Joined: Wed Nov 16, 2005 11:11 am
Re: XSLTOperation replacing the root element not working
Post by alex_jitianu »
Hi Patrik,
Right now the only way to fix this behavior is to create your own custom XSLTOperation. You should start from the source code of the default operation and replace the code you indicated with something like this:
We will make the same change ourselves so the fix will be available in the next release.
Best regards,
Alex
Right now the only way to fix this behavior is to create your own custom XSLTOperation. You should start from the source code of the default operation and replace the code you indicated with something like this:
Code: Select all
// Put the result of the XSLT transformation back into the document.
if (ACTION_REPLACE.equals(action)) {
if (targetNode.getParent().getType() == AuthorNode.NODE_TYPE_DOCUMENT) {
AuthorDocumentFragment authorFragment = authorAccess.getDocumentController().createNewDocumentFragmentInContext(
result,
targetNode.getStartOffset());
// Root replace.
authorAccess.getDocumentController().replaceRoot(authorFragment);
} else {
authorAccess.getDocumentController().insertXMLFragment(
result, targetNode, ACTION_INSERT_BEFORE);
authorAccess.getDocumentController().deleteNode(targetNode);
}
}
Best regards,
Alex
-
- Posts: 280
- Joined: Thu Nov 28, 2013 9:32 am
- Location: Hamburg/Germany
- Contact:
Re: XSLTOperation replacing the root element not working
Hi Alex,
thanks alot - it worked on the first try. :)
Regards,
Patrik
thanks alot - it worked on the first try. :)
Regards,
Patrik
Return to “SDK-API, Frameworks - Document Types”
Jump to
- Oxygen XML Editor/Author/Developer
- ↳ Feature Request
- ↳ Common Problems
- ↳ DITA (Editing and Publishing DITA Content)
- ↳ SDK-API, Frameworks - Document Types
- ↳ DocBook
- ↳ TEI
- ↳ XHTML
- ↳ Other Issues
- Oxygen XML Web Author
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Content Fusion
- ↳ Feature Request
- ↳ Common Problems
- Oxygen JSON Editor
- ↳ Feature Request
- ↳ Common Problems
- Oxygen PDF Chemistry
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Feedback
- ↳ Feature Request
- ↳ Common Problems
- Oxygen XML WebHelp
- ↳ Feature Request
- ↳ Common Problems
- XML
- ↳ General XML Questions
- ↳ XSLT and FOP
- ↳ XML Schemas
- ↳ XQuery
- NVDL
- ↳ General NVDL Issues
- ↳ oNVDL Related Issues
- XML Services Market
- ↳ Offer a Service