Class XsltPostProcessor

java.lang.Object
net.finmath.smartcontracts.representablestate.xml.XsltPostProcessor

public final class XsltPostProcessor extends Object
Applies a caller-selected XSLT stylesheet to an already rendered XML representation.

A stylesheet specification is either:

  • an absolute URI, loaded through a caller-provided XsltPostProcessor.ResourceLoader; or
  • an explicit xpath: expression selecting exactly one text, CDATA, or XSLT stylesheet/transform element node in the rendered XML; or
  • an explicit xpath-uri: expression selecting exactly one text, CDATA, or attribute node whose value is an absolute stylesheet URI loaded through the XsltPostProcessor.ResourceLoader.

A selected text or CDATA node must contain the complete inline stylesheet. Its value is never reinterpreted as another URI. An element selection is copied into a standalone document before compilation, including namespace declarations inherited from its ancestors. URI indirection is therefore always explicit through xpath-uri:.

Both the rendered XML and inline/external stylesheets are parsed with DTDs and external entities disabled. XSLT imports, includes, and runtime URI access such as document() are rejected. Stylesheet and output sizes are bounded.

  • Field Details

    • DEFAULT_MAX_STYLESHEET_BYTES

      public static final int DEFAULT_MAX_STYLESHEET_BYTES
      Default maximum stylesheet size: 1 MiB.
      See Also:
    • DEFAULT_MAX_OUTPUT_CHARACTERS

      public static final int DEFAULT_MAX_OUTPUT_CHARACTERS
      Default maximum transformed output size: 10 MiB characters.
      See Also:
    • XSLT_NAMESPACE

      public static final String XSLT_NAMESPACE
      XSLT namespace used by both xsl:stylesheet and xsl:transform.
      See Also:
    • APPLICATION_XML

      public static final String APPLICATION_XML
      Response media type for the XML output method.
      See Also:
    • TEXT_HTML

      public static final String TEXT_HTML
      Response media type for the HTML output method.
      See Also:
    • TEXT_PLAIN

      public static final String TEXT_PLAIN
      Response media type for the text output method.
      See Also:
  • Constructor Details

    • XsltPostProcessor

      public XsltPostProcessor()
      Creates a post-processor with the default 1 MiB stylesheet and 10 MiB output limits.
    • XsltPostProcessor

      public XsltPostProcessor(int maxStylesheetBytes, int maxOutputCharacters)
      Creates a post-processor with explicit resource limits.
      Parameters:
      maxStylesheetBytes - Maximum serialized/loaded stylesheet size in bytes.
      maxOutputCharacters - Maximum transformed output size in Java characters.
  • Method Details