Need a refactoring to make navtitle match the topic title - Version 17.1
Oxygen general issues.
-
- Posts: 9434
- Joined: Fri Jul 09, 2004 5:18 pm
Re: Need a refactoring to make navtitle match the topic title - Version 17.1
Hi Sathya,
Newer versions of Oxygen (for example Oxygen 18.1 and newer) have in the Preferences->"DITA" page a special section where you can choose to automatically set the navtitle to the topic title when using our actions to insert topic references.
With Oxygen 17.1 you could create a custom XML Refactoring action based on XSLT which would be applied on the DITA Map, for each topicref it would extract the title from the reference and set the @navtitle attribute to that value:
https://www.oxygenxml.com/doc/versions/ ... tions.html
A refactoring XSLT stylesheet for this would look something like:
Regards,
Radu
Newer versions of Oxygen (for example Oxygen 18.1 and newer) have in the Preferences->"DITA" page a special section where you can choose to automatically set the navtitle to the topic title when using our actions to insert topic references.
With Oxygen 17.1 you could create a custom XML Refactoring action based on XSLT which would be applied on the DITA Map, for each topicref it would extract the title from the reference and set the @navtitle attribute to that value:
https://www.oxygenxml.com/doc/versions/ ... tions.html
A refactoring XSLT stylesheet for this would look something like:
Code: Select all
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
exclude-result-prefixes="xs"
version="2.0">
<xsl:template match="node() | @*">
<xsl:copy>
<xsl:apply-templates select="node() | @*"/>
</xsl:copy>
</xsl:template>
<!-- Get topic title and use it to set navtitle on topicref -->
<xsl:template match="topicref[@href]">
<xsl:copy>
<xsl:apply-templates select="@* except @navtitle"/>
<xsl:attribute name="navtitle"><xsl:value-of select="document(@href)/*/title"/></xsl:attribute>
<xsl:apply-templates select="node()"/>
</xsl:copy>
</xsl:template>
</xsl:stylesheet>
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
<oXygen/> XML Editor
http://www.oxygenxml.com
-
- Posts: 14
- Joined: Thu Oct 27, 2022 6:24 pm
Re: Need a refactoring to make navtitle match the topic title - Version 17.1
Post by craigcharlie »
Hi Radu,
I really appreciate this solution, thanks.
However, I'm seeing an issue in implementation. (Note, in case this is relevant - I'm trying to refactor topics from a Tridion Docs repository.)
I need to refactor not only base DITA topic types, but also topics from the msgRef specialization. So, I am using code like this:
However, I am facing these problems:
Appreciate any advice you can give. Note, I'm currently using Oxygen on a trial basis, as I'm evaluating bringing it into our company for use in tech writing.
thanks,
Charlie
I really appreciate this solution, thanks.
However, I'm seeing an issue in implementation. (Note, in case this is relevant - I'm trying to refactor topics from a Tridion Docs repository.)
I need to refactor not only base DITA topic types, but also topics from the msgRef specialization. So, I am using code like this:
Code: Select all
<xsl:value-of select="document(@href)/*/*[contains(@class, 'topic/title')]/normalize-space()"/>
- the xpath only selects info from base DITA topic types, ie not msgRef. For example, if I use document(@href)//msgId/normalize-space(), nothing is selected
- using *[contains(@class, 'topic/title')] as a selector does not seem to work as expected. This selector only seems to work if I edit the class attribute manually to add "topic/title" - ie, specifically hardcoding the class, instead of depending on values inferred from the DITA DTD. Of note, I have also verified the same behavior with Oxygen's OOTB sample DITA - eg, flowers.ditamap.
Appreciate any advice you can give. Note, I'm currently using Oxygen on a trial basis, as I'm evaluating bringing it into our company for use in tech writing.
thanks,
Charlie
-
- Posts: 9434
- Joined: Fri Jul 09, 2004 5:18 pm
Re: Need a refactoring to make navtitle match the topic title - Version 17.1
Hi Charlie,
This forum thread is from 6 years ago, ideally in such cases you can start a new one.
So your use case is the same, right? Synchronize the navtitle inside the DITA Map with the title defined inside the topic?
How about if you remove all navtitles from the DITA Map instead? Oxygen does not need them for anything, the publishing engine also does not need them for anything.
About your questions:
If you open that topic in Oxygen, you can use Oxygen's "Xpath" toolbar to run queries like "//msgId/normalize-space()", do those queries return anything?
Regards,
Radu
This forum thread is from 6 years ago, ideally in such cases you can start a new one.
So your use case is the same, right? Synchronize the navtitle inside the DITA Map with the title defined inside the topic?
How about if you remove all navtitles from the DITA Map instead? Oxygen does not need them for anything, the publishing engine also does not need them for anything.
About your questions:
I do not know the structure of the "msgRef" topic type, it is not a base DITA topic type so I assume it's a specialization of the DITA DTDs made either by the CMS or specific to your company. Can you post a small example with how the msgRef topic looks like inside?the xpath only selects info from base DITA topic types, ie not msgRef. For example, if I use document(@href)//msgId/normalize-space(), nothing is selected
If you open that topic in Oxygen, you can use Oxygen's "Xpath" toolbar to run queries like "//msgId/normalize-space()", do those queries return anything?
Indeed Oxygen XML refactoring actions do not take the DTD declaration and default attribute values into account, so you need to match the element name and cannot match it by the default @class attribute value specified in the DTDs.using *[contains(@class, 'topic/title')] as a selector does not seem to work as expected. This selector only seems to work if I edit the class attribute manually to add "topic/title" - ie, specifically hardcoding the class, instead of depending on values inferred from the DITA DTD. Of note, I have also verified the same behavior with Oxygen's OOTB sample DITA - eg, flowers.ditamap.
Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
<oXygen/> XML Editor
http://www.oxygenxml.com
-
- Posts: 14
- Joined: Thu Oct 27, 2022 6:24 pm
Re: Need a refactoring to make navtitle match the topic title - Version 17.1
Post by craigcharlie »
Thanks for the reply Radu!
If I use "//msgId/normalize-space()" in the xpath toolbar, it does return the expected result. However the refactoring operation doesn't "see it" - it only seems able to access core DITA elements.
Note that I have been trying to add DTDs via Preferences > XML > Catalog - I added a reference to the Tridion Docs catalog.xml, and unchecked "Use default catalog", but the refactoring statement "document(@href)//msgId/normalize-space()" doesn't return anything. Conversely, "document(@href)//title/normalize-space()" does work correctly, and the title of the concept is written into the map navtitle.
It seems to me that the Refactoring functionality must be relying on the OOTB DTDs, rather than the ones installed by the Tridion Docs plugin. Do you have any information on how I can make those DTDs available to the Refactoring operation?
If I use "//msgId/normalize-space()" in the xpath toolbar, it does return the expected result. However the refactoring operation doesn't "see it" - it only seems able to access core DITA elements.
Note that I have been trying to add DTDs via Preferences > XML > Catalog - I added a reference to the Tridion Docs catalog.xml, and unchecked "Use default catalog", but the refactoring statement "document(@href)//msgId/normalize-space()" doesn't return anything. Conversely, "document(@href)//title/normalize-space()" does work correctly, and the title of the concept is written into the map navtitle.
It seems to me that the Refactoring functionality must be relying on the OOTB DTDs, rather than the ones installed by the Tridion Docs plugin. Do you have any information on how I can make those DTDs available to the Refactoring operation?
-
- Posts: 9434
- Joined: Fri Jul 09, 2004 5:18 pm
Re: Need a refactoring to make navtitle match the topic title - Version 17.1
Hi Charlie,
Does the XML refactoring operation report any error when you run it?
In general when using the document(..) function to load an XML document, if that XML document has a DTD reference, the XSLT processor needs the DTD to be available in order to load the XML document. So it's good that you added your custom XML catalog to the "Preferences > XML > Catalog" page. You should have left the "Use default catalog" checked as it's not an either/or case, the default catalog will be used along with your extra added XML catalogs.
Other than that, if we cannot get to the bottom of this and you are willing to send us some samples to reproduce the problem (support@oxygenxml.com) we can try to look a bit into this on our side.
Regards,
Radu
Does the XML refactoring operation report any error when you run it?
In general when using the document(..) function to load an XML document, if that XML document has a DTD reference, the XSLT processor needs the DTD to be available in order to load the XML document. So it's good that you added your custom XML catalog to the "Preferences > XML > Catalog" page. You should have left the "Use default catalog" checked as it's not an either/or case, the default catalog will be used along with your extra added XML catalogs.
Other than that, if we cannot get to the bottom of this and you are willing to send us some samples to reproduce the problem (support@oxygenxml.com) we can try to look a bit into this on our side.
Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
<oXygen/> XML Editor
http://www.oxygenxml.com
-
- Posts: 14
- Joined: Thu Oct 27, 2022 6:24 pm
Re: Need a refactoring to make navtitle match the topic title - Version 17.1
Post by craigcharlie »
Hi Radu,
Thanks very much for your reply. It's clear more work would be needed to get refactoring working.
On further investigation, I'm actually seeing all expected titles in Map Manager but not Author Mode. I will start a new thread to ask a question about this - my expectation is that the Author Mode behavior should be the same.
thanks,
Charlie
Thanks very much for your reply. It's clear more work would be needed to get refactoring working.
On further investigation, I'm actually seeing all expected titles in Map Manager but not Author Mode. I will start a new thread to ask a question about this - my expectation is that the Author Mode behavior should be the same.
thanks,
Charlie
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