Determine if opened file was just created from a custom template
Posted: Mon Feb 20, 2023 8:59 pm
We'd like to know if the current editor document in Author mode was just created from one of our custom DITA templates and hasn't been touched by anyone so we can apply some custom logic to generate some initial content based on a live lookup that cannot be accomplished with a custom editor variable.
One thought is to include a processing instruction in the template topic that we can detect through when a DITA topic is opened by Oxygen's New action, insert our generated content, and then remove the processing instruction so that it's no longer applied when the file is next opened.
Is there a better way to determine if a file that was just opened was created from one of our templates?
I noticed that the XML Refactoring operation for deleting processing instructions will only remove it if it's within the topic's root element and not before. Is this a restriction throughout the SDK, or is there a method that could detect and delete a specific processing instruction before the root topic declaration?
One thought is to include a processing instruction in the template topic that we can detect through when a DITA topic is opened by Oxygen's New action, insert our generated content, and then remove the processing instruction so that it's no longer applied when the file is next opened.
Is there a better way to determine if a file that was just opened was created from one of our templates?
I noticed that the XML Refactoring operation for deleting processing instructions will only remove it if it's within the topic's root element and not before. Is this a restriction throughout the SDK, or is there a method that could detect and delete a specific processing instruction before the root topic declaration?