old-www/LDP/LDP-Author-Guide/html/section.html

309 lines
5.0 KiB
HTML

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML
><HEAD
><TITLE
>section and sectN: what's the difference?</TITLE
><META
NAME="GENERATOR"
CONTENT="Modular DocBook HTML Stylesheet Version 1.7"><LINK
REL="HOME"
TITLE="LDP Author Guide"
HREF="index.html"><LINK
REL="UP"
TITLE="DocBook: Sample Markup"
HREF="using-docbook.html"><LINK
REL="PREVIOUS"
TITLE="General Tips and Tricks"
HREF="writing-docbook.html"><LINK
REL="NEXT"
TITLE="Command Prompts"
HREF="commandprompt.html"></HEAD
><BODY
CLASS="section"
BGCOLOR="#FFFFFF"
TEXT="#000000"
LINK="#0000FF"
VLINK="#840084"
ALINK="#0000FF"
><DIV
CLASS="NAVHEADER"
><TABLE
SUMMARY="Header navigation table"
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TH
COLSPAN="3"
ALIGN="center"
>LDP Author Guide</TH
></TR
><TR
><TD
WIDTH="10%"
ALIGN="left"
VALIGN="bottom"
><A
HREF="writing-docbook.html"
ACCESSKEY="P"
>Prev</A
></TD
><TD
WIDTH="80%"
ALIGN="center"
VALIGN="bottom"
>Appendix D. DocBook: Sample Markup</TD
><TD
WIDTH="10%"
ALIGN="right"
VALIGN="bottom"
><A
HREF="commandprompt.html"
ACCESSKEY="N"
>Next</A
></TD
></TR
></TABLE
><HR
ALIGN="LEFT"
WIDTH="100%"></DIV
><DIV
CLASS="section"
><H1
CLASS="section"
><A
NAME="section"
></A
>D.2. <TT
CLASS="sgmltag"
>&#60;section&#62;</TT
> and <TT
CLASS="sgmltag"
>&#60;sectN&#62;</TT
>: what's the difference?</H1
><DIV
CLASS="note"
><P
></P
><TABLE
CLASS="note"
WIDTH="100%"
BORDER="0"
><TR
><TD
WIDTH="25"
ALIGN="CENTER"
VALIGN="TOP"
><IMG
SRC="../images/note.gif"
HSPACE="5"
ALT="Note"></TD
><TH
ALIGN="LEFT"
VALIGN="CENTER"
><B
>Acknowledgment</B
></TH
></TR
><TR
><TD
>&nbsp;</TD
><TD
ALIGN="LEFT"
VALIGN="TOP"
><P
>&#13; These notes were provided by:
<A
HREF="http://geekhavoc.com"
TARGET="_top"
>John Daily</A
> and
Saqib Ali (<TT
CLASS="email"
>&#60;<A
HREF="mailto:saqib@seagate.com"
>saqib@seagate.com</A
>&#62;</TT
>).
</P
></TD
></TR
></TABLE
></DIV
><P
>&#13; <TT
CLASS="sgmltag"
>&#60;section&#62;</TT
> versus <TT
CLASS="sgmltag"
>&#60;sectN&#62;</TT
> is largely a
question of flexibility. The stylesheets can make a
<TT
CLASS="sgmltag"
>&#60;section&#62;</TT
> in a <TT
CLASS="sgmltag"
>&#60;section&#62;</TT
> look just
like a <TT
CLASS="sgmltag"
>&#60;sect2&#62;</TT
> within a <TT
CLASS="sgmltag"
>&#60;sect1&#62;</TT
>, so there's no output advantage.
</P
><P
>&#13; But, a <TT
CLASS="sgmltag"
>&#60;section&#62;</TT
> within a
<TT
CLASS="sgmltag"
>&#60;section&#62;</TT
> can be extracted into its own
top-level section, nested even more deeply, or moved to an
entirely different part of the document, without it and its own
<TT
CLASS="sgmltag"
>&#60;section&#62;</TT
> children being renamed. That is not true of the
numbered section tags, which are very sensitive to
rearrangements. This can be easier for authors who are new to
DocBook than using <TT
CLASS="sgmltag"
>&#60;sectN&#62;</TT
>.
</P
><P
>&#13; The main idea behind creating structured data is that it should be easy
to access and query. One should be able to retrieve a subsection of any
structured data, by using querying languages for XML (<SPAN
CLASS="application"
>XPath</SPAN
> and <SPAN
CLASS="application"
>XQuery</SPAN
>).
<TT
CLASS="sgmltag"
>&#60;sectN&#62;</TT
> are useful when traversing a document using <SPAN
CLASS="application"
>XPath</SPAN
>/<SPAN
CLASS="application"
>XQuery</SPAN
>.
<TT
CLASS="sgmltag"
>&#60;sectN&#62;</TT
> gives more flexibility, and control while writing an <SPAN
CLASS="application"
>XPath</SPAN
>
expression.
</P
><P
>&#13; A well-defined, valid and well-structured document makes it easier for
one to write <SPAN
CLASS="application"
>XPath</SPAN
>/<SPAN
CLASS="application"
>Query</SPAN
> to retreive <SPAN
CLASS="QUOTE"
>"specific"</SPAN
> data from a document.
For example you can use <SPAN
CLASS="application"
>XPath</SPAN
> to retrieve information in the
<TT
CLASS="sgmltag"
>&#60;sect3&#62;</TT
> block with certain attributes.
However if you just used <TT
CLASS="sgmltag"
>&#60;section&#62;</TT
> for all subsections,
it becomes harder to retrieve the block of information that you need.
</P
><P
>&#13; So which one should you use? The one you feel most
comfortable with is a good place to start. This document
is written with <TT
CLASS="sgmltag"
>&#60;section&#62;</TT
>s. You may,
or may not, think this is a good idea. :)
</P
></DIV
><DIV
CLASS="NAVFOOTER"
><HR
ALIGN="LEFT"
WIDTH="100%"><TABLE
SUMMARY="Footer navigation table"
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
><A
HREF="writing-docbook.html"
ACCESSKEY="P"
>Prev</A
></TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="index.html"
ACCESSKEY="H"
>Home</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
><A
HREF="commandprompt.html"
ACCESSKEY="N"
>Next</A
></TD
></TR
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
>General Tips and Tricks</TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="using-docbook.html"
ACCESSKEY="U"
>Up</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
>Command Prompts</TD
></TR
></TABLE
></DIV
></BODY
></HTML
>