Is there a stylesheet for abbreviated-form

Post here questions and problems related to editing and publishing DITA content.
reinierk
Posts: 36
Joined: Tue Feb 21, 2012 8:22 pm
Location: Rotterdam, the Netherlands
Contact:

Is there a stylesheet for abbreviated-form

Post by reinierk »

Looking at the style-sheets I do not see styles for <abbreviated-form>. DITA states:
Renderers should follow these rules when displaying an <abbreviated-form> element that refers to a glossentry topic:
1. In an introductory context, processors SHOULD render the surface form of the term by displaying the contents of the glossSurfaceForm element from the referenced glossentry topic.
2. If the glossentry topic does not contain a glossSurfaceForm element or the glossSurfaceForm element is empty, processors SHOULD render the contents of the glossterm element in introductory contexts.
3. In non-introductory contexts, processors SHOULD render the abbreviated form of the term by displaying the contents of the <glossAcronym> element from the referenced glossentry topic.
4. If the glossentry topic does not contain a glossAcronym element or the glossAcronym element is empty, processors SHOULD render the contents of the glossterm element in non-introductory contexts.
So this is no trivial style! My XPATH skills are not enough to determine if a particular abbreviated-form element with keyref="x" is the FIRST appearance of that exact type of element... Once you have determined that is is some form of xsl:choose to figure out the correct form to render...
Kind Regards,
Reinier Kleipool,
Course Materials editor,
Open Source Academy
http://www.OpenSourceAcademy.eu
Radu
Posts: 9049
Joined: Fri Jul 09, 2004 5:18 pm

Re: Is there a stylesheet for abbreviated-form

Post by Radu »

Hi Reinier,

The latest DITA OT distribution (1.7.1) has fixes for handling the <abbreviated-form> element in the PDF output:

https://github.com/dita-ot/dita-ot/issues/1193

So you should try to download and install it separately, then edit your transformation scenarios from Oxygen to use it instead of the bundled DITA OT (which is 1.6.1):

http://www.oxygenxml.com/doc/ug-oxygen/ ... ta-ot.html

Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
mstrubberg
Posts: 48
Joined: Sat Jan 26, 2013 6:07 pm

Re: Is there a stylesheet for abbreviated-form

Post by mstrubberg »

When will Oxygen incorporate DITA 1.7.1?
Radu
Posts: 9049
Joined: Fri Jul 09, 2004 5:18 pm

Re: Is there a stylesheet for abbreviated-form

Post by Radu »

Hi,

Oxygen 15.0 which should be released in 3-4 months will come with DITA OT 1.7.1 (or probably newer) out of the box.
As Oxygen 14.2 is the last of the 14.x I just wanted it to use a version of the DITA OT which was already tested in 14.1 and which did not require developers to re-implement certain customizations.

If you want, just contact us (support@oxygenxml.com) and I could try to provide you with an Oxygen 15 beta.

Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
reinierk
Posts: 36
Joined: Tue Feb 21, 2012 8:22 pm
Location: Rotterdam, the Netherlands
Contact:

Re: Is there a stylesheet for abbreviated-form

Post by reinierk »

I just backported the abbreviated form as a customization. It is not hard to do.
(But looks like I may need to abandon this customization in Oxygen 15.0)
Kind Regards,
Reinier Kleipool,
Course Materials editor,
Open Source Academy
http://www.OpenSourceAcademy.eu
Radu
Posts: 9049
Joined: Fri Jul 09, 2004 5:18 pm

Re: Is there a stylesheet for abbreviated-form

Post by Radu »

Hi Reinier,

As far as I know, besides XSLT changes there also were changes in the Java code from the dost.jar library so just making the XSLT changes in DITA OT 1.6.1 might not be enough.
Did the abbreviated-form in the PDF work properly for you after you ported the XSLT changes?

Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
reinierk
Posts: 36
Joined: Tue Feb 21, 2012 8:22 pm
Location: Rotterdam, the Netherlands
Contact:

Re: Is there a stylesheet for abbreviated-form

Post by reinierk »

