keyref page numbers
Post here questions and problems related to editing and publishing DITA content.
keyref page numbers
Hello,
Is there a way to add page numbers to keyrefs in the PDF output? How about to xrefs that use text input by the writer instead of pulling the title of the topic?
I have looked through links.xsl and found the insertPageNumberCitation template, and I can see where the text, "on page" gets inserted by the On the page variable in the en.xml file, but I don't see/understand the logic for keyrefs and author-input text.
Thanks.
Is there a way to add page numbers to keyrefs in the PDF output? How about to xrefs that use text input by the writer instead of pulling the title of the topic?
I have looked through links.xsl and found the insertPageNumberCitation template, and I can see where the text, "on page" gets inserted by the On the page variable in the en.xml file, but I don't see/understand the logic for keyrefs and author-input text.
Thanks.
Re: keyref page numbers
Hi,
I'm not sure what you mean by keyrefs and author-input text?
Do you mean a <ph keyref="..."</ph> where the key is defined in the DITA Map and mapped to a keyword?
Or do you mean an xref with a keyref?
For the former, this is not generated as a link.
For the latter, from what I rememeber the page number appears only if you leave the <xref/> empty, once you start adding text to it both the link text and the the page number are no longer computed.
What you can do is to define the link text directly on the keydef:
and then refer to the key in another topic like:
Regards,
Radu
I'm not sure what you mean by keyrefs and author-input text?
Do you mean a <ph keyref="..."</ph> where the key is defined in the DITA Map and mapped to a keyword?
Or do you mean an xref with a keyref?
For the former, this is not generated as a link.
For the latter, from what I rememeber the page number appears only if you leave the <xref/> empty, once you start adding text to it both the link text and the the page number are no longer computed.
What you can do is to define the link text directly on the keydef:
Code: Select all
<topicref href="topics/introduction.dita" keys="introduction">
<topicmeta>
<linktext>MY CUSTOM TEXT</linktext>
</topicmeta>
</topicref>
Code: Select all
<xref keyref="introduction"/>
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
<oXygen/> XML Editor
http://www.oxygenxml.com
Re: keyref page numbers
Hi Radu,
Sorry for the confusion. I'm actually talking about both xrefs and keyrefs. As you mentioned, when I put custom text into the xref, the page number is not displayed in the output. Is there a way to make it display the page number?
For keyrefs, I don't get a page number at all, regardless of whether the link text is computed or I type text in. Is there a way to display the page number for kerefs in both instances?
Thanks.
Kyla
Sorry for the confusion. I'm actually talking about both xrefs and keyrefs. As you mentioned, when I put custom text into the xref, the page number is not displayed in the output. Is there a way to make it display the page number?
For keyrefs, I don't get a page number at all, regardless of whether the link text is computed or I type text in. Is there a way to display the page number for kerefs in both instances?
Thanks.
Kyla
Re: keyref page numbers
Hi Kyla,
So:
https://github.com/dita-ot/dita-ot/issues/2617
But you can probably achieve this behavior if you customize the PDF output with a plugin or a customization folder.
In the XSLT stylesheet:
OXYGEN_INSTALL_DIR/frameworks/dita/DITA-OT2.x/plugins/org.dita.pdf2/xsl/fo/links.xsl
you can search for 1880097, it's the ID of the issue in which the decision was made not to present the page number.
What DITA OT version are you using? Are you using Oxygen's bundled DITA OT or an external one?
Regards,
Radu
So:
There is no setting for this right now, I added an issue for this:As you mentioned, when I put custom text into the xref, the page number is not displayed in the output. Is there a way to make it display the page number?
https://github.com/dita-ot/dita-ot/issues/2617
But you can probably achieve this behavior if you customize the PDF output with a plugin or a customization folder.
In the XSLT stylesheet:
OXYGEN_INSTALL_DIR/frameworks/dita/DITA-OT2.x/plugins/org.dita.pdf2/xsl/fo/links.xsl
you can search for 1880097, it's the ID of the issue in which the decision was made not to present the page number.
I cannot reproduce this behavior, could you tell me more how the key that you refer to is defined in the DITA Map? The workaround I gave you in the previous post worked for me.For keyrefs, I don't get a page number at all, regardless of whether the link text is computed or I type text in.
What DITA OT version are you using? Are you using Oxygen's bundled DITA OT or an external one?
Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
<oXygen/> XML Editor
http://www.oxygenxml.com
Re: keyref page numbers
Thanks Radhu,
I think I've found the XSLT template that I need to change to get page numbers for the xrefs with author-entered text. For the keyrefs, I have a couple in my front matter that do not produce page numbers, though the links build fine and work in the output. I am currently using Oxygen 15.1, but will soon upgrade to 18. Is this something that is a result of using the older DITA OT?
The link in my file looks like this:
The key in my map looks like this:
I think I've found the XSLT template that I need to change to get page numbers for the xrefs with author-entered text. For the keyrefs, I have a couple in my front matter that do not produce page numbers, though the links build fine and work in the output. I am currently using Oxygen 15.1, but will soon upgrade to 18. Is this something that is a result of using the older DITA OT?
The link in my file looks like this:
Code: Select all
<xref keyref="xref_environ_specs"/>
Code: Select all
<chapter locktitle="yes" navtitle="CHAPTER 9 Power and Environmental Specifications"
href="nexus_dr/topics/Operator_Chapter_PowerAndEnvironmentalSpecs.dita"
keys="xref_environ_specs"/>
Re: keyref page numbers
Hi Radhu,
I figured out how to turn on page numbers for cross-references where the author has entered the text to display in the output link. I'll post it here in case anyone else needs it.
1. In your customization, add the links.xml file to the fo\xsl directory, and add the appropriate import statement to custom.xml.
2. Set the relative path to the output-message.xsl import statement because you're using the links.xml file in the customization directory or plugin.
3. Find the following code in links.xml
4. Comment out the <xsl:if test="not(processing-instruction()[name()='ditaot'][.='usertext'])"> statement leaving only the <xsl:call-template name="insertPageNumberCitation"> statement active:
I figured out how to turn on page numbers for cross-references where the author has entered the text to display in the output link. I'll post it here in case anyone else needs it.
1. In your customization, add the links.xml file to the fo\xsl directory, and add the appropriate import statement to custom.xml.
2. Set the relative path to the output-message.xsl import statement because you're using the links.xml file in the customization directory or plugin.
3. Find the following code in links.xml
Code: Select all
<xsl:if test="not(@scope = 'external' or @format = 'html') and not($referenceTitle = '') and not($element[contains(@class, ' topic/fn ')])">
<!-- SourceForge bug 1880097: should not include page number when xref includes author specified text -->
<xsl:if test="not(processing-instruction()[name()='ditaot'][.='usertext'])">
<xsl:call-template name="insertPageNumberCitation">
<xsl:with-param name="destination" select="$destination"/>
<xsl:with-param name="element" select="$element"/>
</xsl:call-template>
</xsl:if></xsl:if>
Code: Select all
<xsl:if test="not(@scope = 'external' or @format = 'html') and not($referenceTitle = '') and not($element[contains(@class, ' topic/fn ')])">
<!-- SourceForge bug 1880097: should not include page number when xref includes author specified text -->
<!-- <xsl:if test="not(processing-instruction()[name()='ditaot'][.='usertext'])"> -->
<xsl:call-template name="insertPageNumberCitation">
<xsl:with-param name="destination" select="$destination"/>
<xsl:with-param name="element" select="$element"/>
</xsl:call-template>
<!-- </xsl:if> -->
</xsl:if>
Re: keyref page numbers
Hi,
Thanks for posting a more precise sequence of steps.
About this step:
There is a best practice for PDF customizations here:
http://www.dita-ot.org/dev/dev_ref/pdf- ... tices.html
Regards,
Radu
Thanks for posting a more precise sequence of steps.
About this step:
You should avoid as possible copying an entire XSLT stylesheet from the base PDF XSLTs to the customization directory. You should directly copy inside the custom.xsl only the XSLT template that you want to override.In your customization, add the links.xml file to the fo\xsl directory, and add the appropriate import statement to custom.xml.
There is a best practice for PDF customizations here:
http://www.dita-ot.org/dev/dev_ref/pdf- ... tices.html
meaning that if for example a new DITA OT comes out with new changes to templates in the base "links.xsl", you will not benefit of those changes because you have overridden all xsl:templates from the "links.xsl".Avoid copying entire DITA-OT files into your customization plug-in. When you only copy the attribute sets and templates that you need to override, there is less risk of impact from new features or fixes in the base code, making your code more stable and easier to upgrade between releases.
Regards,
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