EclipseXSLT - XSLT Support for Eclipse » Usage » Editor Outline | ||
Editor Outline | Launch Configuration |
Orangevolt EclipseXSLT provides a configurable outline depending on your document type/structure.
The outline configuration defines labels and images for all document elements which should be outlined. Labels can be defined using XPath expression placeholders to allow label creation based on the real document content.
An The dynamic label creation facility allows you to label anElements not defined in the configuration will be hidden in the outline.<chapter>
element with attributetitle
asChapter ${@title}
. Alternative label expressions are possible by separator|
. All<chapter>
elements will now be labeled withChapter [content of title attribute]
.
Outline configurations are read when at first use. The default outline configuration provides 3 configurations : the xml document type which is the source of this documentation , XSLT stylesheet outline and Docbook outline.
Outline configurations are done by Eclipse extension points. The best way for defining an outline is to create a new Eclipse fragment (see the Docbook fragment source as an example. It is located in [eclipse]/plugins/com.orangevolt.eclipse.xslt.docbook/). The outline icons can also be located in your fragment.
Below is the outline configuration for Docbook files:
outline configuration fragment for docbook (com.orangevolt.eclipse.xslt.docbook/fragment.xml) | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
As you can see in the configuration an outline is defined as an extension to EclipseXSLT extension point com.orangevolt.eclipse.xslt.outlineconfiguration
.
You can define multiple outline configurations within the extension point. I suggest to create one single fragment (for you or your company) containing all custom outline configurations.For big outline definitions which are common used (like the Docbook outline configuration) i suggest its own fragment named by the format spec.
An outline configuration starts with the grammar
element. grammar
accepts the following attributes:
A unique id for the grammar (its up to you how to name the id).
A human readable name for the grammar to identify its origin and use.
A list of possible root element names separated by |
.
In general a xml format specifies exact one single root element. But some formats allow different kinds of root elements (Docbook for example). Therefore a list of possible root elements is possible.The rootelement attribute is used by the outline to decide which rules for the document outline to use.
Inside the grammar
element are element
tags defined. Each element
is used to describe one single xml element from the customized xml outline.
element
takes the following attributes:
The name of the xml tag to label.
Since version 1.0.5 element names may contain wildcards (*
and ?
to be concrete :-). This is a huge step forwarding because it eases
the outline configuration for the lazy guys very much.
The example below shows the simple xul outline configuration using a wildcard.
(This configuration matches every xul element and displays either its element name, title or label).
|
The label template list for the xml tag. The label list may contain multiple label templates for different representations separated by |.
A single template consists of static text and XPath placeholders.
Everything between ${
and }
will be interpreted
as XPath expression and be replaced by its result.
The first matching representation will be used for labeling. A representation matches when all attributes of the representation are found in the xml tag.
An example:You can also use complex templates containing multiple XPath placeholders and static text.The label definition of element
book
(see line 9 in the fragment source above) is${title}|${articleinfo/title}|${@label}|${@xreflabel}|${@id}
.
The label rendering forbook
works as following:
If
book
has a child elementtitle
then its text content is rendered as label.Else if
book
has a childarticleinfo
having a childtitle
then the text content of sub elementtitle
is rendered as labelElse if
book
has attributelabel
then thelabel
attribute value is rendered as labelElse if
book
has attributexreflabel
then thexreflabel
attribute value is rendered as labelElse if
book
has attributeid
then theid
attribute value is rendered as labelOtherwise (if none of the representations matches) the default label
<book> :: no attribute matched label ${title}|${@label}|${@xreflabel}|${@id}
will be displayed.
An XPath placeholder is what its name implies - an real xpath expression. therefore you can use real xpath syntax inside${
and}
.The current element is used as XPath expression context.
(optional). The tooltip is an optional attribute defining the tooltip text for the element. the tooltip attribute
(optional). The icon is an optional attribute defining the plugin/fragment relative path to fetch the xml tag icon. If no icon was defined the default element icon of the Eclipse WTP outline is used.