The translation is temporarily closed for contributions due to maintenance, please come back later.

Source string Read only

(itstool) path: step/programlisting
Context English State
Create a parameter entity to refer to the contents of the file. Then use the parameter entity to load the file into the document, which will then make all the general entities available for use. Then use the general entities as before:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd" [
<!-- Define a parameter entity to load in the chapter general entities -->
<!ENTITY % chapters SYSTEM "chapters.ent">

<!-- Now use the parameter entity to load in this file -->
%chapters;
]>

<tag class="starttag">html xmlns="http://www.w3.org/1999/xhtml"</tag>
&amp;chapter.1;
&amp;chapter.2;
&amp;chapter.3;
<tag class="endtag">html</tag>
Use General Entities to Include Files
Create three files, <filename>para1.xml</filename>, <filename>para2.xml</filename>, and <filename>para3.xml</filename>.
Put content like this in each file:
<tag class="starttag">p</tag>This is the first paragraph.<tag class="endtag">p</tag>
Edit <filename>example.xml</filename> so that it looks like this:
&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd" [
&lt;!ENTITY version "1.1"&gt;
&lt;!ENTITY para1 SYSTEM "para1.xml"&gt;
&lt;!ENTITY para2 SYSTEM "para2.xml"&gt;
&lt;!ENTITY para3 SYSTEM "para3.xml"&gt;
]&gt;

<tag class="starttag">html xmlns="http://www.w3.org/1999/xhtml"</tag>
<tag class="starttag">head</tag>
<tag class="starttag">title</tag>An Example XHTML File<tag class="endtag">title</tag>
<tag class="endtag">head</tag>

<tag class="starttag">body</tag>
<tag class="starttag">p</tag>The current version of this document is: &amp;version;<tag class="endtag">p</tag>

&amp;para1;
&amp;para2;
&amp;para3;
<tag class="endtag">body</tag>
<tag class="endtag">html</tag>
Produce <filename>example.html</filename> by normalizing <filename>example.xml</filename>.
<prompt>%</prompt> <userinput>xmllint --dropdtd --noent example.xml &gt; example.html</userinput>
Load <filename>example.html</filename> into the web browser and confirm that the <filename>para<replaceable>n</replaceable>.xml</filename> files have been included in <filename>example.html</filename>.
Use Parameter Entities to Include Files
The previous steps must have completed before this step.
&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd" [
&lt;!ENTITY % entities SYSTEM "entities.ent"&gt; %entities;
]&gt;

<tag class="starttag">html xmlns="http://www.w3.org/1999/xhtml"</tag>
<tag class="starttag">head</tag>
<tag class="starttag">title</tag>An Example XHTML File<tag class="endtag">title</tag>
<tag class="endtag">head</tag>

<tag class="starttag">body</tag>
<tag class="starttag">p</tag>The current version of this document is: &amp;version;<tag class="endtag">p</tag>

&amp;para1;
&amp;para2;
&amp;para3;
<tag class="endtag">body</tag>
<tag class="endtag">html</tag>
Create a new file called <filename>entities.ent</filename> with this content:
&lt;!ENTITY version "1.1"&gt;
&lt;!ENTITY para1 SYSTEM "para1.xml"&gt;
&lt;!ENTITY para2 SYSTEM "para2.xml"&gt;
&lt;!ENTITY para3 SYSTEM "para3.xml"&gt;
Marked Sections
<acronym>XML</acronym> provides a mechanism to indicate that particular pieces of the document should be processed in a special way. These are called <quote>marked sections</quote>.
Structure of a Marked Section
&lt;![<replaceable>KEYWORD</replaceable>[
Contents of marked section
]]&gt;
As expected of an <acronym>XML</acronym> construct, a marked section starts with <literal>&lt;!</literal>.
The first square bracket begins the marked section.
<replaceable>KEYWORD</replaceable> describes how this marked section is to be processed by the parser.
The second square bracket indicates the start of the marked section's content.
The marked section is finished by closing the two square brackets, and then returning to the document context from the <acronym>XML</acronym> context with <literal>&gt;</literal>.
Marked Section Keywords
<literal>CDATA</literal>
These keywords denote the marked sections <emphasis>content model</emphasis>, and allow you to change it from the default.
When an <acronym>XML</acronym> parser is processing a document, it keeps track of the <quote>content model</quote>.
The content model describes the content the parser is expecting to see and what it will do with that content.
The <literal>CDATA</literal> content model is one of the most useful.

Loading…

No matching activity found.

Browse all component changes

Source information

Source string comment
(itstool) path: step/programlisting
Flags
no-wrap, read-only
Source string location
book.translate.xml:3202
String age
a year ago
Source string age
a year ago
Translation file
books/fdp-primer.pot, string 534