Tools / Copy field [Advanced]
This tool allows you to bulk-copy a value from one field (or fields) within an entry, to another. Various options provide a high degree of control.
This tool is "filter-aware", i.e. if a filter is currently applied, only filtered entries will be affected.
Options:
Element (destination)
The name of the element to copy to.
Attribute (destination)
The name of the attribute to copy to (this must belong to the abovementioned element).
Copy from (1) (tQuery expression on node or entry)
Primary field(s) to copy from. The value is obtained by running the given
tQuery expression.
NB: The starting point of the tQuery expression traversal is considered, by default, to be relative to the given element above.
[Optional] Copy from (2) (tQuery expression on node or entry)
Secondary field(s) to copy from, if the first tQuery returns an empty result. The value is obtained by running the given
tQuery expression.
[Optional] Copy from (3) (tQuery expression on node or entry)
Third field(s) to copy from, if the first and second tQuery expressions return empty results. The value is obtained by running the given
tQuery expression.
[Optional] Regular expression submatch extraction of 'copy from' string
Once the value of the 'copy from' string has been obtained using the above
tQuery expression(s), it can optionally be pared down further by specifying a regular expression here, with one or more bracketed submatch specifiers. For example, if
tQuery retrieves a value "lemmasign (variant)", you can discard the 'variant' information by specifying a regular expression "^([^\(]*) \(" here, which means 'return all characters prior to the first occurrence of a space and open brack', and discard the rest.
[Optional] Condition (tQuery expression on node or entry)
You can optionally tell the 'copy field' to skip copying a value for a given instance, if the
tQuery expression specified here, has no matches for the regular expression specified in the next field.
This allows you to set up 'conditional copying'; for example, 'copy all Lemma::LemmaSign values from a child element "<LemmaSignImport>...</LemmaSignImport>", but only for those with part of speech as verb', e.g.:
Element: Lemma
Attribute: LemmaSign
Copy from: /LemmaSignImport
Condition tQuery: /LemmaSign
Condition regex: ^verb$
[Optional] Condition (regular expression match on previous tQuery)
You can optionally tell the 'copy field' to skip copying a value for a given instance, if the
tQuery expression specified above, has no matches for the regular expression specified here. See notes above.
Tools / Resolve cross-references [Advanced]
This tool assists in converting cross-references in other (non-TL-smart-references), to TL-smart-references.
Enter element and optional attribute to convert to smart-references, and regular expressions for extracting the relevant sub-fields.
Element:MyRefElem
Attribute:RefTarget
for cases like:
dog (n) see <MyRefElem RefTarget="hound"></MyRefElem>
If the attribute is NULL, the 'text' (PCDATA) children of nodes of the given element type are used.
Element:MyRefElem
Attribute:
for cases like:
dog (n) see <MyRefElem>hound</MyRefElem>
tQuery query language [Advanced]
The tQuery query language implements a very small subset of XPath, a standardized query language that allows you to create complex searches to extract data from an XML document tree.
At its core, XPath/tQuery uses the "/" operator to traverse an XML element hierarchy, e.g. "/.
Syntax:
@Attribute
Retrieve value of given attribute (of the element at the currently traversed element in the hierarchy).
Examples:
@LemmaSign : Retrieve value of Lemma::LemmaSign attribute (assuming the Lemma element as the starting point of the query).
/Subentry/@LemmaSign : Retrieve value of Subentry::LemmaSign attribute, given a Subentry child of the main Lemma element (assuming the Lemma element as the starting point of the query).
@id
Return value of special pseudo-attribute that is the unique ID of an element node in the document tree
/
Traverse to the top-level element of the hierarchy
..
Traverse one level higher in the element hierarchy (i.e. to the parent node of the current node)
Element[N]
Traverse to the N'th child element of the given element type (N is 1-based).
Examples:
/Subentry[2]/@LemmaSign : Retrieve value of Subentry::LemmaSign attribute, of the second Subentry child of the main Lemma element.
/Zulu[2]/@Term : Retrieve value of Zulu::Term attribute of the second Zulu term in a tlTerm entry with more than one alternate Zulu term (i.e. synonym).
/Sense[3]/TE[2] : Retrieve value of second Translation Equivalent of the third Sense of a TLex dictionary entry.
text()
Get text node children