Skip to content

Commit 263e596

Browse files
committed
Simplified topic, link directly to feature in WH userguide
1 parent 5d32aad commit 263e596

File tree

1 file changed

+7
-68
lines changed

1 file changed

+7
-68
lines changed

topics/adding_labels_to_topics_in_the_webhelp_responsive_output.dita

Lines changed: 7 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -57,73 +57,12 @@
5757
<p>To have special styling for the inserted labels when editing, you can customize the
5858
CSS stylesheets used for DITA editing: <xref href="customizeDITACSS.dita"/>.</p>
5959
</section>
60-
<section id="section_fvs_4s1_xrb"><title>Factoring Labels When Publishing</title><p>DITA
61-
WebHelp output can be customized using a <xref
62-
href="https://www.oxygenxml.com/doc/ug-editor/topics/whr_publishing_template_contents.html"
63-
format="html" scope="external">publishing template mechanism</xref>. Inside a
64-
publishing template folder, there is an <filepath>opt</filepath> file that can
65-
contain links to various XSLT stylesheets that are useful for customizations. For
66-
example, we'll add a link to a stylesheet for processing such special keyword label
67-
elements:<codeblock id="codeblock_cfr_ft1_xrb" outputclass="language-xml">&lt;publishing-template>
68-
&lt;name>.....&lt;/name>
69-
......
70-
&lt;xslt>
71-
....
72-
&lt;extension file="xslt/labels-show.xsl" id="com.oxygenxml.webhelp.xsl.dita2webhelp"/>
73-
.....
74-
&lt;/xslt>
75-
&lt;/webhelp>
76-
&lt;/publishing-template></codeblock>The <filepath>labels-show.xsl</filepath>
77-
stylesheet will match all labels and display them after the title of each topic. For
78-
each label, it will have a link to search the entire documentation for the same
79-
label:<codeblock id="codeblock_b3f_k1b_xrb" outputclass="language-xml">&lt;xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
80-
xmlns:xs="http://www.w3.org/2001/XMLSchema"
81-
exclude-result-prefixes="xs"
82-
version="2.0">
83-
&lt;xsl:template match="*[contains(@class, ' topic/prolog ')]">
84-
&lt;!-- create a special div which displays all labels, with a link on each label -->
85-
&lt;xsl:if test=".//keyword[@outputclass = 'label']">
86-
&lt;div style="width:100%; text-align: right; font-style:italic; color:gray;">Labels:
87-
&lt;xsl:apply-templates select=".//keyword[@outputclass = 'label']"/>
88-
&lt;/div>
89-
&lt;/xsl:if>
90-
&lt;xsl:next-match/>
91-
&lt;/xsl:template>
92-
93-
&lt;!-- Match a label keyword and display it as a span -->
94-
&lt;xsl:template match="keyword[@outputclass = 'label']">
95-
&lt;a
96-
href="{concat('../search.html?searchQuery=label_', normalize-space(translate(text(), ' ', '_')))}">
97-
&lt;span style="background-color:deepskyblue;color:white;border-radius: 6px;margin:0.2em;padding:0.2em;"
98-
>&lt;xsl:value-of select="text()"/>&lt;/span>
99-
&lt;/a>
100-
&lt;/xsl:template>
101-
102-
&lt;!-- Add specific HTML meta elements for each label -->
103-
&lt;xsl:template match="*" mode="gen-keywords-metadata">
104-
&lt;xsl:next-match/>
105-
&lt;xsl:variable name="keywords-content">
106-
&lt;!-- for each label -->
107-
&lt;xsl:for-each select="//keyword[@outputclass = 'label']">
108-
&lt;xsl:value-of
109-
select="concat('label_', normalize-space(translate(text(), ' ', '_')))"/>
110-
&lt;xsl:if test="position() &amp;lt; last()">
111-
&lt;xsl:text>, &lt;/xsl:text>
112-
&lt;/xsl:if>
113-
&lt;/xsl:for-each>
114-
&lt;/xsl:variable>
115-
116-
&lt;xsl:if test="string-length($keywords-content) > 0">
117-
&lt;meta name="keywords" content="{$keywords-content}"/>
118-
&lt;/xsl:if>
119-
&lt;/xsl:template>
120-
&lt;/xsl:stylesheet></codeblock></p><p>The end result displays labels defined in
121-
each topic and allows you to click on each label and find all topics with the same
122-
label.</p><image href="../images/webhelp-labels.png" id="image_hzy_kbb_xrb"
123-
scale="40"/><p>The Oxygen blog uses this customization and some of the articles in
124-
the blog have labels defined on them: <xref
125-
href="../branchFilters/branchFilter.dita"/>.</p>The WebHelp publishing template
126-
used for publishing this blog already has a customization to display labels in the blog
127-
articles: <xref href="https://github.com/oxygenxml/blog/tree/master/publishing/webhelpBlogTemplate" format="html" scope="external"/>.</section>
60+
<section id="section_fvs_4s1_xrb">
61+
<title>Factoring Labels When Publishing</title>
62+
<p>The <xref
63+
href="https://www.oxygenxml.com/doc/ug-webhelp-responsive/topics/wh-labels.html"
64+
format="html" scope="external">WebHelp publishing</xref> by default creates
65+
visual labels in the published output.</p>
66+
</section>
12867
</body>
12968
</topic>

0 commit comments

Comments
 (0)