Show title from xref'ed document in Author mode
Post here questions and problems related to editing and publishing DITA content.
-
- Posts: 16
- Joined: Thu Nov 03, 2011 3:16 pm
Show title from xref'ed document in Author mode
In an effort to assist our authors, I am looking for a way to modify the Author mode so that instead of the document name/id/key shown for an xref, the actual title of the reference document is should. Something similar to how a conref is represented.
I have been fiddling with the CSS files in the frameworks directory, but have not found a way.
I am asking for this because we have very large projects (3000+ topics in a series of maps), and the title for certain topics contains useful information.
Thanks.
I have been fiddling with the CSS files in the frameworks directory, but have not found a way.
I am asking for this because we have very large projects (3000+ topics in a series of maps), and the title for certain topics contains useful information.
Thanks.
-
- Posts: 9434
- Joined: Fri Jul 09, 2004 5:18 pm
Re: Show title from xref'ed document in Author mode
Hi James,
We've had a previous improvement request for this and I added your comments to it.
If you want to approach this from the CSS side, the most powerful CSS extension that we have, the xpath function:
http://www.oxygenxml.com/doc/ug-editor/ ... ction.html
allows you to run full XPath 2.0 expressions so you could maybe try to come up with an XPath expression which parses the target topic document and retrieves some title text.
Also, our Java Author SDK API allows for you to take control about what to display for an xref by implementing a StylesFilter interface, thus also you would be responsible to parse the reference topic and obtain the title from it. So this is another alternative you can explore if you are comfortable with Java:
http://www.oxygenxml.com/oxygen_sdk.htm ... horing_SDK
I can give you more details about this approach if you are interested.
Regards,
Radu
We've had a previous improvement request for this and I added your comments to it.
If you want to approach this from the CSS side, the most powerful CSS extension that we have, the xpath function:
http://www.oxygenxml.com/doc/ug-editor/ ... ction.html
allows you to run full XPath 2.0 expressions so you could maybe try to come up with an XPath expression which parses the target topic document and retrieves some title text.
Also, our Java Author SDK API allows for you to take control about what to display for an xref by implementing a StylesFilter interface, thus also you would be responsible to parse the reference topic and obtain the title from it. So this is another alternative you can explore if you are comfortable with Java:
http://www.oxygenxml.com/oxygen_sdk.htm ... horing_SDK
I can give you more details about this approach if you are interested.
Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
<oXygen/> XML Editor
http://www.oxygenxml.com
-
- Posts: 16
- Joined: Thu Nov 03, 2011 3:16 pm
Re: Show title from xref'ed document in Author mode
I have finally had time to take a look at the XPATH part of your suggestion.
I have tried a few things and have gotten stuck with trying to use xpath on an external document.
So in the *[class~="topic/xref"][href]:before CSS section of topic.css, when I changed to content to:
But if I wrap that in an oxy_xpath like so:
Thanks.
I have tried a few things and have gotten stuck with trying to use xpath on an external document.
So in the *[class~="topic/xref"][href]:before CSS section of topic.css, when I changed to content to:
I correctly get the path to referenced file (file:/path/on/disk/file.xml), though a message that the file is an unsupported image type.content:url("../img/link.png") "[" attr(href, url) "]";
But if I wrap that in an oxy_xpath like so:
The Author editor throws errors saying:content:url("../img/link.png") "[" oxy_xpath(attr(href, url)) "]";
Is there a trick to using oxy_xpath with an external document?System ID: /Applications/author/modified_frameworks/dita/css_classed/dita.css
Severity: error
Description: [CSS]:XPath failed: XPath failed due to: QName cannot end with colon: {file:}
Thanks.
-
- Posts: 9434
- Joined: Fri Jul 09, 2004 5:18 pm
Re: Show title from xref'ed document in Author mode
Hi James,
There are two problems here, one on your side and one on ours.
You first need to gather some knwwledge about XPath 2.0 expressions:
http://www.w3.org/TR/xpath20/
As expression like this:
is first expanded by Oxygen by expanding the attr function to something like this:
An XPath like this is invalid and meaningless and this is why the XPath execution engine reports the engine:
Basically if you only xref to entire topic files the XPath expression should have been something like:
But this does not work in Oxygen although it should. We'll try to fix this bug in time for Oxygen 13.2 which will appear in January next year.
I'll update this forum post when the issue gets fixed.
Regards,
Radu
There are two problems here, one on your side and one on ours.
You first need to gather some knwwledge about XPath 2.0 expressions:
http://www.w3.org/TR/xpath20/
As expression like this:
Code: Select all
oxy_xpath(attr(href, url))
Code: Select all
oxy_xpath("file:/path/on/disk/file.xml")
Code: Select all
QName cannot end with colon: {file:}
Code: Select all
content:url("../img/link.png") "[" oxy_xpath("if(contains(@href, '#')) then fn:doc(substring-before(@href, '#'))//title[1]/text() else fn:doc(@href)//title[1]/text()") "]";
I'll update this forum post when the issue gets fixed.
Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
<oXygen/> XML Editor
http://www.oxygenxml.com
-
- Posts: 16
- Joined: Thu Nov 03, 2011 3:16 pm
Re: Show title from xref'ed document in Author mode
I finally got some time to experiment with this, and wanted to say that things are working great! I have the basic functionality working, now just need to expand it.
Thank you for the help!
Thank you for the help!
-
- Posts: 16
- Joined: Thu Nov 03, 2011 3:16 pm
Re: Show title from xref'ed document in Author mode
Not sure if this is a bug in Oxygen, or something not right in my CSS.
I have a topic as follows:
and have modified the CSS as follows:
The "title[1]" would imply that it should be pulling the text from the first occurrence of title ("Normal Topic Title"), but when I view the above topic in Author view, I get: "Normal Topic TitleSection Title".
If I change the title[1] to title[2], I get nothing for the title in Author view.
Thoughts?
I have a topic as follows:
Code: Select all
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE concept PUBLIC "-//OASIS//DTD DITA Concept//EN" "concept.dtd">
<concept id="conceptId">
<title>Normal Topic Title</title>
<conbody>
<p>Concept definition.</p>
<section>
<title>Section Title</title>
</section>
</conbody>
</concept>
Code: Select all
*[class~="topic/link"][href]:before,
*[class~="topic/xref"][href]:before {
content:url("../img/link.png") "[" oxy_xpath("if(contains(@href, '#')) then fn:doc(substring-before(@href, '#'))//title[1]/text() else fn:doc(@href)//title[1]/text()") "]";
}
If I change the title[1] to title[2], I get nothing for the title in Author view.
Thoughts?
-
- Posts: 9434
- Joined: Fri Jul 09, 2004 5:18 pm
Re: Show title from xref'ed document in Author mode
Hi James,
My fault, //title[1] means the first title in its parent, it should be more like (//title)[1].
So the CSS property should be like this:
Regards,
Radu
My fault, //title[1] means the first title in its parent, it should be more like (//title)[1].
So the CSS property should be like this:
Code: Select all
content:url("../img/link.png") "[" oxy_xpath("if(contains(@href, '#')) then fn:doc(substring-before(@href, '#'))/(//title)[1]/text() else fn:doc(@href)/(//title)[1]/text()") "]";
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
<oXygen/> XML Editor
http://www.oxygenxml.com
Return to “DITA (Editing and Publishing DITA Content)”
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