fleXdoc Element Reference Guide

Note: For a quick walkthrough on how to create a fleXdoc-template, refer to the QuickStart-manual. You can find it here.

ValueOf

Evaluates the xpath-query and renders its result.
This is fleXdoc's most important element, because it's one of the few that actually insert data in the template.

Properties:
  • path: The xpath-query to be evaluated against the context node
  • format: Type of formatting to be applied. Can be any of the following:
    • Text: No formatting applied (default), eg: "2400.4361"
    • Numeric0: Number with no decimals, eg: "2400"
    • Numeric2: Number with 2 decimals, eg: "2400.44"
    • Numeric4: Number with 4 decimals, eg: "2400.4361"
    • NumericCustom: Reserved for future use.
    • DateTime: Date + time, eg: "31-12-2012 14:01:25"
    • DateTimeLong: Date + time in long format, eg: "December 31 2012, 2:01.25 AM"
    • DateTimeShort: Date only, eg: "31-12-2012"
    • DateTimeCustom: Reserved for future use.
  • formatString: Reserved for future use.

UseContext

Specifies the context node for its child elements.
Can be used to simplify the xpath-queries for child ValueOf-elements and therefore makes the templates easier to maintain. UseContext-elements can be nested.

Properties:
  • path: The xpath-query to be evaluated against the context node

ForEach

For each node that is matched by the evaluation of the xpath-query, its content is processed.
Powerful element that allows for rendering tables, etc. The matching node itself is the context node when processing the content. To sort the output, use the sortSelect and the sortOrder properties.

Properties:
  • path: The xpath-query to be evaluated against the context node
  • sortSelect: Specifies by which childnode to sort on
  • sortOrder: Specifies the sort order. Can be any of the following:
    • ascending
    • descending
  • sortDataType: Forces to treat the value of the sort-node (as specified by sortSelect) as a specific datatype. Can be any of the following:
    • text
    • numeric
  • sortCaseOrder: Specifies whether uppercase or lowercase comes first. Can be any of the following:
    • upper-first
    • lower-first

If

Processes its contents only if a condition is met.
Allows for conditional content, eg: only render a 'final notice' if more than 2 notices have already been sent ("noticeCount > 2").

Properties:
  • test: The xpath-query to be evaluated against the context node. This is the expression that specifies the condition. The condition is met when:
    • The result is a boolean with the value true
    • The result is a node-set containing at least 1 node

ImgOf

Renders an image.
The image can have several sources: the data-XML, a URL pointing to a website or a filename pointing to a file on the filesystem, relative to the actual template.

Properties:
  • path: The xpath-query to be evaluated against the context node. The result must be base64-encoded string representing the image.
  • uri: The path to a local or webbased image, eg: "CompanyLogo.png" or "http://intranet/images/CompanyLogo.png".
  • data: Don't use. For internal use only.

Remarks:
Either 'path' or 'uri' is required. When both are set, 'path' is used.
The image is rendered inside the line and in its original size, so it (currently) cannot be cropped or resized by fleXdoc.
Supported image types are: Bmp, Emf, Gif, Icon, Jpeg, Png, Tiff and Wmf.

IncludeTemplate

Includes an external template and processes it as well.
This allows for placing often used texts in separate templates (aka 'building blocks') and including them where appropriate.

Properties:
  • uri: The path to a local or webbased template, eg: "Disclaimer.docx" or "http://intranet/templates/Disclaimer.docx".
  • absolutePath: The xpath-query to be evaluated against the data-XML. The result is used as the initial context node for processing the template.

Remarks:
The template to be included is processed and the resulting document is added to the package of the main template as a so-called altchunk. The OOXML-standard does not require Altchunks to be supported by document viewers. Currently only Word itself supports altchunks. If you don't want altchunks, but still want to use 'sub-templates'/'building blocks', use ImportTemplate instead.

ImportTemplate

Imports an external template and processes it as well.
This allows for placing often used texts in separate templates (aka 'building blocks') and importing them where appropriate.

Properties:
  • uri: The path to a local or webbased template, eg: "Disclaimer.docx" or "http://intranet/templates/Disclaimer.docx".
  • absolutePath: The xpath-query to be evaluated against the data-XML. The result is used as the initial context node for processing the template.

Remarks:
The template to be imported is processed, but only the content of the main document part is imported, not its headers and footers. When importing a template, its content is inserted inside the main template. This is a very complex process, and currently has its limitations. Styles are not imported, which means that the imported content will use the styles as defined by the main template. The imported content can however still be pretty rich formatted (eg: tables, hyperlinks and images are supported). If you don't want any limitations, but still want to use 'sub-templates'/'building blocks', use IncludeTemplate instead.

Last edited Nov 3, 2009 at 10:01 AM by robertk, version 12

Comments

No comments yet.