Xref text resolution on elements without title
Post here questions and problems related to editing and publishing DITA content.
-
- Posts: 98
- Joined: Tue Mar 06, 2018 2:07 pm
- Contact:
Xref text resolution on elements without title
Hi,
In DITA if you use an xref without text, that's the title of linked element that it gets in output (PDF,WebHelp).
For example with following code I will have "Go to How To Make." :
But here I will have "Go to."
I would like to manage this last case (linked element without title).
For PDF, in my plugin, I just have to insert this template (it works) :
But for HTML I don't know where I have to do modification.
I try to modify this template, but inside it it seems that xref text are already resolved:
Any idea where xref text for WebHelp (HTML5) are resolved?
Thanks.
In DITA if you use an xref without text, that's the title of linked element that it gets in output (PDF,WebHelp).
For example with following code I will have "Go to How To Make." :
Code: Select all
Go to <xref href="a001" format="dita"/>.
...
<task id="a001">
<title>How To Make</title>
...
Code: Select all
Go to <xref href="a001" format="dita"/>.
...
<stepsection id="ONE-ONE">My stepsection</stepsection>
...
For PDF, in my plugin, I just have to insert this template (it works) :
Code: Select all
<xsl:template match="*[contains(@class, ' task/stepsection ')]" mode="retrieveReferenceTitle">
<xsl:value-of select="."/>
</xsl:template>
I try to modify this template, but inside it it seems that xref text are already resolved:
Code: Select all
<xsl:template match="*[contains(@class, ' topic/xref ')]" name="topic.xref">...
Thanks.
Nicolas Delobel
AmeXio
nicolas.delobel at amexiogroup.com
AmeXio
nicolas.delobel at amexiogroup.com
-
- Posts: 9436
- Joined: Fri Jul 09, 2004 5:18 pm
Re: Xref text resolution on elements without title
Hi Nico,
I think the link texts are resolved for the HTML output in the same XSLT stylesheet in which I advised you here to make changes:
post51896.html
Maybe you can add some xsl:messages in this template:
There is an XSLT extension point called "dita.xsl.topicpull" which may allow you to contribute a DITA OT plugin with a custom XSLT stylesheet to override that:
https://www.dita-ot.org/dev/extension-p ... mport.html
Regards,
Radu
I think the link texts are resolved for the HTML output in the same XSLT stylesheet in which I advised you here to make changes:
post51896.html
Maybe you can add some xsl:messages in this template:
Code: Select all
<xsl:template match="*[dita-ot:is-link(.)]">
https://www.dita-ot.org/dev/extension-p ... mport.html
Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
<oXygen/> XML Editor
http://www.oxygenxml.com
-
- Posts: 98
- Joined: Tue Mar 06, 2018 2:07 pm
- Contact:
Re: Xref text resolution on elements without title
I add a test on text() content on the following template (in topicpullImpl.xsl) and it works.
Thanks Radu for your help.
Code: Select all
<xsl:template match="*" mode="topicpull:resolvelinktext" priority="-1">
<xsl:variable name="target-text">
<xsl:choose>
<xsl:when test="*[contains(@class,' topic/title ')][1]">
<xsl:apply-templates
select="*[contains(@class,' topic/title ')][1]" mode="text-only"/>
</xsl:when>
<!--If there isn't a title ,then process with spectitle -->
<xsl:when test="@spectitle">
<xsl:value-of select="@spectitle"/>
</xsl:when>
<!--If there is text ,then process text -->
<xsl:when test="text()">
<xsl:value-of select="text()"/>
</xsl:when>
<!-- No title, no text or spectitle; check to see if the element provides generated text -->
<xsl:otherwise>
<xsl:apply-templates select="." mode="topicpull:get_generated_text"/>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:if test="exists($target-text)">
<xsl:value-of select="normalize-space($target-text)"/>
</xsl:if>
</xsl:template>
Nicolas Delobel
AmeXio
nicolas.delobel at amexiogroup.com
AmeXio
nicolas.delobel at amexiogroup.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