/** * This file is auto generated from JavaDoc. Do not modify it manually. */ import type { String } from "../../types/java/lang/String"; import type { Object } from "../../types/java/lang/Object"; /** * XSLT utility for transforming XML/HTML using a XSL template. * *

* Tip! This utility can be combined with {@link senselogic.sitevision.api.render.OutputUtil} to produce modified versions of * the HTML produced by layouts or modules. Below is a simplistic example of how this can be done in server-side JavaScript. *

 *     var outputUtil = require('OutputUtil'),
 *         xsltUtil = require('XSLTUtil'),
 *         pageNode,
 *         pageContentNode,
 *         rawRenderResult,
 *         transformedRenderResult;
 *
 *     pageNode = ...
 *     pageContentNode = ...
 *
 *     rawRenderResult = outputUtil.getNodeOutput(pageNode, pageContentNode, outputUtil.CONTENT_TYPE_TEXT_HTML);
 *     transformedRenderResult = xsltUtil.transform(rawRenderResult, xsltUtil.getDefaultCleanHtmlTemplate());
 *  
* *

* An instance of the Sitevision class implementing this interface can be obtained via {@link senselogic.sitevision.api.Utils#getXSLTUtil}. * See {@link senselogic.sitevision.api.Utils} for how to obtain an instance of the Utils interface. *

* @author Magnus Lövgren * @since Sitevision 4.5 */ export interface XSLTUtil { /** * Gets the default XSL template for cleanup of HTML sources. * *

* The template strips all <div>'s, <spans>'s and removes all inline styling, classes and attributes * that is not mandatory or needed for WCAG purposes. *

*

* Note! The template supports a sub-set of HTML elements (the presumed most commonly used elements). * All unsupported elements are completely discarded (i.e. they will not be included at all in the transformation result). *

* @return the default cleanup template for HTML sources */ getDefaultCleanHtmlTemplate(): string; /** * Transforms a HTML/XML source using a XSL template. * *

* Note! The contents of the XSL Template is always handled as UTF-8. *

* @param aSource the source that should be transformed, HTML, XHTML or XML. Must not be null * @param aXslTemplate the UTF-8 XSL template; a sv:file Node, a sv:temporaryFile Node, a sv:link Node that targets a sv:file, a char array or a CharSequence (typically a String). Must not be null * @return the transformation result * @throws IOException if the transformation fails (e.g. the aSource is really bad/interpretable HTML or aXslTemplate is invalid XSL) * @throws RepositoryException if aNode-operation on aXslTemplate fails */ transform(aSource: String | string, aXslTemplate: unknown): string; } declare namespace XSLTUtil {} declare var xSLTUtil: XSLTUtil; export default xSLTUtil;