From: Norman W. <nw...@us...> - 2001-04-04 11:47:35
|
Update of /cvsroot/docbook/xsl/htmlhelp In directory usw-pr-cvs1:/tmp/cvs-serv11325/htmlhelp Added Files: README htmlhelp-common.xsl htmlhelp.xsl langcodes.xml xthtmlhelp.xsl Log Message: Added HTML Help and Java Help --- NEW FILE --- README for the HTML Help DocBook Stylesheet =========================================== This is simple stylesheet which can be used to generate source files for HTML Help. HTML Help is format which is used by newer Windows applications and by Windows operating system itself. It allows you to pack set of HTML files and images into one file and attach TOC, index and fulltext search capability to it. More informations about HTML Help format and HTML Help Workshop tool can be found at http://msdn.microsoft.com/library/tools/htmlhelp/chm/hh1start.htm. This stylesheet is based on the XSL DocBook Stylesheet distribution (especially on JavaHelp code) from Norman Walsh. This stylesheet imports chunk.xsl, thus set of HTML files is created in usual way. Additionally is created file htmlhelp.hhp which is project file for HTML Help Compiler and toc.hhc which holds structure of your document. Language identifier of HTML Help is taken from the top most element in your DocBook source. This is perfectly legal for documents in only one language. If language is not set, US English is defaulted. There is one problem - MS language codes are country sensitive, and this information is not available in DocBook source. If stylesheet selects bad code for you, edit langcodes.xml file, and remove all entries which have yours language code, but are located in inappropriate country. Title of whole HTML Help is taken from first title element in document. Fulltext searching is automatically on. If your document contains index terms, they are automatically converted to ActiveX, which is recognized by HTML Help compiler. If you are generating HTML Help for non-Western Europe languages, you should change output encoding of your files, because HTML Help compiler improperly handles UTF-8 and even character entities in TOC file and index entries. This can be easily done by "driver" file like this: <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> <xsl:output encoding="windows-1250"/> <xsl:import href="<path to file.../contrib/htmlhelp/docbook.xsl...>"/> </xsl:stylesheet> Currently only XT processor is supported, support for other processors may be added in the future. If you have any comments and suggestion about this stylesheet feel free to contact author at <ji...@ko...>. --- NEW FILE --- <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" exclude-result-prefixes="doc" version="1.0"> <!-- ******************************************************************** $Id: htmlhelp-common.xsl,v 1.1 2001/04/04 11:47:30 nwalsh Exp $ ******************************************************************** This file is used by htmlhelp.xsl if you want to generate source files for HTML Help. It is based on the XSL DocBook Stylesheet distribution (especially on JavaHelp code) from Norman Walsh. ******************************************************************** --> <!-- ==================================================================== --> <xsl:param name="htmlhelp.encoding" select="'iso-8859-1'"/> <doc:param name="htmlhelp.encoding" xmlns=""> <refpurpose>Character encoding to use in files for HTML Help compiler.</refpurpose> <refdescription> <para>HTML Help Compiler is not UTF-8 aware, so you should always use apropriate single-byte encoding here.</para> </refdescription> </doc:param> <xsl:param name="suppress.navigation" select="1"/> <!-- ==================================================================== --> <xsl:template match="/"> <xsl:apply-templates/> <xsl:call-template name="hhp"/> <xsl:call-template name="hhc"/> </xsl:template> <!-- ==================================================================== --> <xsl:template name="hhp"> <xsl:call-template name="write.text.chunk"> <xsl:with-param name="filename" select="'htmlhelp.hhp'"/> <xsl:with-param name="method" select="'text'"/> <xsl:with-param name="content"> <xsl:call-template name="hhp-main"/> </xsl:with-param> <xsl:with-param name="encoding" select="$htmlhelp.encoding"/> </xsl:call-template> </xsl:template> <!-- ==================================================================== --> <xsl:template name="hhp-main"> <xsl:text>[OPTIONS] </xsl:text> <xsl:if test="//indexterm"> <xsl:text>Auto Index=Yes </xsl:text></xsl:if> <xsl:text>Compatibility=1.1 or later Compiled file=htmlhelp.chm Contents file=toc.hhc Default topic=</xsl:text> <xsl:call-template name="make-relative-filename"> <xsl:with-param name="base.dir" select="$base.dir"/> <xsl:with-param name="base.name"> <xsl:apply-templates mode="chunk-filename" select="/"/> </xsl:with-param> </xsl:call-template> <xsl:text> Display compile progress=No Full-text search=Yes Language=</xsl:text> <xsl:if test="//@lang"> <xsl:variable name="lang" select="//@lang[1]"/> <xsl:value-of select="document('langcodes.xml')//gentext[@lang=string($lang)]"/> </xsl:if> <xsl:if test="not(//@lang)"> <xsl:text>0x0409 English (United States) </xsl:text></xsl:if> <xsl:text> Title=</xsl:text><xsl:value-of select="//title[1]"/> <xsl:text> [FILES] </xsl:text> <xsl:apply-templates mode="enumerate-files"/> </xsl:template> <!-- ==================================================================== --> <xsl:template match="set|book|part|preface|chapter|appendix |article |reference|refentry |sect1[position()>1] |section[position()>1 and name(parent::*) != 'section'] |book/glossary|article/glossary |book/bibliography|article/bibliography |colophon" mode="enumerate-files"> <xsl:variable name="ischunk"><xsl:call-template name="chunk"/></xsl:variable> <xsl:if test="$ischunk='1'"> <xsl:call-template name="make-relative-filename"> <xsl:with-param name="base.dir" select="$base.dir"/> <xsl:with-param name="base.name"> <xsl:apply-templates mode="chunk-filename" select="."/> </xsl:with-param> </xsl:call-template> <xsl:text> </xsl:text> </xsl:if> <xsl:apply-templates select="*" mode="enumerate-files"/> </xsl:template> <xsl:template match="text()" mode="enumerate-files"> </xsl:template> <!-- ==================================================================== --> <!-- Following templates are not nice. It is because MS help compiler is unable to process correct HTML files. We must generate following weird stuff instead. --> <xsl:template name="hhc"> <xsl:call-template name="write.text.chunk"> <xsl:with-param name="filename" select="'toc.hhc'"/> <xsl:with-param name="method" select="'text'"/> <xsl:with-param name="content"> <xsl:call-template name="hhc-main"/> </xsl:with-param> <xsl:with-param name="encoding" select="$htmlhelp.encoding"/> </xsl:call-template> </xsl:template> <xsl:template name="hhc-main"> <xsl:text><HTML> <HEAD> </HEAD> <BODY> <OBJECT type="text/site properties"> <param name="ImageType" value="Folder"> </OBJECT> <UL> </xsl:text> <xsl:apply-templates select="." mode="hhc"/> <xsl:text></UL> </BODY> </HTML></xsl:text> </xsl:template> <xsl:template match="set" mode="hhc"> <xsl:variable name="title"> <xsl:apply-templates select="." mode="title.markup"/> </xsl:variable> <xsl:text><LI> <OBJECT type="text/sitemap"> <param name="Name" value="</xsl:text> <xsl:value-of select="$title"/> <xsl:text>"> <param name="Local" value="</xsl:text> <xsl:call-template name="href.target.with.base.dir"/> <xsl:text>"> </OBJECT></xsl:text> <xsl:if test="book"> <xsl:text><UL></xsl:text> <xsl:apply-templates select="book" mode="hhc"/> <xsl:text></UL></xsl:text> </xsl:if> </xsl:template> <xsl:template match="book" mode="hhc"> <xsl:variable name="title"> <xsl:apply-templates select="." mode="title.markup"/> </xsl:variable> <xsl:text><LI> <OBJECT type="text/sitemap"> <param name="Name" value="</xsl:text> <xsl:value-of select="$title"/> <xsl:text>"> <param name="Local" value="</xsl:text> <xsl:call-template name="href.target.with.base.dir"/> <xsl:text>"> </OBJECT></xsl:text> <xsl:if test="part|reference|preface|chapter|appendix|article"> <xsl:text><UL></xsl:text> <xsl:apply-templates select="part|reference|preface|chapter|appendix|article" mode="hhc"/> <xsl:text></UL></xsl:text> </xsl:if> </xsl:template> <xsl:template match="part|reference|preface|chapter|appendix|article" mode="hhc"> <xsl:variable name="title"> <xsl:apply-templates select="." mode="title.markup"/> </xsl:variable> <xsl:text><LI> <OBJECT type="text/sitemap"> <param name="Name" value="</xsl:text> <xsl:value-of select="$title"/> <xsl:text>"> <param name="Local" value="</xsl:text> <xsl:call-template name="href.target.with.base.dir"/> <xsl:text>"> </OBJECT></xsl:text> <xsl:if test="reference|preface|chapter|appendix|refentry|section|sect1"> <xsl:text><UL></xsl:text> <xsl:apply-templates select="reference|preface|chapter|appendix|refentry|section|sect1" mode="hhc"/> <xsl:text></UL></xsl:text> </xsl:if> </xsl:template> <xsl:template match="section" mode="hhc"> <xsl:variable name="title"> <xsl:apply-templates select="." mode="title.markup"/> </xsl:variable> <xsl:text><LI> <OBJECT type="text/sitemap"> <param name="Name" value="</xsl:text> <xsl:value-of select="$title"/> <xsl:text>"> <param name="Local" value="</xsl:text> <xsl:call-template name="href.target.with.base.dir"/> <xsl:text>"> </OBJECT></xsl:text> <xsl:if test="section"> <xsl:text><UL></xsl:text> <xsl:apply-templates select="section" mode="hhc"/> <xsl:text></UL></xsl:text> </xsl:if> </xsl:template> <xsl:template match="sect1" mode="hhc"> <xsl:variable name="title"> <xsl:apply-templates select="." mode="title.markup"/> </xsl:variable> <xsl:text><LI> <OBJECT type="text/sitemap"> <param name="Name" value="</xsl:text> <xsl:value-of select="$title"/> <xsl:text>"> <param name="Local" value="</xsl:text> <xsl:call-template name="href.target.with.base.dir"/> <xsl:text>"> </OBJECT></xsl:text> <xsl:if test="sect2"> <xsl:text><UL></xsl:text> <xsl:apply-templates select="sect2" mode="hhc"/> <xsl:text></UL></xsl:text> </xsl:if> </xsl:template> <xsl:template match="sect2" mode="hhc"> <xsl:variable name="title"> <xsl:apply-templates select="." mode="title.markup"/> </xsl:variable> <xsl:text><LI> <OBJECT type="text/sitemap"> <param name="Name" value="</xsl:text> <xsl:value-of select="$title"/> <xsl:text>"> <param name="Local" value="</xsl:text> <xsl:call-template name="href.target.with.base.dir"/> <xsl:text>"> </OBJECT></xsl:text> <xsl:if test="sect3"> <xsl:text><UL></xsl:text> <xsl:apply-templates select="sect3" mode="hhc"/> <xsl:text></UL></xsl:text> </xsl:if> </xsl:template> <xsl:template match="sect3" mode="hhc"> <xsl:variable name="title"> <xsl:apply-templates select="." mode="title.markup"/> </xsl:variable> <xsl:text><LI> <OBJECT type="text/sitemap"> <param name="Name" value="</xsl:text> <xsl:value-of select="$title"/> <xsl:text>"> <param name="Local" value="</xsl:text> <xsl:call-template name="href.target.with.base.dir"/> <xsl:text>"> </OBJECT></xsl:text> <xsl:if test="sect4"> <xsl:text><UL></xsl:text> <xsl:apply-templates select="sect4" mode="hhc"/> <xsl:text></UL></xsl:text> </xsl:if> </xsl:template> <xsl:template match="sect4" mode="hhc"> <xsl:variable name="title"> <xsl:apply-templates select="." mode="title.markup"/> </xsl:variable> <xsl:text><LI> <OBJECT type="text/sitemap"> <param name="Name" value="</xsl:text> <xsl:value-of select="$title"/> <xsl:text>"> <param name="Local" value="</xsl:text> <xsl:call-template name="href.target.with.base.dir"/> <xsl:text>"> </OBJECT></xsl:text> <xsl:if test="sect5"> <xsl:text><UL></xsl:text> <xsl:apply-templates select="sect5" mode="hhc"/> <xsl:text></UL></xsl:text> </xsl:if> </xsl:template> <xsl:template match="sect5|refentry" mode="hhc"> <xsl:variable name="title"> <xsl:apply-templates select="." mode="title.markup"/> </xsl:variable> <xsl:text><LI> <OBJECT type="text/sitemap"> <param name="Name" value="</xsl:text> <xsl:value-of select="$title"/> <xsl:text>"> <param name="Local" value="</xsl:text> <xsl:call-template name="href.target.with.base.dir"/> <xsl:text>"> </OBJECT></xsl:text> </xsl:template> <!-- ==================================================================== --> <xsl:template match="indexterm"> <xsl:variable name="text"> <xsl:value-of select="primary"/> <xsl:if test="secondary"> <xsl:text>, </xsl:text> <xsl:value-of select="secondary"/> </xsl:if> <xsl:if test="tertiary"> <xsl:text>, </xsl:text> <xsl:value-of select="tertiary"/> </xsl:if> </xsl:variable> <OBJECT type="application/x-oleobject" classid="clsid:1e2a7bd0-dab9-11d0-b93a-00c04fc99f9e"> <param name="Keyword" value="{$text}"/> </OBJECT> </xsl:template> <!-- ==================================================================== --> <xsl:template name="href.target.with.base.dir"> <xsl:value-of select="$base.dir"/> <xsl:call-template name="href.target"/> </xsl:template> </xsl:stylesheet> --- NEW FILE --- <?xml version="1.0"?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:doc="http://nwalsh.com/xsl/documentation/1.0" version="1.0" exclude-result-prefixes="doc"> <xsl:import href="../html/chunk.xsl"/> <xsl:include href="htmlhelp-common.xsl"/> <xsl:template name="write.text.chunk"> <xsl:param name="filename" select="''"/> <xsl:param name="method" select="'text'"/> <xsl:param name="content" select="''"/> <xsl:param name="encoding" select="'iso-8859-1'"/> <xsl:call-template name="write.chunk"> <xsl:with-param name="filename" select="$filename"/> <xsl:with-param name="method" select="$method"/> <xsl:with-param name="content" select="$content"/> <xsl:with-param name="encoding" select="$encoding"/> </xsl:call-template> </xsl:template> </xsl:stylesheet> --- NEW FILE --- <?xml version="1.0" encoding="utf-8"?> <localization> <gentext lang="sq">0x041c Albanian</gentext> <gentext lang="ar">0x1401 Arabic (ALGERIA)</gentext> <gentext lang="es">0x2c0a Spanish (ARGENTINA)</gentext> <gentext lang="en">0x0c09 English (AUSTRALIA)</gentext> <gentext lang="de">0x0c07 German (AUSTRIA)</gentext> <gentext lang="ar">0x3c01 Arabic (BAHRAIN)</gentext> <gentext lang="be">0x0423 Byelorussian</gentext> <gentext lang="fr">0x080c French (BELGIUM)</gentext> <gentext lang="en">0x2809 English (BELIZE)</gentext> <gentext lang="es">0x400a Spanish (BOLIVIA)</gentext> <gentext lang="pt">0x0416 Portuguese (BRAZIL)</gentext> <gentext lang="ms">0x083e Malay (BRUNEI DARUSSALAM)</gentext> <gentext lang="bg">0x0402 Bulgarian</gentext> <gentext lang="fr">0x0c0c French (CANADA)</gentext> <gentext lang="es">0x340a Spanish (CHILE)</gentext> <gentext lang="zh">0x0804 Chinese (CHINA)</gentext> <gentext lang="es">0x240a Spanish (COLOMBIA)</gentext> <gentext lang="es">0x140a Spanish (COSTA RICA)</gentext> <gentext lang="hr">0x041a Croatian</gentext> <gentext lang="cs">0x0405 Czech</gentext> <gentext lang="da">0x0406 Danish</gentext> <gentext lang="es">0x1c0a Spanish (DOMINICAN REPUBLIC)</gentext> <gentext lang="es">0x300a Spanish (ECUADOR)</gentext> <gentext lang="ar">0x0c01 Arabic (EGYPT)</gentext> <gentext lang="es">0x440a Spanish (EL SALVADOR)</gentext> <gentext lang="et">0x0425 Estonian</gentext> <gentext lang="fo">0x0438 Faeroese</gentext> <gentext lang="fi">0x040b Finnish</gentext> <gentext lang="fr">0x040c French (FRANCE)</gentext> <gentext lang="de">0x0407 German (GERMANY)</gentext> <gentext lang="el">0x0408 Greek</gentext> <gentext lang="es">0x100a Spanish (GUATEMALA)</gentext> <gentext lang="es">0x480a Spanish (HONDURAS)</gentext> <gentext lang="zh">0x0c04 Chinese (HONG KONG)</gentext> <gentext lang="hu">0x040e Hungarian</gentext> <gentext lang="is">0x040f Icelandic</gentext> <gentext lang="hi">0x0439 Hindi</gentext> <gentext lang="in">0x04</gentext> <gentext lang="fa">0x0429 Farsi</gentext> <gentext lang="ar">0x0801 Arabic (IRAQ)</gentext> <gentext lang="en">0x1809 English (IRELAND)</gentext> <gentext lang="iw">0x04</gentext> <gentext lang="it">0x0410 Italian</gentext> <gentext lang="en">0x2009 English (JAMAICA)</gentext> <gentext lang="ja">0x0411 Japanese</gentext> <gentext lang="ar">0x2c01 Arabic (JORDAN)</gentext> <gentext lang="sw">0x0441 Swahili</gentext> <gentext lang="ko">0x0412 Korean</gentext> <gentext lang="ar">0x3401 Arabic (KUWAIT)</gentext> <gentext lang="lv">0x0426 Latvian (Lettish)</gentext> <gentext lang="ar">0x3001 Arabic (LEBANON)</gentext> <gentext lang="ar">0x1001 Arabic (LIBYAN ARAB JAMAHIRIYA)</gentext> <gentext lang="de">0x1407 German (LIECHTENSTEIN)</gentext> <gentext lang="lt">0x0427 Lithuanian</gentext> <gentext lang="de">0x1007 German (LUXEMBOURG)</gentext> <gentext lang="zh">0x1404 Chinese (MACAU)</gentext> <gentext lang="mk">0x042f Macedonian</gentext> <gentext lang="ms">0x043e Malay (MALAYSIA)</gentext> <gentext lang="es">0x080a Spanish (MEXICO)</gentext> <gentext lang="fr">0x180c French (MONACO)</gentext> <gentext lang="ar">0x1801 Arabic (MOROCCO)</gentext> <gentext lang="nl">0x0413 Dutch</gentext> <gentext lang="en">0x1409 English (NEW ZEALAND)</gentext> <gentext lang="es">0x4c0a Spanish (NICARAGUA)</gentext> <gentext lang="no">0x0414 Norwegian</gentext> <gentext lang="ar">0x2001 Arabic (OMAN)</gentext> <gentext lang="ur">0x0420 Urdu</gentext> <gentext lang="es">0x180a Spanish (PANAMA)</gentext> <gentext lang="es">0x3c0a Spanish (PARAGUAY)</gentext> <gentext lang="es">0x280a Spanish (PERU)</gentext> <gentext lang="en">0x3409 English (PHILIPPINES)</gentext> <gentext lang="pl">0x0415 Polish</gentext> <gentext lang="pt">0x0816 Portuguese (PORTUGAL)</gentext> <gentext lang="es">0x500a Spanish (PUERTO RICO)</gentext> <gentext lang="ar">0x4001 Arabic (QATAR)</gentext> <gentext lang="ro">0x0418 Romanian</gentext> <gentext lang="ru">0x0419 Russian</gentext> <gentext lang="ar">0x0401 Arabic (SAUDI ARABIA)</gentext> <gentext lang="zh">0x1004 Chinese (SINGAPORE)</gentext> <gentext lang="sk">0x041b Slovak</gentext> <gentext lang="sl">0x0424 Slovenian</gentext> <gentext lang="af">0x0436 Afrikaans</gentext> <gentext lang="ca">0x0403 Catalan</gentext> <gentext lang="sv">0x041d Swedish</gentext> <gentext lang="de">0x0807 German (SWITZERLAND)</gentext> <gentext lang="ar">0x2801 Arabic (SYRIAN ARAB REPUBLIC)</gentext> <gentext lang="zh">0x0404 Chinese (TAIWAN, PROVINCE OF CHINA)</gentext> <gentext lang="th">0x041e Thai</gentext> <gentext lang="en">0x2c09 English (TRINIDAD AND TOBAGO)</gentext> <gentext lang="ar">0x1c01 Arabic (TUNISIA)</gentext> <gentext lang="tr">0x041f Turkish</gentext> <gentext lang="uk">0x0422 Ukrainian</gentext> <gentext lang="ar">0x3801 Arabic (UNITED ARAB EMIRATES)</gentext> <gentext lang="en">0x0809 English (UNITED KINGDOM)</gentext> <gentext lang="en">0x0409 English (UNITED STATES)</gentext> <gentext lang="es">0x380a Spanish (URUGUAY)</gentext> <gentext lang="es">0x200a Spanish (VENEZUELA)</gentext> <gentext lang="vi">0x242a Vietnamese</gentext> <gentext lang="ar">0x2401 Arabic (YEMEN)</gentext> <gentext lang="en">0x3009 English (ZIMBABWE)</gentext> </localization> --- NEW FILE --- <?xml version="1.0"?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xt="http://www.jclark.com/xt" extension-element-prefixes="xt" version="1.0"> <xsl:import href="../html/xtchunk.xsl"/> <xsl:include href="htmlhelp-common.xsl"/> <xsl:template name="write.text.chunk"> <xsl:param name="filename" select="''"/> <xsl:param name="method" select="'html'"/> <xsl:param name="content" select="''"/> <xsl:param name="encoding" select="'iso-8859-1'"/> <!-- XT bug, if method is an AVT, it doesn't work --> <!-- encoding doesn't work as an AVT either --> <xt:document method="text" href="{$filename}" encoding="iso-8859-1"> <xsl:copy-of select="$content"/> </xt:document> </xsl:template> </xsl:stylesheet> |