-
Notifications
You must be signed in to change notification settings - Fork 0
LabelledEntriesFromXMLByPrefixDef
The plugin
de.wwu.scdh.teilsp.extensions.LabelledEntriesFromXMLByPrefixDef
is
used to parse XML (local) sources given in <prefixDef>
.
Note: Have a look
de.wwu.scdh.teilsp.extensions.LabelledEntriesXSLTWithContext
,
which provides a more powerful implementation that evaluates the XML
base property.
This plugin is not intended for querying GND, Wikidata, or other global norm data repositories. These would require their own plugins.
- works well with local files
- URL lookup is done with the URI resolver used by oXygen, i.e. it evaluates all currently configured XML catalogs. So redirection is possible.
- does not yet evaluate
@xml:base
when there's a relative path given in the<prefixDef>
. Read on this topic in TEI-L. Resulting recommendation. - should evaluate the regular expressions given in the arguments somehow
- should take arguments for authenticating when accessing remote documents
Note: Splitting of parts of fragment identifiers over the URI like practised here is not supported by the current plugin. IMHO URIs should not contain whitespace.
This argument binds the namespace prefixes in the other arguments'
XPath expressions to namespace names. The form is
prefix:namespace-name[ prefix:namespace-name]*
, i.e. space-separated
pairs of a colon-separated prefix and namespace name.
Example:
<argument name="namespaces">t:http://www.tei-c.org/ns/1.0 xml:http://www.w3.org/XML/1998/namespace</argument>
This argument is an XPath. It is evaluated on the currently edited
document and selects the relevant <prefixDef>
node. From from this
node, the URI prefix is taken from the @ident
attribute and the.
Example:
<argument name="prefixDef">//t:teiHeader//t:prefixDef[matches(@ident, '(psn|prs|pers)')]</argument>
The XPath in the prefixDefRef
argument is evaluated on the result
set of returned by the XPath in prefixDef
, i.e. on the <prefixDef>
node. It's string result represents the relative or absolute URL of
the source for the person list.
Example:
<argument name="prefixDefRef">tokenize(@replacementPattern, '#')[1]</argument>
This splits the string in the @replacementPattern
attribute's value
on the character #
and uses the first split.
Theoretically, you can also provide a constant string, to link a document, the URL of which does not appear the the currently edited document. E.g.
<argument name="prefixDefRef">'https://my.domain.org/normdata.xml'</argument>
The arguments selection
, key
, and label
are XPath expressions
that are evaluated on the referenced document.
selection
is the XPath to the elements, that encode the
person. Normally, this path would return a sequence of nodes, each
representing person information. key
and label
are evaluated on
each of the nodes of the sequence.
Example:
<argument name="selection">//t:text/descendant::t:person[@xml:id]</argument>
This selects all <person>
node arbitrary deeply nested in the main
part (text) of the document, which is TEI.
This argument selects the identifier of a node found by
selection
. The key is the really used thing in a persName/@ref
etc., i.e. the thing that will be in the URI after the prefix.
Example:
<argument name="key">@xml:id</argument>
This simply gets the xml ID of the <person>
node.
This XPath makes a readable label associated with the key.
Example:
<argument name="label">normalize-space(concat(t:persName, ', *', t:birth))</argument>
This selects the persons name given in person/persName
, then adds
his or her date of birth, if present.
<plugins>
<plugin>
<class>de.wwu.scdh.teilsp.extensions.LabelledEntriesFromXMLByPrefixDef</class>
<type>de.wwu.scdh.teilsp.services.extensions.ILabelledEntriesProvider</type>
<configurations>
<configuration>
<conditions>
<condition domain="context">self::*:persName and //*:teiHeader//*:prefixDef[matches(@ident, '^(psn|prs|pers|person)')]</condition>
<condition domain="priority">10</condition>
<condition domain="nodeType">attributeValue</condition>
<condition domain="nodeName">ref</condition>
</conditions>
<arguments>
<argument name="namespaces">t:http://www.tei-c.org/ns/1.0 xml:http://www.w3.org/XML/1998/namespace</argument>
<argument name="selection">//t:text/descendant::t:person[@xml:id]</argument>
<argument name="key">@xml:id</argument>
<argument name="label">normalize-space(concat(t:persName, ', *', t:birth))</argument>
<argument name="prefixDef">//t:teiHeader//t:prefixDef[matches(@ident, '(psn|prs|pers)')]</argument>
<argument name="prefixDefRef">tokenize(@replacementPattern, '#')[1]</argument>
</arguments>
</configuration>
...
</configurations>
</plugin>
...
</plugins>