Page 1 of 1

DITA Metrics Report: need @conkeyref support

Posted: Sun Mar 01, 2015 7:50 pm
by lief.erickson
Hello--

The DITA Metrics report provides a lot good information, but it's incomplete. It does not provide reuse statistics for any @conkeyref. I'd like to add support for that. (Even better would be if oXygen had default support for it. I know others would like to see it, too. http://www.oxygenxml.com/pipermail/oxyg ... 04799.html)

I have been able to enhance the files in frameworks\dita\report to show me how many @conkeyref are used and what elements they appear in. What I can't figure out is how to "gather all the key definitions that form the keyspace - these can be placed in a variable that is used then to lookup for the corresponding node in the resolve.xsl stylesheet when we match on an element having a conkeyref on it" as George Bina wrote in the above post from October 2013. I'm guessing that if this were easy oXygen would already have this support.

Is there template or stylesheet that someone could point me to that might give me some hints on how to do this?

-Lief

Re: DITA Metrics Report: need @conkeyref support

Posted: Tue Mar 03, 2015 1:19 am
by george
Hi Lief,

Well, it is not that difficult... I just implemented support for determining the key space and handling topicref/@keyref and @conkeyref and this will be generally available in the next oXygen release. If you need this now please contact us directly at support@oxygenxml.com and I will send you the updated XSLT scripts.

Best Regards,
George

Re: DITA Metrics Report: need @conkeyref support

Posted: Tue Mar 03, 2015 2:29 am
by lief.erickson
A message has been sent. Thanks, George.

Re: DITA Metrics Report: need @conkeyref support

Posted: Wed Jun 15, 2016 6:08 pm
by Frank Ralf
Hi George,

Is this feature already implemented in oXygen 16?

Best regards,
Frank

Re: DITA Metrics Report: need @conkeyref support

Posted: Thu Jun 16, 2016 2:48 pm
by george
Hi Frank,

I think I implemented this in 18.0 or 17.1 - I do not remember exactly - just update to version 18 and you should have it there.

Regards,
George

Re: DITA Metrics Report: need @conkeyref support

Posted: Thu Jun 16, 2016 4:03 pm
by Frank Ralf
Hi George,

Thanks for this information. Our client is still on oXygen 16.1 but I will have a look in oXygen 17 or 18.

Kind regards,
Frank

Re: DITA Metrics Report: need @conkeyref support

Posted: Thu Jun 16, 2016 4:33 pm
by Frank Ralf
It's there in oXygen 17.1, in Oxygen XML Editor 17\frameworks\dita\report\report.xsl

Code: Select all

 
<!-- CONKEYREFs -->
<xsl:template match="*[@conkeyref]" mode="resolve-base resolve">
<xsl:param name="keyspace" tunnel="yes"/>
<xsl:variable name="key" select="if (contains(@conkeyref, '/')) then substring-before(@conkeyref, '/') else @conkeyref"/>
<xsl:variable name="elementID" select="substring-after(@conkeyref, '/')"/>
<xsl:variable name="keydef" select="$keyspace/oxyd:keyspace/oxyd:key[@value=$key]"/>
<xsl:variable name="topicFile" select="$keydef/*[1]/document(@href, .)"/>
<oxyd:conref element="{name()}" key="{$key}">
<xsl:attribute name="xml:base" select="document-uri($topicFile)"/>
<xsl:apply-templates select="if ($elementID = '') then $topicFile/* else $topicFile//*[@id=$elementID]" mode="#current"/>
</oxyd:conref>
</xsl:template>
Frank

Re: DITA Metrics Report: need @conkeyref support

Posted: Thu Jun 16, 2016 4:37 pm
by Frank Ralf
EDIT:

The above code resides in Oxygen XML Editor 17\frameworks\dita\report\modules\resolve.xsl

Frank

Re: DITA Metrics Report: need @conkeyref support

Posted: Thu Jun 16, 2016 5:21 pm
by Frank Ralf
I've just created a report from the same DITA map with the oXygen 16.1 and oXygen 17.1 versions of the report script. I don't quite understand the results because the oXygen 17 version reports more reused elements (because of the @conkeyref'ed elements) and words but a lover reuse percentage. How can that be?

Frank
Content reuse - oXygen 16 - without @conkeyref
Total reused words (words in conref content) 52,328. Content reuse percentage (words) is 24.74%.
Total reused elements (elements in conref content) 11,464. Elements reuse percentage is 9.13%.
Total content reference elements 27.
Content reuse - oXygen 17 - with @conkeyref
Total reused words (words in conref content) 52,511. Content reuse percentage (words) is 22.19%.
Total reused elements (elements in conref content) 11,784. Elements reuse percentage is 7.85%.
Total content reference elements 334.

Re: DITA Metrics Report: need @conkeyref support

Posted: Mon Jun 20, 2016 4:04 pm
by george
Hi Frank,

You need to check the "Total words" value and the "Total topic elements" - these are the values that represent 100% of words and topic elements, respectively.

Best Regards,
George

Re: DITA Metrics Report: need @conkeyref support

Posted: Tue Jul 05, 2016 2:41 pm
by Frank Ralf
Hi George,

Thanks for the clarification.

Kind regards,
Frank