| Adding or Editing a Document Type Association (Framework) / Configure Actions, Menus, and Toolbars for a Framework | |
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 the list of parameters go to: The Arguments of InsertFragmentOperation Operation.
Similar to InsertFragmentOperation, except it removes the selected content before inserting the fragment.
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 The Arguments of SurroundWithFragmentOperation.
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.
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0" xpath-default-namespace="http://docbook.org/ns/docbook" xmlns:saxon="http://saxon.sf.net/" exclude-result-prefixes="saxon"> <!-- This is an XPath location which will be sent by the operation to the script --> <xsl:param name="currentElementLocation"/> <xsl:template match="/"> <!-- Evaluate the XPath of the current element location --> <xsl:apply-templates select="saxon:eval(saxon:expression($currentElementLocation))"/> </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:value-of select="$currentElementLocation"></xsl:value-of> </xref> </xsl:template> </xsl:stylesheet>
An XPath expression indicating the insert location for the result of the transformation. If it is not defined then the insert location will be at the cursor location.
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.
For example, for the following script, the imported xslt_operation.xsl needs to be located in the current framework's directory.
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> <xsl:import href="xslt_operation.xsl"/> </xsl:stylesheet>
The insert action relative to the node determined by the target XPath expression. It can be: Replace, At cursor position, Before, After, Inside as first child or Inside as last child.
The position of the cursor after the action is executed. It can be: 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.
Parameter controlling the expansion of editor variables returned by the script processing. Expansion is enabled by default.
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;
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 returnnull: <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) returnif (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 ()
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);
}
}
Opens the associated specification HTML page for the current element. The operation accepts as parameter an URL pattern that points to the HTML page containing the documentation.
The script will be executed in the context of the cursor node. If the XQuery script declares the selection variable, it will also receive the selected nodes (assuming that the selection consists entirely of nodes).
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
()
name - Name of the pseudo-class to be removed.
Let's consider that there is a pseudo-class called 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.
name - Name of the pseudo-class to be toggled on/off.
paragraph:myClass{
color:red;
}
paragraph{
color:blue;
}
By default, the paragraph content is rendered in blue. Suppose that we 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.
ExecuteMultipleWebappCompatibleActionsOperation
An implementation of an operation that runs a sequence of Oxygen XML WebApp-compatible actions, defined as a list of IDs.
DeleteElementsOperation
Deletes the nodes indicated by the elementLocations parameter XPath expression. If missing, the operation will delete the node at the cursor location.
Deletes the node indicated by the elementLocation parameter XPath expression. If missing, the operation will delete the node at the cursor location.
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.
| Parameter | |
|---|---|
| url | Format: ${ask('message', url, 'default_value')} |
| Description: Input is considered a URL. Oxygen XML Editor checks that the provided URL is valid. | |
Example:
|
|
| password | Format: ${ask('message', password, 'default')} |
| Description: The input is hidden with bullet characters. | |
Example:
|
|
| generic | Format: ${ask('message', generic, 'default')} |
| Description: The input is considered to be generic text that requires no special handling. | |
Example:
|
|
| relative_url | Format: ${ask('message', relative_url, 'default')} |
| Description: Input is considered a URL. Oxygen XML Editor
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 Editor will transform it
into an absolute URL.
|
|
|
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 '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 '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
'default' parameter specifies the default selected value
and can match either a key or a value.
|
|
Example:
|