Source string Read only

(itstool) path: example/programlisting
159/1590
Context English State
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.
<literal>CDATA</literal> is for <quote>Character Data</quote>. When the parser is in this content model, it expects to see only characters. In this model the <literal>&lt;</literal> and <literal>&amp;</literal> symbols lose their special status, and will be treated as ordinary characters.
When using <literal>CDATA</literal> in examples of text marked up in <acronym>XML</acronym>, remember that the content of <literal>CDATA</literal> is not validated. The included text must be check with other means. For example, the content could be written in another document, validated, and then pasted into the <literal>CDATA</literal> section.
Using a <literal>CDATA</literal> Marked Section
<tag class="starttag">para</tag>Here is an example of how to include some text that contains
many <tag class="starttag">literal</tag>&amp;lt;<tag class="endtag">literal</tag> and <tag class="starttag">literal</tag>&amp;amp;<tag class="endtag">literal</tag>
symbols. The sample text is a fragment of
<tag class="starttag">acronym</tag>XHTML<tag class="endtag">acronym</tag>. The surrounding text (<tag class="starttag">para</tag> and
<tag class="starttag">programlisting</tag>) are from DocBook.<tag class="endtag">para</tag>

<tag class="starttag">programlisting</tag>&lt;![CDATA[<tag class="starttag">p</tag>This is a sample that shows some of the
elements within <tag class="starttag">acronym</tag>XHTML<tag class="endtag">acronym</tag>. Since the angle
brackets are used so many times, it is simpler to say the whole
example is a CDATA marked section than to use the entity names for
the left and right angle brackets throughout.<tag class="endtag">p</tag>

<tag class="starttag">ul</tag>
<tag class="starttag">li</tag>This is a listitem<tag class="endtag">li</tag>
<tag class="starttag">li</tag>This is a second listitem<tag class="endtag">li</tag>
<tag class="starttag">li</tag>This is a third listitem<tag class="endtag">li</tag>
<tag class="endtag">ul</tag>

<tag class="starttag">p</tag>This is the end of the example.<tag class="endtag">p</tag>]]&gt;<tag class="endtag">programlisting</tag>
<literal>INCLUDE</literal> and <literal>IGNORE</literal>
When the keyword is <literal>INCLUDE</literal>, then the contents of the marked section will be processed. When the keyword is <literal>IGNORE</literal>, the marked section is ignored and will not be processed. It will not appear in the output.
Using <literal>INCLUDE</literal> and <literal>IGNORE</literal> in Marked Sections
&lt;![INCLUDE[
This text will be processed and included.
]]&gt;

&lt;![IGNORE[
This text will not be processed or included.
]]&gt;
By itself, this is not too useful. Text to be removed from the document could be cut out, or wrapped in comments.
It becomes more useful when controlled by <link linkend="xml-primer-parameter-entities">parameter entities</link>, yet this usage is limited to entity files.
For example, suppose that documentation was produced in a hard-copy version and an electronic version. Some extra text is desired in the electronic version content that was not to appear in the hard-copy.
Create an entity file that defines general entities to include each chapter and guard these definitions with a parameter entity that can be set to either <literal>INCLUDE</literal> or <literal>IGNORE</literal> to control whether the entity is defined. After these conditional general entity definitions, place one more definition for each general entity to set them to an empty value. This technique makes use of the fact that entity definitions cannot be overridden but the first definition always takes effect. So the inclusion of the chapter is controlled with the corresponding parameter entity. Set to <literal>INCLUDE</literal>, the first general entity definition will be read and the second one will be ignored. Set to <literal>IGNORE</literal>, the first definition will be ignored and the second one will take effect.
Using a Parameter Entity to Control a Marked Section
&lt;!ENTITY % electronic.copy "INCLUDE"&gt;

&lt;![%electronic.copy;[
&lt;!ENTITY chap.preface SYSTEM "preface.xml"&gt;
]]&gt;

&lt;!ENTITY chap.preface ""&gt;
When producing the hard-copy version, change the parameter entity's definition to:
&lt;!ENTITY % electronic.copy "IGNORE"&gt;
Modify <filename>entities.ent</filename> to contain the following:
&lt;!ENTITY version "1.1"&gt;
&lt;!ENTITY % conditional.text "IGNORE"&gt;

&lt;![%conditional.text;[
&lt;!ENTITY para1 SYSTEM "para1.xml"&gt;
]]&gt;

&lt;!ENTITY para1 ""&gt;

&lt;!ENTITY para2 SYSTEM "para2.xml"&gt;
&lt;!ENTITY para3 SYSTEM "para3.xml"&gt;
Normalize <filename>example.xml</filename> and notice that the conditional text is not present in the output document. Set the parameter entity guard to <literal>INCLUDE</literal> and regenerate the normalized document and the text will appear again. This method makes sense if there are more conditional chunks depending on the same condition. For example, to control generating printed or online text.
Conclusion
That is the conclusion of this <acronym>XML</acronym> primer. For reasons of space and complexity, several things have not been covered in depth (or at all). However, the previous sections cover enough <acronym>XML</acronym> to introduce the organization of the <acronym>FDP</acronym> documentation.
<acronym>XHTML</acronym> Markup
Introduction
This chapter describes usage of the <acronym>XHTML</acronym> markup language used for the FreeBSD web site.
<acronym>XHTML</acronym> is the <acronym>XML</acronym> version of the HyperText Markup Language, the markup language of choice on the World Wide Web. More information can be found at <uri xlink:href="http://www.w3.org/">http://www.w3.org/</uri>.
<acronym>XHTML</acronym> is used to mark up pages on the FreeBSD web site. It is usually not used to mark up other documentation, since DocBook offers a far richer set of elements from which to choose. Consequently, <acronym>XHTML</acronym> pages will normally only be encountered when writing for the web site.
<acronym>HTML</acronym> has gone through a number of versions. The <acronym>XML</acronym>-compliant version described here is called <acronym>XHTML</acronym>. The latest widespread version is <acronym>XHTML</acronym> 1.0, available in both <emphasis>strict</emphasis> and <emphasis>transitional</emphasis> variants.
The <acronym>XHTML</acronym> <acronym>DTDs</acronym> are available from the Ports Collection in <package>textproc/xhtml</package>. They are automatically installed by the <package>textproc/docproj</package> port.
This is <emphasis>not</emphasis> an exhaustive list of elements, since that would just repeat the documentation for <acronym>XHTML</acronym>. The aim is to list those elements most commonly used. Please post questions about elements or uses not covered here to the <link xlink:href="http://lists.FreeBSD.org/mailman/listinfo/freebsd-doc">FreeBSD documentation project mailing list</link>.

Loading…

No matching activity found.

Browse all component changes

Glossary

English English
No related strings found in the glossary.

Source information

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