| 1 | <?xml version='1.0' encoding="UTF-8"?> |
1 | <?xml version='1.0' encoding="UTF-8"?> |
| 2 | <?xml-stylesheet href="/xsl/guide.xsl" type="text/xsl"?> |
|
|
| 3 | |
|
|
| 4 | <!DOCTYPE guide SYSTEM "/dtd/guide.dtd"> |
2 | <!DOCTYPE guide SYSTEM "/dtd/guide.dtd"> |
| 5 | |
3 | |
| 6 | <guide link="/doc/en/xml-guide.xml"> |
4 | <guide link="/doc/en/xml-guide.xml"> |
| 7 | <title>Gentoo Linux Documentation Guide</title> |
5 | <title>Gentoo Linux XML Guide</title> |
| 8 | <author title="Chief Architect"><mail link="drobbins@gentoo.org">Daniel Robbins</mail></author> |
6 | <author title="Author"><mail link="drobbins@gentoo.org">Daniel Robbins</mail></author> |
|
|
7 | <author title="Author"><mail link="zhen@gentoo.org">John P. Davis</mail></author> |
|
|
8 | <author title="Editor"><mail link="peesh@gentoo.org">Jorge Paulo</mail></author> |
| 9 | |
9 | |
| 10 | <abstract>This guide shows you how to compose web documentation using the new lightweight Gentoo guide |
10 | <abstract>This guide shows you how to compose web documentation using the new lightweight Gentoo guide |
| 11 | XML syntax. This syntax is the official format for Gentoo Linux documentation, and this document |
11 | XML syntax. This syntax is the official format for Gentoo Linux documentation, and this document |
| 12 | itself was created using guide XML. This guide assumes a basic working knowledge of XML and HTML. |
12 | itself was created using guide XML. This guide assumes a basic working knowledge of XML and HTML. |
| 13 | </abstract> |
13 | </abstract> |
| 14 | |
14 | |
| 15 | <version>1.0</version> |
15 | <version>2.0</version> |
| 16 | <date>07 Mar 2002</date> |
16 | <date>15 April 2003</date> |
| 17 | |
17 | |
| 18 | <chapter> |
18 | <chapter> |
| 19 | <title>Guide basics</title> |
19 | <title>Guide basics</title> |
| 20 | |
20 | |
| 21 | <section> |
21 | <section> |
| … | |
… | |
| 38 | <title>How to transform guide XML into HTML</title> |
38 | <title>How to transform guide XML into HTML</title> |
| 39 | <body> |
39 | <body> |
| 40 | |
40 | |
| 41 | <p> Before we take a look at the guide syntax itself, it's helpful to know how |
41 | <p> Before we take a look at the guide syntax itself, it's helpful to know how |
| 42 | guide XML is transformed into web-ready HTML. To do this, we use a special |
42 | guide XML is transformed into web-ready HTML. To do this, we use a special |
| 43 | file called <path>guide-main.xsl</path>, along with a command-line XSLT processing |
43 | file called <path>guide.xsl</path>, along with a command-line XSLT processing |
| 44 | tool (also called an "engine"). The <path>guide-main.xsl</path> file describes |
44 | tool (also called an "engine"). The <path>guide.xsl</path> file describes |
| 45 | exactly how to transform the contents of the source guide XML document to |
45 | exactly how to transform the contents of the source guide XML document to |
| 46 | create the target HTML file. Two popular XSLT processors are <c>sabcmd</c> |
46 | create the target HTML file. The processing tool that Gentoo Linux uses |
| 47 | (included in the <path>app-text/sablotron</path> package) and <c>xsltproc</c> |
47 | is called <c>xsltproc</c>, which is found in the <i>libxslt</i> package. </p> |
| 48 | (found in the <path>dev-libs/libxslt</path> package). From experience, we've |
|
|
| 49 | found that <c>xsltproc</c> is the higher-quality and more feature-rich XSLT |
|
|
| 50 | processor. </p> |
|
|
| 51 | |
48 | |
| 52 | <p> Once you have either <c>xsltproc</c> or <c>sabcmd</c> installed, you're |
|
|
| 53 | ready to convert guide XML into web-ready HTML. Here's how it works. First, |
|
|
| 54 | download the latest snapshot of our Web site from |
|
|
| 55 | <uri>http://www.gentoo.org/projects/xml.html</uri>, found in the <uri |
|
|
| 56 | link="http://www.gentoo.org/projects/guide-xml-latest.tar.gz">xml-guide-latest.tar.gz</uri> |
|
|
| 57 | file. Extract the tarball. Inside it, you'll find a <path>gentoo-src</path> |
|
|
| 58 | directory, as well as a <path>gentoo-src/xml</path> directory, etc. Now, find |
|
|
| 59 | <path>gentoo-src/xml/install.xml</path>. (The new user installation guide). |
|
|
| 60 | This will be our source XML guide document. The easiest way to perform the |
|
|
| 61 | transformation is to change directories to the location of the |
|
|
| 62 | <path>guide-main.xsl</path> file. Then, execute <c>xsltproc</c> as follows: |
|
|
| 63 | </p> |
|
|
| 64 | |
49 | |
|
|
50 | <pre caption="Installing libxslt"> |
|
|
51 | # <c>emerge libxslt</c> |
| 65 | <pre> |
52 | </pre> |
| 66 | # <i>cd gentoo-web/xsl</i> |
53 | |
|
|
54 | <p>Now that we have the way, we need the means, so to speak. In other words, |
|
|
55 | we need some Gentoo XML documents to transform. Gentoo has two types of tarballs |
|
|
56 | that are available for download: </p> |
|
|
57 | |
|
|
58 | <p><b>The first type contains the entire up-to-date Gentoo Linux website</b>. |
|
|
59 | Included are our XSL templates, so if you are planning to transform any documentation, |
|
|
60 | you will need this tarball. The tarball can be found |
|
|
61 | <uri link="http://www.gentoo.org/dyn/arch/xml-guide-latest.tar.gz">here</uri>.</p> |
|
|
62 | |
|
|
63 | <p><b>The second type contains daily snapshots our XML documentation source</b> in |
|
|
64 | every language that we offer. Please note that it is impossible to transform |
|
|
65 | documentation with this tarball, so please download the web tarball if you want to fully |
|
|
66 | develop your own documentation. These tarballs are especially useful for translators. |
|
|
67 | These tarballs can be found <uri link="http://www.gentoo.org/dyn/doc-snapshots">here</uri>. |
|
|
68 | </p> |
|
|
69 | |
|
|
70 | <p>After the web tarball is downloaded and extracted, go |
|
|
71 | to the directory where the tarball was extracted, and enter the |
|
|
72 | <path>htdocs</path> directory. Browse around and get comfortable with the |
|
|
73 | layout, but note the <path>xsl</path> and <path>doc</path> directories. |
|
|
74 | As you might have guessed, the XSL stylesheets are in <path>xsl</path>, |
|
|
75 | and our documentation is in <path>doc</path>. For testing purposes, we |
|
|
76 | will be using the Gentoo Linux CD Installation Guide, located at |
|
|
77 | <path>doc/en/gentoo-x86-install.xml</path>. Now that the locations |
|
|
78 | of the XSL and XML file are known, we can do some transforming with |
|
|
79 | <c>xsltproc</c>. </p> |
|
|
80 | |
|
|
81 | <pre caption="Transforming gentoo-x86-install.xml"> |
| 67 | # <i>xsltproc guide-main.xsl ../xml/install.xml > /tmp/install.html</i> |
82 | # <c>xsltproc xsl/guide.xsl doc/en/gentoo-x86-install.xml > /tmp/install.html</c> |
| 68 | </pre> |
83 | </pre> |
| 69 | |
84 | |
| 70 | <p> If all went well, you should have a web-ready version of |
85 | <p> If all went well, you should have a web-ready version of |
| 71 | <path>install.xml</path> at <path>/tmp/install.html</path>. For this document |
86 | <path>gentoo-x86-install.xml</path> at <path>/tmp/install.html</path>. For this document |
| 72 | to display properly in a web browser, you may have to copy some files from |
87 | to display properly in a web browser, you may have to copy some files from |
| 73 | <path>gentoo-web</path> to <path>/tmp</path>, such |
88 | <path>htdocs</path> to <path>/tmp</path>, such |
| 74 | as <path>css/main-new.css</path> and (to be safe) the entire <path>images</path> |
89 | as <path>css/main.css</path> and (to be safe) the entire <path>images</path> |
| 75 | directory. |
90 | directory. |
| 76 | </p> |
91 | </p> |
| 77 | |
92 | |
| 78 | </body> |
93 | </body> |
| 79 | </section> |
94 | </section> |
| … | |
… | |
| 87 | <p>Now that you know how to transform guide XML, you're ready to start learning |
102 | <p>Now that you know how to transform guide XML, you're ready to start learning |
| 88 | the guide XML syntax. We'll start with the the initial tags used in a guide |
103 | the guide XML syntax. We'll start with the the initial tags used in a guide |
| 89 | XML document: </p> |
104 | XML document: </p> |
| 90 | |
105 | |
| 91 | <pre caption="The initial part of a guide XML document"> |
106 | <pre caption="The initial part of a guide XML document"> |
| 92 | <?xml version='1.0'?> |
107 | <?xml version='1.0' encoding="UTF-8"?> |
| 93 | <guide> |
108 | <guide link="relative_link_to_your_guide"> |
| 94 | <title><i>Gentoo Linux Documentation Guide</i></title> |
109 | <title><i>Gentoo Linux Documentation Guide</i></title> |
| 95 | <author title="<i>Chief Architect</i>"><mail link="<i>drobbins@gentoo.org</i>"> |
110 | <author title="<i>Chief Architect</i>"><mail link="<i>drobbins@gentoo.org</i>"> |
| 96 | <i>Daniel Robbins</i></mail> |
111 | <i>Daniel Robbins</i></mail> |
| 97 | </author> |
112 | </author> |
| 98 | <author title="<i>Editor</i>"><mail link="<i>thomasfl@gentoo.org</i>"> |
113 | <author title="<i>Editor</i>"><mail link="<i>thomasfl@gentoo.org</i>"> |
| … | |
… | |
| 358 | <body> |
373 | <body> |
| 359 | <p>Guide has been specially designed to be "lean and mean" so that developers |
374 | <p>Guide has been specially designed to be "lean and mean" so that developers |
| 360 | can spend more time writing documentation and less time learning the actual XML |
375 | can spend more time writing documentation and less time learning the actual XML |
| 361 | syntax. Hopefully, this will allow developers who aren't unusually "doc-savvy" |
376 | syntax. Hopefully, this will allow developers who aren't unusually "doc-savvy" |
| 362 | to start writing quality Gentoo Linux documentation. If you'd like to help (or have any questions about guide), please |
377 | to start writing quality Gentoo Linux documentation. If you'd like to help (or have any questions about guide), please |
| 363 | post a message to <mail link="gentoo-dev@gentoo.org">the gentoo-dev mailing list</mail> |
378 | post a message to the <mail link="gentoo-doc@gentoo.org">gentoo-doc mailing list</mail> |
| 364 | stating what you'd like to tackle. |
379 | stating what you'd like to tackle. |
| 365 | Have fun!</p> |
380 | Have fun!</p> |
| 366 | </body> |
381 | </body> |
| 367 | </section> |
382 | </section> |
| 368 | </chapter> |
383 | </chapter> |