[Tshwanelex-l] In-text cross-references; tilde function
David Joffe
david.joffe at tshwanedje.com
Mon Aug 17 10:32:56 EDT 2020
Oh yes, one more thing I forgot to mention below, in all these cases
one also needs to add the 'Child relation' of parent-child elements
in the DTD editor. E.g. in Customise DTD, select 'Definition'. Make
sure 'Enable text (PCDATA)' ticked. Then under "Allowed child
elements" double-click e.g. "References" in the list on the right
and add it (as e.g. "Zero or more" child relation).
That then allows and enables that if you right click on Tree View in
TLex, you get the option on the menu to 'Add: References'.
Likewise if you make your own new 'xr' element or whatever.
- David
From: David Joffe <david.joffe at tshwanedje.com>
> Hi Jason,
>
> Hm, the main thing you need to do is tick 'Allow text (PCDATA)' (or
> somesuch) on the parent element in customize DTD, then enter the
> child with manual tagging under F1 (sorry that's a very concise
> description).
>
>
> Off the top of my head, I think there are a few different scenarios,
> depending on your requirements ... the first and probably ideal
> scenario would be if the xref is a TLex 'smart reference' but inline
> within another field such as a definition, e.g.:
>
> <Definition>A dog is a <References reflemma="mammal"></References>
> with four legs</Definition>
>
> Then really what you need in the DTD editor is tick 'Enable PCDATA'
> on Definition and start placing definitions as inline 'text' instead
> of inside the Definition::Definition attribute.
>
> What you CANNOT do is the following (put it inline inside a
> Definition *attribute*) because it's bad and invalid XML:
> <Definition Definition="A dog is a <References
> reflemma="mammal"></References> with four legs"></Definition>
>
> (An attribute can be converted to PCDATA text, I think there's a
> Tools menu command to help do that or somesuch)
>
>
>
> Now there might be situations/requirments where one doesn't want to
> use the main normal TLex smart references as a child for some reason
> (e.g. if the way it displays things is not suitable for that
> particular situation, or if the typesetter or programmer for an
> online dictionary or App wants it some other way, or whatever) and
> then you might use just another new non-TLex-smart-reference PCDATA
> element inside e.g.:
>
> <Definition>A dog is a <xr>mammal</xr> with four legs</Definition>
>
> In the above case BOTH Definition and the new 'xr' element should
> have 'Allow text (PCDATA)' ticked. But in this case it's no longer a
> true smart-reference. (We're working on ways to make this more like
> a smart-ref and we have done so for some projects but it's tricky to
> genericze as almost every dictionary seems to have slightly
> different approaches and rules.)
>
>
>
> Another scenario is also valid and that's to use an attribute of the
> inline'd element like so, e.g. xr::xr:
> <Definition>A dog is a <xr xr="mammal"></xr> with four
> legs</Definition>
> That's fine but it won't be a 'true Tlex smart-reference' but in
> this case we do have two special checkboxes 'XRef target' and 'XRef
> display to help enable at least some semi-smart clickable nature of
> these references. "XRef target" means the attribute holds the xref
> target headword/lemma as above e.g. "mammal".
> In some situations the display headword may be different to the
> target headword, especially with highly inflected languages, then we
> can use two attributes, one is used to display the ref (which can
> then be different to the actual target headword, e.g. as in the
> following example):
>
> <Definition>A dog is a four-<xr xref="leg"
> xrefdisplay="legged"></xr> mammal</Definition>
>
> So here there are two attributes to describe the reference, "leg" is
> the actual target headword, but "legged" is displayed.
> In these cases only 'Definitions' needs 'Enable text (PCDATA)'
> ticked in DTD editor.
>
>
>
> Probalby the only time you really strictly *need* both the parent
> and child to be 'Enable text (PCDATA)' is when the child might also
> need inline elements inside it, for example if you need something
> like:
> <Definition>A dog is a <xr>mammal (sense <xrsense>2</xrsense></xr>
> with four legs</Definition>
> or:
> <Definition>A dog is a <xr>mammal (senses
> <xrsense>2-3</xrsense></xr> with four legs</Definition>
> or:
> <Definition>A dog is a <xr>mammal (that <i>likes to bark</i>)</xr>
> with four legs</Definition>
> or:
> <Definition>A dog is a <xr>mammal (<geo>Fr. dialect</geo>)</xr> with
> four legs</Definition>
> or whatever.
>
> In these cases there are further inline tags inside the child ...
> it's a bit more extreme and rare to dhis ... in that case both
> parent and child need 'Enable text (PCDATA)' ticked, as do e.g.
> 'geo' and 'i' and 'xrsense' tags in the above cases.
>
> But unfortunately in these scenarios we can't yet use TLex
> smart-references in the general off-the-shelf TLex.
>
> (We do have projects where we have done these as basically clickable
> smart-references for particular clients/users but it's more of an ad
> hoc solution where we did a bit of tailored stuff for them for that
> project, i.e. in scenarios where the requirements exceed what's
> available from the built-in smart-references, and we're happy to do
> more such for other customers but that would unfortunately probably
> have to be a paid customization if it's required.)
>
> Again a lot of how to approach this depends on one's particular
> requirements ... almost every dictionary seems to be a bit
> different.
>
> Don't know if this helps.
>
> - David
>
More information about the Tshwanelex-l
mailing list