This topic lists the default operations for the Author mode.
This operation allows you to add/modify/remove an attribute. You can use this operation in your own custom Author mode action to modify the value for a certain attribute on a specific XML element. The arguments of the operation are:
true and false. True means
that the attribute should be removed if an empty value is provided. The default
behavior is to remove it.This operation allows you to add/modify/remove multiple attributes. You can use this operation in your own custom Author mode action to modify the value for one or more attributes for one or more XML elements. The arguments of the operation are:
\n). The values can be local names or Clark
notations.\n). An empty value will remove the attribute if
removeIfEmpty is set to true.true (default) and false.
True means that the attribute will be removed if an empty value is
provided.Operation that sets a list of pseudo-class values to nodes identified by an XPath expression. It can also remove a list of values from nodes identified by an XPath expression. The operation accepts the following parameters:
yes and no. If set to
yes, comments, CDATA, and text nodes are included when evaluating
XPath expressions. If set to no, they are ignored.Deletes the node indicated by the elementLocation parameter XPath
expression. If missing, the operation will delete the node at the cursor location.
Deletes the nodes indicated by the elementLocations parameter XPath
expression. If missing, the operation will delete the node at the cursor location.
This operation allows you to start a process executing a given command line. It has the following arguments:
"." (current directory).true, the console panel will be displayed in Oxygen XML Author Eclipse plugin. The default value is false.true, the command line will wait for the operation to
finish. The default value is false.It supports the following arguments:
The name of the transformation scenario to execute.
Provided parameters for the transformation scenario. The
parameters are inserted as name=value pairs separated by line
breaks. The set parameters are taken into account for XSLT, DITA,
Chemistry, and ANT transformation scenario types.
XPath expression that identifies the element(s) on which a
specific -oxy-transformation-in-progress pseudo class is set before
transformation is started. The pseudo class is reset when the transformation ends or
is cancelled. If this XPath expression is not defined, the current node is used.
XPath expression that identifies other elements on which a
specific -oxy-transformation-in-progress-others pseudo class is set
before the transformation is started. The pseudo class is reset when the
transformation ends.
This operation allows the execution of a sequence of actions, defined as a list of action IDs. The actions must be defined by the corresponding framework, or one of the common actions for all frameworks supplied by Oxygen XML Author Eclipse plugin.
An implementation of an operation that runs a sequence of Oxygen XML Web Author-compatible actions, defined as a list of IDs.
This operation allows running one or more transformation scenarios defined in the current document type association, in the project options, or in the global options. A use case would be to add a toolbar button that triggers publishing to various output formats. The argument of the operation is:
This operation allows running one or more validation scenarios defined in the current document type association, in the project options, or in the global options. The single argument for the operation is:
Inserts a fragment containing a MathML equation at the cursor offset. The argument of this operation is:
Inserts an XML fragment at the current cursor position. The selection, if there is one, remains unchanged. The fragment will be inserted in the current context of the cursor position meaning that if the current XML document uses some namespace declarations then the inserted fragment must use the same declarations. The namespace declarations of the inserted fragment will be adapted to the existing namespace declarations of the XML document. For more details about its list of parameters, see Arguments of InsertFragmentOperation.
Similar to InsertFragmentOperation, except it removes the selected content before inserting the fragment. Also, the insertPosition parameter has another possible value: Replace. If this value is used, the operation deletes the node selected by the XPath expression denoted by the insertLocation parameter. For more details about its list of parameters, see Arguments of InsertFragmentOperation.
Inserts a text at current position removing the selected content, if any. The argument of this operation is:
Insert an XInclude element at the cursor offset. Opens a dialog box that
allows you to browse and select content to be included in your document and automatically
generates the corresponding XInclude instruction.
This operation accepts the following parameter:
The JavaScript content to execute. It must have a function called
doOperation(), which can use the predefined
authorAccess variable. The authorAccess variable
has access to the entire ro.sync.ecss.extensions.api.AuthorAccess Java API.
function doOperation(){
//The current node is either entirely selected...
currentNode = authorAccess.getEditorAccess().getFullySelectedNode();
if(currentNode == null){
//or the cursor is placed in it
caretOffset = authorAccess.getEditorAccess().getCaretOffset();
currentNode = authorAccess.getDocumentController().getNodeAtOffset
(caretOffset);
}
//Get current value of the @type attribute
currentTypeValue = "";
currentTypeValueAttr = currentNode.getAttribute("type");
if(currentTypeValueAttr != null){
currentTypeValue = currentTypeValueAttr.getValue();
}
//Ask user for new value for attribute.
newTypeValue = javax.swing.JOptionPane.showInputDialog
("Input @type value", currentTypeValue);
if(newTypeValue != null){
//Create and set the new attribute value for the @type attribute.
attrValue = new Packages.ro.sync.ecss.extensions.api.node.AttrValue
(newTypeValue);
authorAccess.getDocumentController().setAttribute
("type", attrValue, currentNode);
}
} Flexible operation for moving the cursor within a document and it is also capable of performing a selection. The operation accepts the following arguments:
None, Element, and Content.Flexible operation for moving an XML element to another location from the same document. XPath expressions are used to identify the source element and the target location. The operation takes the following parameters:
true, only the content of the source element is
moved.true and change
tracking is enabled, deleted nodes will be ignored when the XPath locations
are computed (thus, the change tracking is NOT ignored).true, tracked changes are included when a copied
fragment is inserted in a document, regardless of the current state of the
Track Changes feature.Opens a resource in the system application that is associated with the resource in the operating system. The arguments of this operation are:
true or false. If the value is
true, the value of the resourcePath argument is treated as
the name of an unparsed entity.Reloads the content of the editor by re-reading the information from the URL used to open it. It accepts the following argument:
true and false. After
reloading the editor, the content may appear as modified and in some cases where the
content is already present on the file server, you would not want the user to save it
again. You can set this flag to true to prevent the editor from
showing the content as modified.An operation that removes a pseudo-class from an element. Accepts the following parameters:
yes and no. If set to
yes, comments, CDATA, and text nodes are included when evaluating
XPath expressions. If set to no, they are ignored.The XPath location that identifies the element. If it is not defined, then the element at the cursor position is used. It can also identify multiple elements, in which case the pseudo class will be removed from all of them.
Example:
myClass on the element
paragraph and there are CSS styles matching the pseudo-class.
paragraph:myClass{
font-size:2em;
color:red;
}
paragraph{
color:blue;
}In the previous example, by removing the pseudo-class, the layout of the
paragraph is rebuilt by matching the other rules (in this case,
the foreground color of the paragraph element will become blue.
This operation allows you to rename all occurrences of the elements identified by an XPath expression. The operation requires two parameters:
An operation that replaces the content of the element at the cursor location (or fully selected element). The operation accepts the following parameters:
An operation that sets a pseudo-class to an element. The operation accepts the following parameters:
yes and no. If set to
yes, comments, CDATA, and text nodes are included when evaluating
XPath expressions. If set to no, they are ignored.Opens the associated specification HTML page for the current element. The operation accepts as parameter a URL pattern that points to the HTML page containing the documentation.
Surrounds the selected content with a text fragment. Since the fragment can have multiple nodes, the surrounded content will be always placed in the first leaf element. If there is no selection, the operation will simply insert the fragment at the cursor position. For more details about the list of parameters go to: Arguments of SurroundWithFragmentOperation.
This operation has two arguments (two text values) that will be inserted before and after the selected content. If there is no selected content, the two sections will be inserted at the cursor position. The arguments of the operation are:
An implementation of an operation to toggle on/off the pseudo-class of an element. Accepts the following parameters:
yes and no. If set to
yes, comments, CDATA, and text nodes are included when evaluating
XPath expressions. If set to no, they are ignored.The XPath location that identifies one or more elements that will have the pseudo class toggled. If it is not defined, then the element at the cursor position is used.
paragraph:myClass{
color:red;
}
paragraph{
color:blue;
}By default, the paragraph content is rendered in blue. Suppose that you have a
TogglePseudoClassOperation configured for the
myClass pseudo-class. Invoking it the first time will set the
myClass pseudo-class and the paragraph will be rendered in red.
Invoking the operation again, will remove the pseudo-class and the visible result
will be a blue rendered paragraph element.
This operation allows wrapping and unwrapping content in a specific wrapper element that can have certain attributes specified on it. It is useful to implement toggle actions such as highlighting text as bold, italic, or underline. The operation supports processing multiple selection intervals, such as multiple cells within a table column selection. The arguments of the operation are:
This operation allows for commenting or un-commenting the selected content. It does not have any arguments. If the selection is text, the operation wraps the selection in a comment. If the selection is a comment, the operation removes the comment.
This operation allows removing the element tags either from the current element or for an element identified with an XPath location. The argument of the operation is:
It supports the following arguments:
The XQuery Update script to be executed. The value can either be an XQuery script or a URL that points to the XQuery Update script. You can use the ${framework} or ${frameworkDir} editor variables to refer the scripts from the framework directory.
declare variable $oxyxq:selection external;In the example below, you can see how this argument is used.
A string that can assign multiple key-value pairs separated by a comma or a new line character.
declare variable $param1 external;
declare variable $param2 external;You can pass custom values for each parameter by setting the externalParams
to param1=value1,param2=value2.
false, which means the Xinclude elements are not
transparent.declare namespace oxyxq = "http://www.oxygenxml.com/ns/xqu";
(: This variable will be linked to the selected nodes assuming that there are
actually fully selected nodes. For example this selection will return null:
<p>{SEL_START}text{SEL_END} in para</p>
but this will give two "p" elements:
{SEL_END}<p>text</p><p>text2</p>{SEL_END}
If a multiple selection exists it will also be processed and forwarded.
Again, only fully selected nodes will be passed.
:)
declare variable $oxyxq:selection external;
(: We will process either the selection or the context node :)
let $toProcess := if (empty($oxyxq:selection)) then
(.)
else
($oxyxq:selection)
return if (not(empty($toProcess))) then
(
(: Create the list :)
let $ul :=
<ul>
{
for $sel in $toProcess
return
<li>{$sel}</li>
}
</ul>
return
(
(: Delete the processed nodes :)
for $sel in $toProcess
return
delete node $sel,
(: Inserts the constructed list :)
insert node $ul
before $toProcess[1]
)
)
else
()These operations accept the following parameters:
An XPath expression indicating the element that the script will be applied on. If it is not defined, then the element at the cursor position will be used.
oxy:current-element() function to access the current element, as
in the following
example:<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0"
xpath-default-namespace="http://docbook.org/ns/docbook"
xmlns:oxy="http://www.oxygenxml.com/ns/author/xpath-extension-functions"
exclude-result-prefixes="oxy">
<xsl:template match="/">
<xsl:apply-templates select="oxy:current-element()"/>
</xsl:template>
<xsl:template match="para">
<!-- And the context is again inside the current element,
but we can use information from the entire XML -->
<xsl:variable
name="keyImage" select="//imagedata[@fileref='images/lake.jpeg']
/ancestor::inlinemediaobject/@xml:id/string()"/>
<xref linkend="{$keyImage}" role="key_include"
xmlns="http://docbook.org/ns/docbook"/>
</xsl:template>
</xsl:stylesheet>The script content (XSLT or XQuery). The base system ID for this will be the framework file, so any include/import reference will be resolved relative to the .framework file that contains this action definition.
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
<xsl:import href="xslt_operation.xsl"/>
</xsl:stylesheet>Preserve, Before, Start,
First editable position, End, or
After. If this parameter is not set, you can still indicate the
position of the cursor by using the ${caret} editor
variable in the inserted content.true and false). The
default value is false. When set to true, the Track Changes feature is
deactivated. When using this argument, after the action is finished, the state of the
Track Changes feature is restored to its initial value.A string that can assign multiple key-value pairs separated by a comma or a new line character.
declare variable $param1 external;
declare variable $param2 external;You can pass custom values for each parameter by setting the externalParams
to param1=value1,param2=value2.
XSLTOperation Example: Sort a list with respect to the language declared on the root element:
<article xml:lang="en">
<ul>
<li>B</li>
<li>C</li>
<li>A</li>
</ul>
</article>The XSLTOperation needs to be configured as follows:
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:oxy="http://www.oxygenxml.com/ns/author/xpath-extension-functions"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
exclude-result-prefixes="xs oxy" version="2.0">
<xsl:template match="/">
<!--
sourceLocation parameter was set to /* to have a larger context.
We can pinpoint the element that contained the caret
using the oxy:current-element() function.
-->
<xsl:apply-templates select="oxy:current-element()"/>
</xsl:template>
<xsl:template match="ul">
<!-- Because the sourceLocation parameter was set to /* we now have access to
the root element and its attributes. -->
<xsl:variable name="lang" select="/*/@xml:lang"/>
<xsl:variable name="collationURI">
<xsl:value-of select="concat('http://www.w3.org/2013/collation/UCA?lang=', $lang)"/>
</xsl:variable>
<xsl:copy>
<xsl:copy-of select="@*"/>
<!-- Copy the list items, but sorted. -->
<xsl:apply-templates select="li">
<xsl:sort collation="{$collationURI}" select="text()"/>
</xsl:apply-templates>
</xsl:copy>
</xsl:template>
<!-- This copy template will handle the contents of the list items. -->
<xsl:template match="@* | node()">
<xsl:copy>
<xsl:apply-templates select="@* | node()"/>
</xsl:copy>
</xsl:template>
</xsl:stylesheet>This operation accepts the following parameters:
${ask( 'Provide a date',generic,'${date(yyyy-MM-dd'T'HH:MM)}')}| Parameter | |
|---|---|
| generic (default) | Format: ${ask('message', generic, 'default')} |
| Description: The input is considered to be generic text that requires no special handling. | |
Example:
|
|
| url | Format: ${ask('message', url, 'default_value')} |
| Description: Input is considered a URL. Oxygen XML Author Eclipse plugin checks that the provided URL is valid. | |
Example:
|
|
| relative_url | Format: ${ask('message', relative_url, 'default')} |
| Description: Input is considered a URL. This parameter provides a
file chooser, along with a text field. Oxygen XML Author Eclipse plugin tries to make
the URL relative to that of the document you are editing. Note: If the $ask editor variable is expanded in
content that is not yet saved (such as an untitled file, whose path
cannot be determined), then Oxygen XML Author Eclipse plugin will transform it into an
absolute URL.
|
|
|
Example: ${ask('File location', relative_url, 'C:/example.txt')} - The dialog box has the name 'File location'. The URL inserted in the input box is made relative to the currently edited document location. |
|
| password | Format: ${ask('message', password, 'default')} |
| Description: The input is hidden with bullet characters. | |
Example:
|
|
| combobox | Format: ${ask('message', combobox, ('real_value1':'rendered_value1';...;'real_valueN':'rendered_valueN'), 'default')} |
| Description: Displays a dialog box that offers a drop-down menu.
The drop-down menu is populated with the given rendered_value values.
Choosing such a value will return its associated value
(real_value). Note: The list of
'real_value':'rendered_value' pairs can be computed using
${xpath_eval()}.
Note: The
'default' parameter specifies the default-selected value and can
match either a key or a value.
|
|
Example:
|
|
| editable_combobox | Format: ${ask('message', editable_combobox, ('real_value1':'rendered_value1';...;'real_valueN':'rendered_valueN'), 'default')} |
| Description: Displays a dialog box that offers a drop-down menu
with editable elements. The drop-down menu is populated with the given
rendered_value values. Choosing such a value will return its
associated real value (real_value) or the value inserted when you edit
a list entry. Note: The list of
'real_value':'rendered_value' pairs can be computed using
${xpath_eval()}.
Note: The
'default' parameter specifies the default-selected value and can
match either a key or a value.
|
|
Example:
|
|
| radio | Format: ${ask('message', radio, ('real_value1':'rendered_value1';...;'real_valueN':'rendered_valueN'), 'default')} |
| Description: Displays a dialog box that offers a series of radio
buttons. Each radio button displays a 'rendered_value and will return
an associated real_value. Note: The list of
'real_value':'rendered_value' pairs can be computed using
${xpath_eval()}.
Note: The
'default' parameter specifies the default-selected value and can
match either a key or a value.
|
|
Example:
|
|
| textarea | Format: ${ask('message', textarea, 'default')} |
| Description: The input is a text area that requires no special handling. | |
Example:
|
${ask('Bundle for keydefs', radio, (${xpath_eval(let $family := 'utah', $bundles := doc(environment-variable('HOME') || '/git/dita-author-tools/resource/properties/bundle-data.xml')/*/family[@name eq $family]/*, $pairs := $bundles ! concat('''',./@bundle-code, '''',':', '''',./@map-filename,'''') return string-join($pairs, ';'))}), @bundle-code)}getArguments() method on the operation.
New to open the Action dialog
box.Double-click the operation (or select it and click OK).
The arguments for the operation will now be displayed in the Action dialog box.