Skip to content

Try an XSLT transformation on a sample document

Request

Runs a stored transformation (transformationId) or an unsaved definition on a Studio document (documentId) or an inline sample (document) and returns the indented output. Nothing is saved. A stylesheet that fails to compile or run is answered with 400. A stored transformation must belong to the token's company (400 otherwise). The stylesheet runs isolated: it cannot read other files or URLs (document(), xsl:import, xsl:include) or call Java extension functions. Like every POST it needs the write scope, although nothing is saved.

Security
OAuth2(Required scopes: integration-setup.write)
Bodyapplication/jsonrequired
One of:

Set exactly one of transformationId/definition and exactly one of documentId/document.

transformationIdstring

A stored transformation of the company.

definitionobject(XsltTransformationDefinition)
documentIdstring

A Studio document of the company.

documentobject

A Studio document as JSON, e.g. a sample file exported from Studio.

curl -i -X POST \
  https://api.cloud.hypatos.ai/v2/integration-setup/xslt-transformations/test \
  -H 'Authorization: Bearer <YOUR_TOKEN_HERE>' \
  -H 'Content-Type: application/json' \
  -d '{
    "definition": {
      "transformation": "<xsl:stylesheet version=\"1.0\" xmlns:xsl=\"http://www.w3.org/1999/XSL/Transform\"><xsl:template match=\"/\"><invoice><xsl:value-of select=\"//documentNumber\"/></invoice></xsl:template></xsl:stylesheet>"
    },
    "document": {
      "documentNumber": "INV-1001"
    }
  }'

Responses

The output.

Bodyapplication/json
outputstringrequired

The transformed document, indented.

Response
{ "output": "<?xml version=\"1.0\" encoding=\"UTF-8\"?><invoice>INV-1001</invoice>\n" }