Understanding XML Components

The XML components do not use replacement variables to retrieve and display data. Instead they use URL parameters to request data that is streamed in an XML document and displayed with an XSL stylesheet.

The streamed document (the XML source document) is divided into two sections:

The sel (Select String) Parameter

The following URL calls the DocList component and requests title and name properties for each item in the current node using the sel parameter:

http://localhost/nxt/gateway.dll?f=doclist$doclist_sel=title;name

This URL returns the following XML source document (the bolded tags are the properties requested by sel):


<?xml version="1.0" encoding="iso-8859-1" ?>
- <list-section>
   <function>doclist</function>
   <user-name>matt</user-name>
   <select>title;name</select>
   <view-begin-index>1</view-begin-index>
   <view-end-index>15</view-end-index>
   <view-is-begin>yes</view-is-begin>
   <view-is-end>yes</view-is-end>
- <item>
     <title>Miscellaneous Data</title>
     <name>misc</name>
  </item>
- <item>
     <title>Tax Information and Forms</title>
     <name>taxinfo</name>
  </item>
- <item>
     <title>Accounting</title>
     <name>acct</name>
  </item>
</list-section>

The lsel (List Section Select String) Parameter

The list-section element returns properties relevant to either the function or the current node. These properties are called with the lsel parameter. For example, the following URL calls the DocList component and requests hidden and type properties for the current node using the lsel parameter:

http://localhost/matt/gateway.dll/taxinfo?f=doclist$doclist_lsel=hidden;type$doclist_sel=path;title

This URL returns the following XML source document (the bolded tags are the properties requested by lsel):

<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="/matt/gateway.dll/taxinfo?f=stylesheets$fn=contents.xsl$3.0"?>
<list-section>
 <function>doclist</function>
 <user-name>matt</user-name>
 <select>path;title</select>
 <hidden>no</hidden>
 <type>folder</type>
 <parent-path></parent-path>
 <item>

</item>
</list-section>

Rendering With XSL Stylesheets

Instead of displaying as XML data in the browser, an XSL stylesheet associated with the document renders the XML source document. The URL that requests the XML source document also defines what XML stylesheet to use with the xsl parameter. The following URL instructs the NXT server to apply a stylesheet named contents.xsl to the XML source document:

http://localhost/matt/gateway.dll?f=doclist$doclist_lsel=hidden;type;$doclist_sel=path;title$doclist_xsl=contents.xsl

Parameter Prefixes

URL parameters for XML components are always prefixed by the component's name. For example, the xsl parameter, which determines the stylesheet to apply, would be used in a URL in the following way:

href="http://localhost/nxt/gateway.dll?f=doclist&doclist_xsl=navbar.xsl"

In this example, the function is called with f=doclist and the stylesheet to apply is called by doclist_xsl=navbar.xsl. Each URL parameter must be preceded by functionName_ syntax. The practice of prefixing the component name in this way prevents parameter name collision when the same parameter is called by different components. More than one XML component may not be called in the same URL.

Common URL Parameters

The following URL parameters are common to all XML components, except where noted.

