Document Component

The document component reads content from the path info specified on the URL. If the content represented by the path info is a full document, such as a full HTML document, then it cannot be used in a frameless environment.

Cookies

The document component drops the following cookie:

Name Purpose
Doc Identifies the path to the document currently displayed by the document component. The name of the cookie is always preceded by the script name (for example, NXT/Gateway.dll/doc).

Function Names

URL requests are not supported.

URL Parameters

Name Possible Values Purpose
ct Any valid content-type Specifies the content-type. This is only used if a content-type cannot be found in the site definition file or document collection.
q Query string Query to use for hit highlighting.
uq 1 If q is not specified and uq=1, then the document component uses the last, or active, query for the query string.
x Simple | Advanced (the default is Simple) Query syntax for the q parameter. This can be any syntax defined in the executive.ini file.
t File name Template to fill the browser window with.
tc Template name Template for the contents component.
fc Frame name Frame where the contents component resides.

Replacement Variables

Name Purpose
DOCUMENT Streams the current document.
DOCUMENT:BODY Streams the content defined by the URL path info or from the doc cookie. The file that has this replacement variable in it is only called if the document to be served has been created with the content-type attribute set to application/x-html-body-text. This would normally apply to an HTML fragment.
DOCUMENT:TEMPLATE Returns the name of the document template.
DOCUMENT:TOC_TEMPLATE Returns the name of the template for the contents component.
DOCUMENT:TOC_FRAME Returns the name of the frame where the contents component resides.

Counting Hits in HTML Documents

The Document component streams hit count information into HTML documents when a search is performed. When it does this, each hit has anchor and span tags surrounding it and each document with hits in it has a hidden form at the bottom of the document with a total hit count.

The document component first streams several replacement variables into the document and then replaces them with hit information before the document reaches the browser. A person customizing a document component could use these replacement variables to enhance the functionality of the component.

The following examples show the replacement variables generated by the document component and the hit information that is streamed into the documents.

Replacement Value String Returned Description
DOCUMENT:HIT_COUNT <A NAME="LPHitx"></A> DOCUMENT:HIT_COUNT is a running counter inserted at the location of each hit in the document. It is replaced with an anchor named LPHitx, where x represents a number. Each new instance of the hit anchor within the same document increments the number. The number starts over on the next document.
DOCUMENT:HIT_BEGIN <SPAN STYLE="styleSheetCode"> DOCUMENT:HIT_BEGIN marks the beginning of the hit. It is replaced with a SPAN tag at the beginning of each search term hit in the document. The style information within the SPAN tag is taken from Highlight-Style property of the Site Definition File (SDF).
DOCUMENT:HIT_END </SPAN> DOCUMENT:HIT_END marks the end of the hit. It is replaced with an ending SPAN tag at the end of each search term hit in the document.
DOCUMENT:HIT_TOTAL <FORM NAME="LPHitCountForm">
<INPUT TYPE="HIDDEN" NAME="LPHitCount" VALUE="x">
</FORM>
DOCUMENT:HIT_TOTAL marks a placeholder for a hidden form that holds the total number of hits within the document. DOCUMENT:HIT_TOTAL is replaced with a hidden FORM with the number of hits in the value attribute. A JavaScript function can access the value of the LPHitCount element in the FORM to determine how many hits are in the document.
DOCUMENT:TOC_ANCHOR <A NAME="LPTOCx"> DOCUMENT:TOC_ANCHOR marks a table of contents division. When the document is served, the parameter is replaced with a named anchor that the Contents component uses to display hierarchy in the table of contents. The name of the anchor is LPTOCx where x represents a number that is incremented with each new LPTOC anchor tag. The number starts over on the next document.

Counting Hits in XML Documents

If the document you request is XML instead of HTML, then the following elements are returned.

Replacement Value Description
<lp-hit-anchor> An empty element, which marks where an anchor can be placed for each hit. The tag is placed as close as possible to the lp-hit element. However, sometimes the anchor cannot be placed at location of hit such as within a link in HTML.

The Indexsheet rules for the document determine the allowed location of anchors. For a given document type, if anchors are always allowed, then they are placed just before the lp-hit element. lp-hit could be eliminated by disallowing it in the indexsheet. The count attribute of lp-hit contains the one-based ordinal count for this hit instance within the document.
<lp-hit> Marks the beginning and ending (with an end tag) of a hit. You can use for hit highlighting. The count attribute of this element contains the one-based ordinal count for this hit instance within the document.
<lp-hit-total> An empty element, which must be placed after all hits to give a total hit count. The count attribute of this element contains the one-based ordinal count of all hits to this point (just like the lp-hit element). You need the lp-hit-total element because it is difficult to select the last lp-hit element.) Place the <lp-hit-total> element just before the end tag of the element selected in indexsheet with the attribute hit-total=yes.
<lp-toc> Marks the beginning of a sub-document. The anchor attribute of the lp-toc element contains the name path of the subdocument. You can use from a Contents component to do sub-document linking.