Page 1 of 1

@target on <name>

Posted: Thu Sep 10, 2020 11:00 pm
by ralphy
Hi,
there is probably a very good reason for this, and I'm a bit of newbie to XML schema design but I've got the following problem:
I want to be able to use Oxygen's built in services to improve xml input by allowing people to find the reference docs to # while marking up inline.
Specifically, I want people to be able to write <name type=[person/place etc target=[xml:id in a related xml document in the same folder]>kelso</name>.
Declaring the <choice> for @type is fine, and even declaring att.pointing.attributes on the <name> element gives the option of @target, which Oxygen reads and correctly points to the document list. However, the resulting link is only to the host document. As an example, in a document called "test.xml":
<ref target="listplace.xml#kelso>kelso</ref> points correctly to the entry for Kelso (xml:id=kelso) in the listplace.xml document, stored in the same folder.
But:
<name target="listplace.xml#kelso>kelso</name> (which formats fine with content completion and is valid against the schema) points instead to "test.xml" and so cannot resolve the xml:id.

I know that this is unorthodox usage, but for the specific project I'm working on being able to deliver this functionality without having to use both a <name> element and separate non-specific <ref> element. It *almost* works, but for some reason the last step eludes me...

Any help gratefully received

Ralph

Re: @target on <name>

Posted: Fri Sep 11, 2020 4:35 pm
by alex_jitianu
Hello,

If I understand it correctly, you've created your own TEI schema that allows @target attributes directly on name elements, right?
<ref target="listplace.xml#kelso>kelso</ref> points correctly to the entry for Kelso (xml:id=kelso) in the listplace.xml document, stored in the same folder.
This means that CTRL+Click on the attribute opens listplace.xml and selects the kelso attribute, right? Or are you referring to something else when you say "points correctly", like maybe that the link works in the published output?
<name target="listplace.xml#kelso>kelso</name> (which formats fine with content completion and is valid against the schema) points instead to "test.xml" and so cannot resolve the xml:id.
Well, from what I tested, CTRL+Click correctly identifies the target id, so you might refer to something else when you say "points to".... In my sace, I didn't use a customized Schema, I just put the @target on the name element, ignoring the validation error.

Best regards,
Alex

Re: @target on <name>

Posted: Fri Sep 11, 2020 11:08 pm
by ralphy
Thanks Alex, you've interpreted what I was doing correctly, but not quite the result. So ctrl-click in editor works absolutely (even without the custom schema), but the link in Author (which is really what I want to use) points to the original file, and no link is generated in an html transformation (which would be useful, but I'm guessing is because it is the <ref> element rather than @target that actually creates an html link). The need for a schema is so I can import from other locations, but ideally I would have users working in Author as a standard. Just not quite understanding why the behaviour differs between text and author views.

Cheers
Ralph

Re: @target on <name>

Posted: Mon Sep 14, 2020 10:01 am
by alex_jitianu
Hello Ralph,

It seems the culprit is a CSS rule that was intended for TEI P4. If you place the caret inside the name element, invoke the contextual menu, and choose CSS Inspector, you will get the chance to inspect the CSS rules that match. In it, select the :before tab and you will see a rule like this:

Code: Select all


*[target]:before {
  /* Keep just the first ID */
  link: "#" oxy_replace(attr(target), "(\\S+)(\\s*)(.*)$", "$1", true);
  content: url(img/link.png);
}
Follow the link to get to the links.css file. Delete that "#" prefix, save, return to the XML and reload using F5. The link should now work.

I'm not sure how to tackle this, myself. This CSS rule is a reminiscence of the TEI P4 support so we should probably remove it from the built-in CSSs. This also means that you should put this corrected rules into its own CSS file, extend the built-in TEI P5 framework and add the CSS file. Put the CSS last in list so that will override the built-in.

Best regards,
Alex

Re: @target on <name>

Posted: Tue Sep 15, 2020 12:08 am
by ralphy
Many thanks, Alex, that's really helpful! Now just to decide how I go about the next stage...

Thanks again

Ralph