Yes, I am very happy with the result. No problems. I have to make a small change to the topic/phrase template that is called from abbreviated-form.
Kind Regards,
Reinier Kleipool,
Course Materials editor,
Open Source Academy
http://www.OpenSourceAcademy.eu
mstrubberg
Posts: 48
Joined: Sat Jan 26, 2013 6:07 pm

Re: Is there a stylesheet for abbreviated-form

Post by mstrubberg »

I'm using Oxygen 16.0. I want to use the abbreviated-form element to manage how glossary entries are managed within a single topic on first and subsequent occurrences'. I created these files:
<glossentry> g_AntiLockBreaks.xml with <glossSurfaceForm>Anti-lock Braking System (ABS)and <glossAcronym>ABS

Code: Select all


<map id="m_StandaloneMasterMap" print="yes" xml:lang="en-US">
<title>Standalone Master Map</title>
<glossref href="g_AntiLockBreaks.xml" keys="abskey" print="yes"/>
<topicref format="dita" href="c_ConceptUsingGlossaryTerm.xml" scope="local" type="concept"/>
</map>
c_ConceptUsingGlossaryTerm.xml contains:

Code: Select all


<p>An <abbreviated-form keyref="abskey"/> helps a driver to stop. For this reason, many find an
<abbreviated-form keyref="abskey"/> useful.</p>
While the PDF output successfully renders abbreviated-form using the glossSurfaceForm text on first occurrence and the <glossAcronym> text on each subsequent occurrence, the PDF map also is composing the <glossref> to the glossary term in the output.

QUESTION: How do I prevent the <glossref> from rendering the actual glossary term in PDF output but maintain the ability to compose glossarySurfaceForm and glossAcronym content through <abbreviated-form>?
Radu
Posts: 9049
Joined: Fri Jul 09, 2004 5:18 pm

Re: Is there a stylesheet for abbreviated-form

Post by Radu »

Hi,

Let me see if I understand exactly what you want:

The referenced glossentry topic also appears as a separate topic in the published PDF. And you would like it not to appear at all in the PDF.

This can probably be achieved with an XSLT customization of the DITA Open Toolkit. Our policy in this regard is to help with advice but we do not perform such customizations ourselves. Such a customization would probably not be an easy one and would probably require changes in multiple XSLT stylesheets in order to avoid the topic being present both in the content and in the table of contents and bookmarks section.
So maybe you could ask around on the DITA Users List to see if somebody else did this in the past and if there are any recommendations for the places where to make the modifications.

Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
mstrubberg
Posts: 48
Joined: Sat Jan 26, 2013 6:07 pm

Re: Is there a stylesheet for abbreviated-form

Post by mstrubberg »

Radu,

When the key definition to the glossary term is defined in the map using a <topicref>, <keydef>, or <glossref> the desired output when the key is called in <abbreviated-form> is successful in HTML output.

Only when <glossref> is the key definition and the <glossref @print = yes>, will the <abbreviated-form> in topics render properly in the PDF. But because print = yes, the glossary term itself also appears in the PDF as the first topic in the map (I suppose I could move the <glossref> key definition to the end of the map so the glossary term is the last topic in the map). If I set print = no, then the <abbreviated-form> does not render the key binding to the glossary term in the PDF.

So it appears the glossary term topic also be present in the map for <abbreviated-form> to be used in PDF output as described in:
https://www.oasis-open.org/committees/d ... cronym.pdf
https://groups.yahoo.com/neo/groups/dit ... pics/32110

If there's another way to build this linkage without XSL customization, I'd be interested as this is a very useful feature.
Radu
Posts: 9049
Joined: Fri Jul 09, 2004 5:18 pm

Re: Is there a stylesheet for abbreviated-form

Post by Radu »

Hi,

I added an issue for this on the DITA OT Bugs List and we'll see if we get some feedback for it:

https://github.com/dita-ot/dita-ot/issues/1721

Indeed, for now you should at least move your glossref to the end of the map in order to avoid having this content appear very early in the PDF.

Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
shudson310
Posts: 156
Joined: Sat Feb 26, 2005 12:09 am
Location: USA
Contact:

