To allow WYSIWYG editing of document graphical presentation directly in the canvas
we must first identify the original data placement in the source document. This is
achieved by using emp:id
attributes, identifying elements. Because
text nodes cannot have attributes, their IDs have to be computed using their position.
You may compute IDs of source nodes in your stylesheet using these rules:
emp:id
attribute. This ID
attribute value is an integer number.;
)
to separate those two values.foo
or
bar:foo
if it does have a prefix) instead of their
position and separate it by a @
character.Some applications (for example FOP) requires that each ID is unique. However we may want to identify same element from different places. We must ensure that two different ID strings denote the same element. Hence, we define the ID structure as follows:
[parent-id]{; or @} position or attribute-name [:any_string]
where []
denotes an optional part and {}
represents choice
between two strings. No whitespaces are allowed. The any_string
part
is ignored when IDs are compared - two IDs are equal if and only if their parent-id
are equal or both are missing and position
or attribute-name
are equal.
We say that ID is synthetic when it is not present in the source document and needs to be created from another ID. We say that ID is native if it is not synthetic. We see that only the ID denoting an element is native - all other IDs (text, comment, attribute, ...) are synthetic.
Your stylesheet (exporter) should transport these IDs to renderer and editor to allow on-screen figures to be identifiable. Here are some tips you may find useful:
<fo:inline>
element that contains
the emp:id
attribute containing the value of this id.<fo:inline>
element, as
if text was transported. The type of source node will be get from id, so there is
no need to specify this type explicitly.<fo:inline id="..."/>
- it doesn't occupy no canvas space and
doesn't harm the presentation in any way.emp:id
to new node.emp:id
to all new nodes (it may be enough to transfer emp:id
to all roots of
trees being created - it is logical that node inherits ID from its ascendant).emp:id
attribute aswell.foo
element containing bar
element that contains baz
element containing some text, and we
are trying to render only the text in a FO output document. The result may look like this:
<fo:inline emp:id="foo_id"><fo:inline emp:id="bar_id"><fo:inline emp:id="baz_id"><fo:inline
emp:id="text_id">text</fo:inline>.... etc