Name Possible Values Purpose
f doclist |
docprop |
userinfo |
statistics |
xhitlist
Function to execute
fss yes | no Flag to force server-side transformation of the resulting XML document regardless of the browser capabilities. Requires the xsl parameter.
md name=value (,name=value)* Metadata to include in the XML. This allows you to create your own tags and pass values for them to the document.
sel select string Select string that determines which properties are written out in the item element. Required on all requests, but stored in the property bag if not present on the URL.
sf function name Sub-function to execute while streaming out XML. A replacement parameter for this function is inserted at the beginning of the XML document (after the document's root element).
vpc curr |
first |
last |
next |
prev |
find
Viewport movement command that moves the viewport to the section specified. The default value is curr, but the component will also try first. It is highly recommended that vpc=first be set any time the content is going to change (new query, new path, etc.) Not used with DocProp component.

first — Create the first viewport in the list
last — Create the last viewport in the list
next — Create the next viewport in the list
prev — Create the previous viewport in the list
vps integer Viewport size - number of items per viewport. Not used with DocProp.
xsl style sheet file name Style sheet to use when transforming the resulting XML document for display. If the XML document is to be returned to the client, an xml-stylesheet processing instruction is added referencing the given style sheet. If this parameter is empty, the raw XML is returned.
xsld style sheet file name Default style sheet. This style sheet is only used if a value for xsl has never been set. This can make it easier to handle uninitialized states without overriding an existing xsl value.

Common Metadata

All XML components (except where noted) return the following common metadata in the XML file, which can then be accessed and used in the XSL. These are not used with the Statistics component.

Name Description
function The component "function" name that generated the request (the 'f' parameter).
select The select string passed in as a parameter.
user-name The name of the current user according to the active access control module. This will be "system" if no access control is active.
view-begin-index One-based index of the first item in the viewport. Only present if an item count is available. Not used with DocProps or Update.
view-end-index One-based index of the last item in the viewport. Only present if an item count is available. Not used with DocProps or Update.
view-is-begin yes or no if the current viewport is the beginning of the list. Not used with DocProps or Update.
view-is-end yes or no if the current viewport is the end of the list. Not used with DocProps or Update.

Replacement Variables

There are no replacement variables for any of the XML components.

Common Properties

Each node and object in the site has properties, including the site node. They are accessed using the sel or lsel parameters in the URL.

Node Properties

Name Value Description
children-present 32-bit int Flag indicating if all of this node's children are present.
concept string Concept string for this node's document.
content-type string The content-type of the document associated with the node, such as text/html.
content-version string The version of the document associated with the node.
document binary Gets the document associated with the node.
field:<name> string The text specified by the field name in the document.
field-contents:<name> binary The data specified by the field name in the document. This returns not only the value of the field, but all its HTML markup, if any.
has-children 32-bit integer Flag indicating if the node has children.
has-redirect-path 32-bit integer Flag indicating that a redirect path exists for this node.
has-sub-children 32-bit integer Flag indicating if the node has any sub-document children.
has-visible-children 32-bit integer Flag indicating if the node has any visible children.
hidden 32-bit integer Flag indicating if this node is hidden.
highlight-data binary URL hash for PDF hit highlighting.
home-path string The name path to the infobase containing this node.
home-title string The title of the infobase containing this node.
id string The ID of the document. This must be included when adding a document. Read-only.
indexed 32-bit integer Flag indicating if this node's document is indexed.
last-modified date-time Indicates the last time the node was modified.
metadata Elements or strings Metadata assigned to the node will be delivered in the hierarchy in which it exists. This might or might not be in Dublin Core format.
name string The name of the node.
path string The name path of the node.
present 32-bit-integer Flag indicating if this node is present.
redirect-path string The name-path of the node this node should redirect to.
site-title string The title of the site or link containing this node.
sub-path string The name path of the sub-document node.
sub-title-path string The title path of the sub-document node.
title string The title of the node.
title-path string The title path of the node.
type string Type of node, infobase, folder, or document. An infobase type is the same as an NXT 4 content collection or LivePublish document collection.

View Properties

Name Value Description
highlight-style string Style codes for hit-highlighting in CSS format.
language string Language for the view. Use with the lsel parameter.

Multiple Component Instances

Components can have more than one active instance so you can use more than one set of a component's parameters independently. This is useful in cases where you want to be able to recall a hitlist for a search done in one search form, but need to be able to perform another query in a different search form without overriding the first.

A good application of this is in the default NXT 4 web site where a user can search for anything in the content collections. However, a user can also manage content and search for all the documents they own. So that these two searches, which use the same Xhitlist component, don't override each other, the former is called by f=xhitlist while the latter is called with f=uxhitlist. By naming these two differently, they can be set and retrieved independently of each other.

The two functions in this example have different names but they call the same Xhitlist component. These separate names are registered in Executive.ini under the Components section. Manually enter name/value pairs to register the function name and its corresponding DLL. After saving the file, you must stop and restart the NXT 4 server for the changes to take effect.

The following example shows the Components section of Executive.ini where multiple instances of File.dll, Navigate.dll, XhitList.dll, DocList.dll, and DocProp.dll are registered:

[COMPONENTS]
ID=ID.dll
Images=File.dll
Templates=File.dll
StyleSheets=File.dll
Document=Document.dll
Contents=Contents.dll
NextDoc=Navigate.dll
PrevDoc=Navigate.dll
JContents=JContents.dll
LocalMedia=LocalMedia.dll
UserInfo=UserInfo.dll
Reference=Reference.dll
SearchForms=SearchForms.dll
Element=Element.dll
CNA=RemoteContent.dll
HighlightData=HighlightData.dll
Build=Build.dll
Update=Update.dll
XHitList=XHitList.dll
UXHitList=XHitList.dll
Statistics=Statistics.dll
DocList=DocList.dll
UDocList=DocList.dll
Admin=Admin.dll
DocProp=DocProp.dll
UDocProp=DocProp.dll
HitList=QueryLink.dll