Re: Is there a stylesheet for abbreviated-form

Post by shudson310 »

I am using DITA-OT v2.2.5 and have a similar problem. I actually WANT the link from the first occurrence of the <abbreviated-form> to the related glossary term.

What I would like to override is the generation of the link from the glossAcronym that is used on subsequent references.

I've tried a few overrides in abbrev-domain.xsl, but it doesn't seem to work:

Code: Select all

  <xsl:template match="*" mode="getMatchingAcronym">
<xsl:variable name="glossAcronym" select="*[contains(@class, ' glossentry/glossBody ')]/*[contains(@class, ' glossentry/glossAlt ')]/*[contains(@class, ' glossentry/glossAcronym ')]"/>
<xsl:choose>
<xsl:when test="$glossAcronym">
<!--<xsl:apply-templates select="$glossAcronym[1]/node()"/>-->
<xsl:value-of select="$glossAcronym[1]/node()"/>
</xsl:when>
<xsl:otherwise>
<xsl:apply-templates select="*[contains(@class, ' glossentry/glossterm ')]/node()"/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
But the link is still generated. Any ideas how to achieve this override?
Scott Hudson
Staff Content Engineer
Site: docs.servicenow.com
Radu
Posts: 9049
Joined: Fri Jul 09, 2004 5:18 pm

Re: Is there a stylesheet for abbreviated-form

Post by Radu »

Hi Scott,

I'm not sure what exactly you did, how you customized the XSLT, if you made direct changes, if you used a customization folder or plugin...
Maybe initially you could modify directly the XSLT located in the DITA OT, just to see if that works, add some xsl:message's in the template:

Code: Select all

<xsl:template match="*[contains(@class,' abbrev-d/abbreviated-form ')]" name="topic.abbreviated-form">
to see for what element it gets called and what decisions it takes...

Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
shudson310
Posts: 156
Joined: Sat Feb 26, 2005 12:09 am
Location: USA
Contact:

Re: Is there a stylesheet for abbreviated-form

Post by shudson310 »

Hi Radu,
I explicitly changed the following template:

Code: Select all

<xsl:template match="*" mode="getMatchingAcronym">
<xsl:variable name="glossAcronym" select="*[contains(@class, ' glossentry/glossBody ')]/*[contains(@class, ' glossentry/glossAlt ')]/*[contains(@class, ' glossentry/glossAcronym ')]"/>
<xsl:choose>
<xsl:when test="$glossAcronym">
<!--<xsl:apply-templates select="$glossAcronym[1]/node()"/>-->
<xsl:value-of select="$glossAcronym[1]/node()"/>
</xsl:when>
<xsl:otherwise>
<xsl:apply-templates select="*[contains(@class, ' glossentry/glossterm ')]/node()"/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
Such that I changed the apply-templates to a value-of, hoping that this would just deliver the text of the acronym without creating a link back to the glossary entry. The problem is that I do want the link on the first use of the term (glossSurfaceForm), but not on all of the subsequent uses (glossAcronym). I would even be OK changing the link color to match the text to "hide" it, but I don't see any style differentiation in the topic.fo
Scott Hudson
Staff Content Engineer
Site: docs.servicenow.com
shudson310
Posts: 156
Joined: Sat Feb 26, 2005 12:09 am
Location: USA
Contact:

Re: Is there a stylesheet for abbreviated-form

Post by shudson310 »

I created the fix.
in abbrev-domain.xsl, I added a new param to indicate whether it was an acronym:

Code: Select all

<xsl:template match="*[contains(@class,' abbrev-d/abbreviated-form ')]" name="topic.abbreviated-form">
<xsl:variable name="keys" select="@keyref"/>
<xsl:variable name="target" select="key('id', substring(@href, 2))"/>
<!--HSX for glossentries under glossgroup, we need to extract the glossgroup's id (substring-before( .. '/' ..)
to access the key('id') function which only collects level-1 items.

