Options
All
  • Public
  • Public/Protected
  • All
Menu

The context is shared across all templates and is used as a general register and getter.

Hierarchy

  • Context

Index

Properties

Private __templates

__templates: InternalTemplate[] = []

A list of all registered templates.

Methods

__nsResolver

  • __nsResolver(contextNode: Node): XPathNSResolver
  • Guesses a namespace resolver from a given node.

    Parameters

    • contextNode: Node

      the node to guess the namespace from

    Returns XPathNSResolver

    a namespace resolver

__render

  • __render(contextDocument: XMLDocument): React.ReactNode
  • Renders a document based on the registered templates, by guessing the most adequate.

    Note: you shouldn't use this function directly, but rather import ../Stylesheet as a ReactNode.

    Parameters

    • contextDocument: XMLDocument

      the document to render

    Returns React.ReactNode

getTemplateByName

  • getTemplateByName(name: string, mode?: undefined | string): TemplateType | null
  • Gives the correct template for the given name.

    Parameters

    • name: string

      the name of the template

    • Optional mode: undefined | string

    Returns TemplateType | null

    returns a renderable template if a match was found, null otherwise

getTemplateByNode

  • getTemplateByNode(contextNode: Node, mode?: undefined | string): MemoTemplate | null
  • Compute the correct template for the given contextNode

    Parameters

    • contextNode: Node

      the node to compute the template for

    • Optional mode: undefined | string

    Returns MemoTemplate | null

    returns a renderable template if a match was found, null otherwise

notFoundStyleSheet

  • notFoundStyleSheet(): React.ReactNode
  • A node returned when no stylesheet was found. Could be overwritten.

    Returns React.ReactNode

    the error node

notFoundTemplateName

  • notFoundTemplateName(name: string): React.ReactNode
  • A node returned when no template matching the name was found. Could be overwritten.

    Parameters

    • name: string

      the name of the template that was not found

    Returns React.ReactNode

    the error node

notFoundTemplateNode

  • notFoundTemplateNode(node: Node): React.ReactNode
  • A node returned when no template was found for the given node. Could be overwritten.

    Parameters

    • node: Node

      the node that did'nt have a matching template

    Returns React.ReactNode

    the error node

register

  • register(template: TemplateType, options: { mode?: undefined | string; path: XPath; priority?: undefined | number } | { mode?: undefined | string; name: string; priority?: undefined | number }): void
  • Registers a template by path or by name. To be able to call it from a ApplyTemplates, you should register by path, and by name if you want to call it from a CallTemplate.

    Parameters

    • template: TemplateType

      the template to register

    • options: { mode?: undefined | string; path: XPath; priority?: undefined | number } | { mode?: undefined | string; name: string; priority?: undefined | number }

    Returns void

Private sortedTemplate

toString

  • toString(node: ReactElement): string

xpath

  • xpath(query: XPath, contextNode: Node, resultType: Any): number | string | boolean | Node | Node[] | null
  • xpath(query: XPath, contextNode: Node, resultType: Number): number | null
  • xpath(query: XPath, contextNode: Node, resultType: String): string | null
  • xpath(query: XPath, contextNode: Node, resultType: Boolean): boolean | null
  • xpath(query: XPath, contextNode: Node, resultType: UnorderedNodeIterator): Iterable<Node>
  • xpath(query: XPath, contextNode: Node, resultType: OrderedNodeIterator): Iterable<Node>
  • xpath(query: XPath, contextNode: Node, resultType: UnorderedNodeList): Node[]
  • xpath(query: XPath, contextNode: Node, resultType: OrderedNodeList): Node[]
  • xpath(query: XPath, contextNode: Node, resultType: AnyNode): Node | null
  • xpath(query: XPath, contextNode: Node, resultType: FirstNode): Node | null

Generated using TypeDoc