Local Exports


Any piece of data contained in an element on a linked page may be pulled into the linking page using a local export. Local exports are commonly used when the data is too large to export with every link, efficiently. For example, exporting the main XHTML area on a content page is a common scenario, which is more suited for a local, rather than a global, export. Like global exports, local exports are written as XPath expressions.

For a local export to function, it must run all of the code that a page contains, including RSS feeds, database calls, components, and exports in links to other pages. Because the page and all of its dynamic elements must be expanded to ensure the accuracy of the XPath query, local exports increase publishing and page-generation times. In general, local exports shouldn't be used unless the element containing the local export will bring in data from a very limited set of pages.

Best practices for local exports:

  • Use local exports for cases when a rich set of data is required for the navigation. The number of pages set should be fewer than 20. The pages within the navigation should not contain database queries, inserts, or other dynamic content.
  • Local exports should never be used on site-wide structures such as site controls.

In the following example, a page named Regulations (x153) contains a link element that must pull content from a page named Services (x8). Services (x8) contains a BodyCopy element that contains content that is returned by the export's XPath expression.

To set a local export for this scenario:
  1. Navigate to a page that contains a link or linkSet element (e.g., Regulations (x8)).
  2. Open the page in the Edit tab. In this example, a local export is set for a Link element in Regulations (x153).
  3. Set Link Type to Internal Link.
  4. Enter the targeted page's name or xID in the Page field. For your reference, the XML of the targeted page (x8) looks like this:

    Local Export Example

  5. In the Exports area, click the Add... icon (+), and enter an export name in the Name field (e.g., exportedBody).
  6. In the XPath Query field, enter an XPath expression (e.g., /*/BodyCopy) that evaluates to the desired content.

    Local Export Example

    Note
    XPath queries walk the XML structure of the targeted page and returns matches when found. An absolute location path begins with a forward slash ( / ) and consists of one or more steps, each separated by a slash, so for the XPath query /*/BodyCopy:
    • The first slash represents the document root.
    • An asterisk (*) in XPath represents a wild-card. Because its location is the first step, it matches any top-level element. In this case, the asterisk matches the Details element.
    • Because BodyCopy is a child of Details (i.e., second step), the XPath expression finds a match and returns the value of BodyCopy.
  7. You can verify that the XPath expression evaluates to the value of BodyCopy by searching for the name of the local export, exportBody, within its XML tab of Regulations (x153).

    Local Export Example in XML

    The value of the XPath expression for exportedBody evaluates to This is body copy, created it the XHTML editor.