{"id":782,"date":"2009-07-16T08:55:04","date_gmt":"2009-07-16T15:55:04","guid":{"rendered":"http:\/\/gregbaker.ca\/blog\/?p=782"},"modified":"2009-07-16T11:01:38","modified_gmt":"2009-07-16T18:01:38","slug":"custom-classes-in-docbook-to-html-conversion","status":"publish","type":"post","link":"http:\/\/gregbaker.ca\/blog\/2009\/07\/16\/custom-classes-in-docbook-to-html-conversion\/","title":{"rendered":"Custom classes in Docbook to HTML conversion"},"content":{"rendered":"<p>Maybe I should have a tag for &#8220;boring technical notes that I&#8217;m writing so others can Google them later&#8221;.<\/p>\n<p>Anyway&hellip; if you&#8217;re converting a Docbook document to HTML, and want customized classes on elements (so you can hit them with CSS), first <a href=\"http:\/\/www.sagehill.net\/docbookxsl\/CustomMethods.html#CustomizationLayer\">create a custom XSL style<\/a> for the document (and use with <code>xmlto&nbsp;-m<\/code>).<\/p>\n<p>Then suppose you have <code>&lt;code language=\"html\"&gt;<\/code> in the Docbook and want that to have classes <code>html<\/code> and <code>xml<\/code> to hold on to in the resulting HTML.  Add this:<\/p>\n<blockquote><p><code>&lt;xsl:template match=\"code[@language = 'html']\" mode=\"class.value\"&gt;<br \/>html xml<br \/>&lt;\/xsl:template&gt;<\/code><\/p><\/blockquote>\n<p>The <code>match<\/code> can be any XSL matching pattern.  The contents can also be a <code>&lt;xsl:value-of&gt;<\/code> if you want to do something more advanced.<\/p>\n<p>Maybe it&#8217;s because I&#8217;m an XSL newb, but I haven&#8217;t seen this explained nicely anywhere else.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Maybe I should have a tag for &#8220;boring technical notes that I&#8217;m writing so others can Google them later&#8221;. Anyway&hellip; if you&#8217;re converting a Docbook document to HTML, and want customized classes on elements (so you can hit them with CSS), first create a custom XSL style for the document (and use with xmlto&nbsp;-m). Then [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[10],"tags":[],"class_list":["post-782","post","type-post","status-publish","format-standard","hentry","category-tech"],"_links":{"self":[{"href":"http:\/\/gregbaker.ca\/blog\/wp-json\/wp\/v2\/posts\/782","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/gregbaker.ca\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/gregbaker.ca\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/gregbaker.ca\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"http:\/\/gregbaker.ca\/blog\/wp-json\/wp\/v2\/comments?post=782"}],"version-history":[{"count":10,"href":"http:\/\/gregbaker.ca\/blog\/wp-json\/wp\/v2\/posts\/782\/revisions"}],"predecessor-version":[{"id":792,"href":"http:\/\/gregbaker.ca\/blog\/wp-json\/wp\/v2\/posts\/782\/revisions\/792"}],"wp:attachment":[{"href":"http:\/\/gregbaker.ca\/blog\/wp-json\/wp\/v2\/media?parent=782"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/gregbaker.ca\/blog\/wp-json\/wp\/v2\/categories?post=782"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/gregbaker.ca\/blog\/wp-json\/wp\/v2\/tags?post=782"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}