|
57 | 57 | <p>To have special styling for the inserted labels when editing, you can customize the
|
58 | 58 | CSS stylesheets used for DITA editing: <xref href="customizeDITACSS.dita"/>.</p>
|
59 | 59 | </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"><publishing-template> |
68 |
| - <name>.....</name> |
69 |
| - ...... |
70 |
| - <xslt> |
71 |
| - .... |
72 |
| - <extension file="xslt/labels-show.xsl" id="com.oxygenxml.webhelp.xsl.dita2webhelp"/> |
73 |
| - ..... |
74 |
| - </xslt> |
75 |
| - </webhelp> |
76 |
| -</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"><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 |
| - <xsl:template match="*[contains(@class, ' topic/prolog ')]"> |
84 |
| - <!-- create a special div which displays all labels, with a link on each label --> |
85 |
| - <xsl:if test=".//keyword[@outputclass = 'label']"> |
86 |
| - <div style="width:100%; text-align: right; font-style:italic; color:gray;">Labels: |
87 |
| - <xsl:apply-templates select=".//keyword[@outputclass = 'label']"/> |
88 |
| - </div> |
89 |
| - </xsl:if> |
90 |
| - <xsl:next-match/> |
91 |
| - </xsl:template> |
92 |
| - |
93 |
| - <!-- Match a label keyword and display it as a span --> |
94 |
| - <xsl:template match="keyword[@outputclass = 'label']"> |
95 |
| - <a |
96 |
| - href="{concat('../search.html?searchQuery=label_', normalize-space(translate(text(), ' ', '_')))}"> |
97 |
| - <span style="background-color:deepskyblue;color:white;border-radius: 6px;margin:0.2em;padding:0.2em;" |
98 |
| - ><xsl:value-of select="text()"/></span> |
99 |
| - </a> |
100 |
| - </xsl:template> |
101 |
| - |
102 |
| - <!-- Add specific HTML meta elements for each label --> |
103 |
| - <xsl:template match="*" mode="gen-keywords-metadata"> |
104 |
| - <xsl:next-match/> |
105 |
| - <xsl:variable name="keywords-content"> |
106 |
| - <!-- for each label --> |
107 |
| - <xsl:for-each select="//keyword[@outputclass = 'label']"> |
108 |
| - <xsl:value-of |
109 |
| - select="concat('label_', normalize-space(translate(text(), ' ', '_')))"/> |
110 |
| - <xsl:if test="position() &lt; last()"> |
111 |
| - <xsl:text>, </xsl:text> |
112 |
| - </xsl:if> |
113 |
| - </xsl:for-each> |
114 |
| - </xsl:variable> |
115 |
| - |
116 |
| - <xsl:if test="string-length($keywords-content) > 0"> |
117 |
| - <meta name="keywords" content="{$keywords-content}"/> |
118 |
| - </xsl:if> |
119 |
| - </xsl:template> |
120 |
| -</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> |
128 | 67 | </body>
|
129 | 68 | </topic>
|
0 commit comments