To get the glossentry itself (which we want in gletarget), we need to addres that of the glossentries
who's id matches the href of the current node
-->
<xsl:variable name="gletarget"
select="key('id', substring(substring-before(@href, '/'), 2))/glossentry[@id = substring-after(current()/@href, '/')]"/>

<xsl:choose>
<xsl:when test="$keys and $gletarget/self::*[contains(@class,' glossentry/glossentry ')]">
<xsl:call-template name="topic.term">
<xsl:with-param name="contents">
<xsl:variable name="use-abbreviated-form" as="xs:boolean">
<xsl:apply-templates select="." mode="use-abbreviated-form"/>
</xsl:variable>
<xsl:choose>
<xsl:when test="$use-abbreviated-form">
<xsl:apply-templates select="$gletarget" mode="getMatchingAcronym"/>
</xsl:when>
<xsl:otherwise>
<xsl:apply-templates select="$gletarget" mode="getMatchingSurfaceForm"/>
</xsl:otherwise>
</xsl:choose>
</xsl:with-param>
</xsl:call-template>
</xsl:when>
<xsl:when test="$keys and $target/self::*[contains(@class,' glossentry/glossentry ')]">
<xsl:call-template name="topic.term">
<xsl:with-param name="contents">
<xsl:variable name="use-abbreviated-form" as="xs:boolean">
<xsl:apply-templates select="." mode="use-abbreviated-form"/>
</xsl:variable>
<xsl:choose>
<xsl:when test="$use-abbreviated-form">
<xsl:apply-templates select="$target" mode="getMatchingAcronym"/>
</xsl:when>
<xsl:otherwise>
<xsl:apply-templates select="$target" mode="getMatchingSurfaceForm"/>
</xsl:otherwise>
</xsl:choose>
</xsl:with-param>
<xsl:with-param name="acronym">
<xsl:variable name="use-abbreviated-form" as="xs:boolean">
<xsl:apply-templates select="." mode="use-abbreviated-form"/>
</xsl:variable>
<xsl:choose>
<xsl:when test="$use-abbreviated-form">yes</xsl:when>
<xsl:otherwise />
</xsl:choose>
</xsl:with-param>
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<xsl:apply-templates select="." mode="ditamsg:no-glossentry-for-abbreviated-form">
<xsl:with-param name="keys" select="$keys"/>
</xsl:apply-templates>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
and in commons.xsl, when the acronym param is passed='yes', I remove the basic-link and just copy the contents:

Code: Select all

 <xsl:template match="*[contains(@class,' topic/term ')]" name="topic.term">
<xsl:param name="keys" select="@keyref" as="attribute()?"/>
<xsl:param name="contents" as="node()*">
<xsl:variable name="target" select="key('id', substring(@href, 2))"/>
<xsl:choose>
<xsl:when test="not(normalize-space(.)) and $keys and $target/self::*[contains(@class,' topic/topic ')]">
<xsl:apply-templates select="$target/*[contains(@class, ' topic/title ')]/node()"/>
</xsl:when>
<xsl:otherwise>
<xsl:apply-templates/>
</xsl:otherwise>
</xsl:choose>
</xsl:param>
<xsl:param name="acronym" />
<xsl:variable name="topicref" select="key('map-id', substring(@href, 2))"/>
<xsl:choose>
<xsl:when test="$acronym='yes'">
<xsl:copy-of select="$contents"/>
</xsl:when>
<xsl:when test="$keys and @href and not($topicref/ancestor-or-self::*[@linking][1]/@linking = ('none', 'sourceonly'))">
<fo:basic-link xsl:use-attribute-sets="xref term">
<xsl:call-template name="commonattributes"/>
<xsl:call-template name="buildBasicLinkDestination"/>
<xsl:copy-of select="$contents"/>
</fo:basic-link>
</xsl:when>
<xsl:otherwise>
<fo:inline xsl:use-attribute-sets="term">
<xsl:call-template name="commonattributes"/>
<xsl:copy-of select="$contents"/>
</fo:inline>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
Hopefully this will help someone else looking for similar functionality!
Scott Hudson
Staff Content Engineer
Site: docs.servicenow.com
Post Reply