@target on <name>
Questions about XML that are not covered by the other forums should go here.
-
- Posts: 3
- Joined: Thu Sep 10, 2020 10:43 pm
@target on <name>
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
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
-
- Posts: 1016
- Joined: Wed Nov 16, 2005 11:11 am
Re: @target on <name>
Post 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?
Best regards,
Alex
If I understand it correctly, you've created your own TEI schema that allows @target attributes directly on name elements, right?
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?<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.
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.<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.
Best regards,
Alex
-
- Posts: 3
- Joined: Thu Sep 10, 2020 10:43 pm
Re: @target on <name>
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
Cheers
Ralph
-
- Posts: 1016
- Joined: Wed Nov 16, 2005 11:11 am
Re: @target on <name>
Post 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:
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
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);
}
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
Return to “General XML Questions”
Jump to
- Oxygen XML Editor/Author/Developer
- ↳ Feature Request
- ↳ Common Problems
- ↳ DITA (Editing and Publishing DITA Content)
- ↳ SDK-API, Frameworks - Document Types
- ↳ DocBook
- ↳ TEI
- ↳ XHTML
- ↳ Other Issues
- Oxygen XML Web Author
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Content Fusion
- ↳ Feature Request
- ↳ Common Problems
- Oxygen JSON Editor
- ↳ Feature Request
- ↳ Common Problems
- Oxygen PDF Chemistry
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Feedback
- ↳ Feature Request
- ↳ Common Problems
- Oxygen XML WebHelp
- ↳ Feature Request
- ↳ Common Problems
- XML
- ↳ General XML Questions
- ↳ XSLT and FOP
- ↳ XML Schemas
- ↳ XQuery
- NVDL
- ↳ General NVDL Issues
- ↳ oNVDL Related Issues
- XML Services Market
- ↳ Offer a Service