Creating $ask with answer from a previous $ask
Oxygen general issues.
Creating $ask with answer from a previous $ask
I'm creating a template where I ask for a product name that will be reused with an ID of name:
${answer(@name)}
I want to reuse the key as part of another ask. I set up this ask with radio buttons for two different possible sentences that can be inserted, depending on the option that the writer picks. The name needs to be reused in both sentences. This is the $ask I've set up:
${ask('How is the product activated?', radio, (
'<p>${answer(@name)} is active by default.</p>'
:'It is active by default';
'<p>${answer(@name)} must be enabled with a plugin.</p>'
:'It must be activated with a plugin'))}
With the $answer variable, the dialog box for this $ask doesn't render properly. The dialog box displays with Cancel and OK buttons, instead of radio buttons with the answers I've listed above.
${answer(@name)}
I want to reuse the key as part of another ask. I set up this ask with radio buttons for two different possible sentences that can be inserted, depending on the option that the writer picks. The name needs to be reused in both sentences. This is the $ask I've set up:
${ask('How is the product activated?', radio, (
'<p>${answer(@name)} is active by default.</p>'
:'It is active by default';
'<p>${answer(@name)} must be enabled with a plugin.</p>'
:'It must be activated with a plugin'))}
With the $answer variable, the dialog box for this $ask doesn't render properly. The dialog box displays with Cancel and OK buttons, instead of radio buttons with the answers I've listed above.
-
- Posts: 1009
- Joined: Wed Nov 16, 2005 11:11 am
Re: Creating $ask with answer from a previous $ask
Post by alex_jitianu »
Hello,
What Oxygen version are you using? In version 21.1 we introduced an improved version of the engine that expands editor variables. In version 21.1, a document template content like this expands correctly:
The only requirement is for the @name ask to appear first in the document template.
Best regards,
Alex
What Oxygen version are you using? In version 21.1 we introduced an improved version of the engine that expands editor variables. In version 21.1, a document template content like this expands correctly:
Code: Select all
${ask('message', generic, 'default_value', @name)}
======
${ask('How is the product activated?', radio, (
'<p>${answer(@name)} is active by default.</p>'
:'It is active by default';
'<p>${answer(@name)} must be enabled with a plugin.</p>'
:'It must be activated with a plugin'))}
Best regards,
Alex
-
- Posts: 1009
- Joined: Wed Nov 16, 2005 11:11 am
Re: Creating $ask with answer from a previous $ask
Post by alex_jitianu »
Hi,
For version 20.1, you could create an Oxygen plugin for such an use case. You would have to define custom variables and use them inside the template. Afterwards, from the plugin, you can add an EditorVariablesResolver that looks in the content for the variables and knows what to ask the user and how to combine the responses.
The sample-plugin-workspace-access is a good starting point. You add that resolver like this:
Best regards,
Alex
For version 20.1, you could create an Oxygen plugin for such an use case. You would have to define custom variables and use them inside the template. Afterwards, from the plugin, you can add an EditorVariablesResolver that looks in the content for the variables and knows what to ask the user and how to combine the responses.
The sample-plugin-workspace-access is a good starting point. You add that resolver like this:
Code: Select all
/**
* @see ro.sync.exml.plugin.workspace.WorkspaceAccessPluginExtension#applicationStarted(ro.sync.exml.workspace.api.standalone.StandalonePluginWorkspace)
*/
@Override
public void applicationStarted(final StandalonePluginWorkspace pluginWorkspaceAccess) {
pluginWorkspaceAccess.getUtilAccess().addCustomEditorVariablesResolver(new EditorVariablesResolver() {
@Override
public String resolveEditorVariables(String contentWithEditorVariables, String currentEditedFileURL) {
// TODO Replace variables
return super.resolveEditorVariables(contentWithEditorVariables, currentEditedFileURL);
}
});
Alex
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