{"id":28471973,"url":"https://github.com/designliquido/xslt-processor","last_synced_at":"2026-04-28T02:05:03.448Z","repository":{"id":30785623,"uuid":"125993805","full_name":"DesignLiquido/xslt-processor","owner":"DesignLiquido","description":"A JavaScript XSLT processor without native library dependencies","archived":false,"fork":false,"pushed_at":"2026-03-19T18:04:25.000Z","size":2640,"stargazers_count":116,"open_issues_count":3,"forks_count":34,"subscribers_count":6,"default_branch":"main","last_synced_at":"2026-03-20T09:27:12.133Z","etag":null,"topics":["hacktoberfest","xml","xml-parser","xslt","xslt-files","xslt-stylesheet","xslt-templates","xsltproc"],"latest_commit_sha":null,"homepage":"https://designliquido.github.io/xslt-processor/","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"lgpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/DesignLiquido.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2018-03-20T09:35:37.000Z","updated_at":"2026-03-19T18:04:21.000Z","dependencies_parsed_at":"2023-11-24T14:28:19.683Z","dependency_job_id":"bb8497b7-6901-4b30-a731-931e3f67eb1d","html_url":"https://github.com/DesignLiquido/xslt-processor","commit_stats":null,"previous_names":["designliquido/xslt-processor","fiduswriter/xslt-processor"],"tags_count":86,"template":false,"template_full_name":null,"purl":"pkg:github/DesignLiquido/xslt-processor","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DesignLiquido%2Fxslt-processor","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DesignLiquido%2Fxslt-processor/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DesignLiquido%2Fxslt-processor/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DesignLiquido%2Fxslt-processor/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/DesignLiquido","download_url":"https://codeload.github.com/DesignLiquido/xslt-processor/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DesignLiquido%2Fxslt-processor/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31293356,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-01T21:15:39.731Z","status":"ssl_error","status_checked_at":"2026-04-01T21:15:34.046Z","response_time":53,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["hacktoberfest","xml","xml-parser","xslt","xslt-files","xslt-stylesheet","xslt-templates","xsltproc"],"created_at":"2025-06-07T11:09:34.058Z","updated_at":"2026-04-02T00:20:38.760Z","avatar_url":"https://github.com/DesignLiquido.png","language":"TypeScript","funding_links":["https://github.com/sponsors/leonelsanchesdasilva","https://buymeacoffee.com/leonelsanches"],"categories":[],"sub_categories":[],"readme":"# XSLT-processor\n\n_A JavaScript XSLT processor without native library dependencies._\n\n  \u003cp align=\"center\"\u003e\n    \u003ca href=\"https://github.com/DesignLiquido/xslt-processor/issues\" target=\"_blank\"\u003e\n      \u003cimg src=\"https://img.shields.io/github/issues/DesignLiquido/xslt-processor\" /\u003e\n    \u003c/a\u003e\n    \u003cimg src=\"https://img.shields.io/github/stars/Designliquido/xslt-processor\" /\u003e\n    \u003cimg src=\"https://img.shields.io/github/forks/Designliquido/xslt-processor\" /\u003e\n    \u003ca href=\"https://www.npmjs.com/package/xslt-processor\" target=\"_blank\"\u003e\n      \u003cimg src=\"https://img.shields.io/npm/v/xslt-processor\" /\u003e\n    \u003c/a\u003e\n    \u003cimg src=\"https://img.shields.io/npm/dw/xslt-processor\" /\u003e\n    \u003cimg src=\"https://img.shields.io/github/license/DesignLiquido/xslt-processor\" /\u003e\n    \u003ca href=\"https://github.com/sponsors/leonelsanchesdasilva\" target=\"_blank\"\u003e\n      \u003cimg src=\"https://img.shields.io/github/sponsors/leonelsanchesdasilva\" /\u003e\n    \u003c/a\u003e\n    \u003ca href=\"https://buymeacoffee.com/leonelsanches\" target=\"_blank\"\u003e\n      \u003cimg src=\"https://img.shields.io/badge/Buy%20Me%20a%20Coffee-orange?logo=buy-me-a-coffee\" /\u003e\n    \u003c/a\u003e\n  \u003c/p\u003e\n\n## Interactive Demos\n\nTry the XSLT and XPath processors directly in your browser:\n\n**[🚀 Visit Interactive Demos](https://designliquido.github.io/xslt-processor/)**\n\n## How to\n\nInstall xslt-processor using [npm](https://docs.npmjs.com/about-npm), [ohpm](https://ohpm.openharmony.cn/#/en/home) or [yarn](https://yarnpkg.com):\n\n```sh\nnpm install xslt-processor\n```\n\n```sh\nohpm install xslt-processor\n```\n\n```sh\nyarn add xslt-processor\n```\n\nWithin your ES2015+ code, import the `Xslt` class, the `XmlParser` class and use it this way:\n\n```js\nimport { Xslt, XmlParser } from 'xslt-processor'\n\n// xmlString: string of xml file contents\n// xsltString: string of xslt file contents\n// outXmlString: output xml string.\nconst xslt = new Xslt();\nconst xmlParser = new XmlParser();\n// Either\nconst outXmlString = await xslt.xsltProcess(\n\txmlParser.xmlParse(xmlString),\n\txmlParser.xmlParse(xsltString)\n);\n// Or\nxslt.xsltProcess(\n\txmlParser.xmlParse(xmlString),\n\txmlParser.xmlParse(xsltString)\n).then(output =\u003e {\n  // `output` is equivalent to `outXmlString` (a string with XML).\n});\n```\n\nIf you write pre-2015 JS code, make adjustments as needed.\n\n### Working with browser DOM and XDocument output\n\nFeature available in v5 (next major) of this library. \n\nIf you already have a browser DOM `Document` or `Node`, convert it to an `XDocument` without re-parsing XML strings:\n\n```js\nimport { domDocumentToXDocument } from 'xslt-processor'\n\nconst parser = new DOMParser();\nconst nativeDoc = parser.parseFromString('\u003croot\u003ehello\u003c/root\u003e', 'text/xml');\nconst xDoc = domDocumentToXDocument(nativeDoc);\n```\n\nYou can also run XSLT and get the output as an `XDocument` tree instead of a serialized string:\n\n```js\nimport { Xslt, XmlParser } from 'xslt-processor'\n\nconst xmlParser = new XmlParser();\nconst xslt = new Xslt();\n\nconst xmlDoc = xmlParser.xmlParse('\u003croot\u003e\u003citem\u003ehello\u003c/item\u003e\u003c/root\u003e');\nconst styleDoc = xmlParser.xmlParse(\n  '\u003cxsl:stylesheet version=\"1.0\" xmlns:xsl=\"http://www.w3.org/1999/XSL/Transform\"\u003e' +\n  '  \u003cxsl:template match=\"/\"\u003e' +\n  '    \u003coutput\u003e\u003cxsl:value-of select=\"/root/item\"/\u003e\u003c/output\u003e' +\n  '  \u003c/xsl:template\u003e' +\n  '\u003c/xsl:stylesheet\u003e'\n);\n\nconst outDoc = await xslt.xsltProcessToDocument(xmlDoc, styleDoc);\n// outDoc is an XDocument you can traverse or serialize with xmlTransformedText.\n```\n\n### `Xslt` class options\n\nYou can pass an `options` object to `Xslt` class:\n\n```js\nconst options = {\n  escape: false,\n  selfClosingTags: true,\n  parameters: [{ name: 'myparam', value: '123' }],\n  outputMethod: 'xml'\n};\nconst xslt = new Xslt(options);\n```\n\n- `cData` (`boolean`, default `true`): resolves CDATA elements in the output. Content under CDATA is resolved as text. This overrides `escape` for CDATA content.\n- `escape` (`boolean`, default `true`): replaces symbols like `\u003c`, `\u003e`, `\u0026` and `\"` by the corresponding [HTML/XML entities](https://www.tutorialspoint.com/xml/xml_character_entities.htm). Can be overridden by `disable-output-escaping`, that also does the opposite, unescaping `\u0026gt;` and `\u0026lt;` by `\u003c` and `\u003e`, respectively.\n- `selfClosingTags` (`boolean`, default `true`): Self-closes tags that don't have inner elements, if `true`. For instance, `\u003ctest\u003e\u003c/test\u003e` becomes `\u003ctest /\u003e`.\n- `outputMethod` (`string`, default `xml`): Specifies the default output method. If `\u003cxsl:output\u003e` is declared in your XSLT file, this will be overridden. Valid values: `xml`, `html`, `text`, `xhtml`, `json`, `adaptive`.\n- `parameters` (`array`, default `[]`): external parameters that you want to use.\n    - `name`: the parameter name;\n    - `namespaceUri` (optional): the namespace;\n    - `value`: the value. The type is preserved automatically:\n        - **string** values become `StringValue`;\n        - **number** values become `NumberValue` (usable in XPath arithmetic);\n        - **boolean** values become `BooleanValue` (usable in `xsl:if`/`xsl:when` tests);\n        - Note: in XPath/XSLT, any non-empty string is truthy, so the string \"false\" still behaves as true in tests;\n        - **`NodeSetValue`** instances are kept as-is (useful for passing additional documents);\n        - DOM nodes (objects with `nodeType`) are wrapped in a `NodeSetValue`;\n        - arrays of nodes are wrapped in a `NodeSetValue`.\n\n**`parameters` examples:**\n\n```js\nimport { Xslt, XmlParser } from 'xslt-processor'\n\n// String parameter (default behavior)\nconst xslt = new Xslt({ parameters: [\n  { name: 'title', value: 'Hello' }\n] });\n\n// Number parameter — works in XPath arithmetic ($count + 1 = 43)\nconst xslt = new Xslt({ parameters: [\n  { name: 'count', value: 42 }\n] });\n\n// Boolean parameter — works in xsl:if / xsl:when tests\nconst xslt = new Xslt({ parameters: [\n  { name: 'debug', value: true }\n] });\n\n// Node-set parameter — pass an additional document for cross-document lookups\nimport { NodeSetValue } from 'xslt-processor/xpath/values'\n\nconst xmlParser = new XmlParser();\nconst lookupDoc = xmlParser.xmlParse('\u003clookup\u003e\u003centry key=\"a\"\u003eAlpha\u003c/entry\u003e\u003c/lookup\u003e');\n\nconst xslt = new Xslt({ parameters: [\n  { name: 'lookup', value: new NodeSetValue([lookupDoc]) }\n] });\n// In XSLT: \u003cxsl:value-of select=\"$lookup/lookup/entry[@key='a']\"/\u003e\n```\n\n- `fetchFunction` (`(uri: string) =\u003e Promise\u003cstring\u003e`, optional): a custom function for loading external resources referenced by `\u003cxsl:import\u003e` and `\u003cxsl:include\u003e`. Receives the URI and must return the fetched content as a string. Defaults to the global `fetch` API. This is useful for:\n    - Denying external loading entirely;\n    - Loading from the local filesystem or other non-HTTP sources;\n    - Transforming or remapping URIs before fetching.\n\n**`fetchFunction` examples:**\n\n```js\nimport { readFileSync } from 'fs';\n\n// Deny all external loading\nconst xslt = new Xslt({\n  fetchFunction: async (uri) =\u003e {\n    throw new Error(`External loading is not allowed: ${uri}`);\n  }\n});\n\n// Load from local filesystem\nconst xslt = new Xslt({\n  fetchFunction: async (uri) =\u003e {\n    return readFileSync(uri, 'utf-8');\n  }\n});\n\n// Remap URIs before fetching\nconst xslt = new Xslt({\n  fetchFunction: async (uri) =\u003e {\n    const remapped = uri.replace('https://example.com/', '/local/stylesheets/');\n    const response = await fetch(remapped);\n    return response.text();\n  }\n});\n```\n\n#### JSON Output Format\n\nWhen using `outputMethod: 'json'`, the XSLT processor will convert the resulting XML document to JSON format. This is useful for APIs and modern JavaScript applications.\n\n**Example:**\n\n```js\nconst xslt = new Xslt({ outputMethod: 'json' });\nconst xmlParser = new XmlParser();\n\nconst xmlString = `\u003croot\u003e\n  \u003cusers\u003e\n    \u003cuser\u003eAlice\u003c/user\u003e\n    \u003cuser\u003eBob\u003c/user\u003e\n  \u003c/users\u003e\n\u003c/root\u003e`;\n\nconst xsltString = `\u003c?xml version=\"1.0\"?\u003e\n  \u003cxsl:stylesheet version=\"1.0\" xmlns:xsl=\"http://www.w3.org/1999/XSL/Transform\"\u003e\n    \u003cxsl:template match=\"/\"\u003e\n      \u003cxsl:copy-of select=\"root\"/\u003e\n    \u003c/xsl:template\u003e\n  \u003c/xsl:stylesheet\u003e`;\n\nconst result = await xslt.xsltProcess(\n  xmlParser.xmlParse(xmlString),\n  xmlParser.xmlParse(xsltString)\n);\n\n// result will be a JSON string:\n// {\"root\":{\"users\":{\"user\":[\"Alice\",\"Bob\"]}}}\n\nconst parsed = JSON.parse(result);\nconsole.log(parsed.root.users.user); // [\"Alice\", \"Bob\"]\n```\n\n**JSON Structure Rules:**\n\n- Each element becomes a property in a JSON object\n- Text-only elements become string values\n- Elements with multiple children of the same name become arrays\n- Empty elements are omitted from the output\n- Attributes are prefixed with `@` (when present in the output)\n- Mixed text and element content uses the `#text` property for text nodes\n\n#### Adaptive Output Format\n\nWhen using `outputMethod: 'adaptive'`, the XSLT processor automatically detects the most appropriate output format based on the transformation result. This implements XSLT 3.1 adaptive output behavior.\n\n**Detection Rules:**\n\n- If the output contains only text nodes (no elements), it returns as plain text\n- If the output contains one or more elements, it returns as XML\n\n**Example:**\n\n```js\nconst xslt = new Xslt({ outputMethod: 'adaptive' });\nconst xmlParser = new XmlParser();\n\n// Example 1: Pure text output\nconst xmlString1 = `\u003croot\u003e\u003cvalue\u003eHello World\u003c/value\u003e\u003c/root\u003e`;\nconst xsltString1 = `\u003c?xml version=\"1.0\"?\u003e\n  \u003cxsl:stylesheet version=\"1.0\" xmlns:xsl=\"http://www.w3.org/1999/XSL/Transform\"\u003e\n    \u003cxsl:template match=\"/\"\u003e\n      \u003cxsl:value-of select=\"root/value\"/\u003e\n    \u003c/xsl:template\u003e\n  \u003c/xsl:stylesheet\u003e`;\n\nconst result1 = await xslt.xsltProcess(\n  xmlParser.xmlParse(xmlString1),\n  xmlParser.xmlParse(xsltString1)\n);\nconsole.log(result1); // \"Hello World\" (plain text)\n\n// Example 2: XML output\nconst xmlString2 = `\u003croot\u003e\u003cuser\u003eJohn\u003c/user\u003e\u003c/root\u003e`;\nconst xsltString2 = `\u003c?xml version=\"1.0\"?\u003e\n  \u003cxsl:stylesheet version=\"1.0\" xmlns:xsl=\"http://www.w3.org/1999/XSL/Transform\"\u003e\n    \u003cxsl:template match=\"/\"\u003e\n      \u003cusers\u003e\u003cxsl:copy-of select=\"root/user\"/\u003e\u003c/users\u003e\n    \u003c/xsl:template\u003e\n  \u003c/xsl:stylesheet\u003e`;\n\nconst result2 = await xslt.xsltProcess(\n  xmlParser.xmlParse(xmlString2),\n  xmlParser.xmlParse(xsltString2)\n);\nconsole.log(result2); // \"\u003cusers\u003e\u003cuser\u003eJohn\u003c/user\u003e\u003c/users\u003e\" (XML)\n```\n\n### Direct use in browsers\n\nYou can simply add a tag like this:\n\n```html\n\u003cscript type=\"application/javascript\" src=\"https://unpkg.com/xslt-processor@latest/dist/umd/xslt-processor.global.js\"\u003e\u003c/script\u003e\n```\n\nAll the exports will live under `globalThis.XsltProcessor` and `window.XsltProcessor`. [See a usage example here](https://github.com/DesignLiquido/xslt-processor/blob/main/interactive-tests/xslt.html).\n\n## XPath Parser\n\nTo access the XPath parser, you can use the instance present at `Xslt` class:\n\n```js\nconst xslt = new Xslt();\nconst xPath = xslt.xPath;\n```\n\nOr you can import it like this:\n\n```js\nimport { XPath } from 'xslt-processor'\n\nconst xPath = new XPath();\n```\n\n`XPath` class is an external dependency, [living in its own repository](https://github.com/DesignLiquido/xpath).\n\n## Introduction\n\nXSLT-processor contains an implementation of XSLT in JavaScript. Because XSLT uses XPath, it also contains an implementation of XPath that can be used independently of XSLT. This implementation has the advantage that it makes XSLT uniformly available whenever the browser's native `XSLTProcessor()`\nis not available such as in Node.js or in web workers.\n\nXSLT-processor builds on Google's [AJAXSLT](https://github.com/4031651/ajaxslt) which was written before `XSLTProcessor()` became available in browsers, but the code base has been updated to comply with ES2015+ and to make it work outside of browsers.\n\nThis implementation of XSLT operates at the DOM level on its input documents. It internally uses a DOM implementation to create the output document, but usually returns the output document as text stream. The DOM to construct the output document can be supplied by the application, or else an internal minimal DOM implementation is used. This DOM comes with a minimal XML parser that can be used to generate a suitable DOM representation of the input documents if they are present as text.\n\n## Building from source\n\nThe XPath engine lives in a Git submodule at `src/xpath/lib`. A regular `git clone` does **not** fetch it automatically, so the build will fail unless the submodule is initialised.\n\n### Fresh clone\n\n```sh\ngit clone --recurse-submodules https://github.com/DesignLiquido/xslt-processor.git\ncd xslt-processor\nyarn install\nyarn build\n```\n\n### Already cloned without submodules\n\n```sh\ngit submodule update --init --recursive\nyarn install\nyarn build\n```\n\n### Updating the submodule to the latest commit\n\n```sh\ngit submodule update --remote src/xpath/lib\n```\n\n## Tests and usage examples\n\nNew tests are written in Jest and can be run by calling: `yarn test`.\n\nThe files `xslt.html` and `xpath.html` in the directory `interactive-tests` are interactive tests. They can be run directly from the file system; no HTTP server is needed.\n\nBoth interactive tests and automatic tests demonstrate the use of the library functions.\n\n## Conformance\n\nA few features that are required by the XSLT and XPath standards were left out (but patches to add them are welcome).\n\nSee our [TODO](TODO.md) for a list of missing features that we are aware of (please add more items by means of PRs).\n\nSo far, we have implemented XQuery functions for versions 1.0 and 2.0, but this is not complete yet.\n\nThe DOM implementation is minimal so as to support the XSLT processing, and not intended to be complete.\n\nThe implementation is all agnostic about namespaces. It just expects XSLT elements to have tags that carry the `xsl:` prefix, but we disregard all namespace declarations for them.\n\n[There are a few nonstandard XPath functions](https://github.com/search?q=repo%3ADesignLiquido%2Fxslt-processor%20ext-\u0026type=code).\n\n### HTML Conformance\n\nHTML per se is not strict XML. Because of that, starting on version 2.0.0, this library handles HTML differently than XML:\n\n- For a document to be treated as HTML, it needs to have a `\u003c!DOCTYPE\u003e` tag defined with one of the following valid formats:\n  - `\u003c!DOCTYPE html\u003e` (for HTML5);\n  - `\u003c!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\"\u003e` (for HTML4);\n  - `\u003c!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.1//EN\" \"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd\"\u003e` (for XHTML 1.1).\n- Tags like `\u003chr\u003e`, `\u003clink\u003e` and `\u003cmeta\u003e` don't need to be closed. The output for these tags doesn't close them (adding a `/` before the tag closes, or a corresponding close tag);\n  - This rule doesn't apply for XHTML, which is strict XML.\n\n### Whitespace Handling\n\nThis library supports `xsl:strip-space` and `xsl:preserve-space` for controlling whitespace in the input document.\n\n#### `xsl:strip-space`\n\nUse `\u003cxsl:strip-space\u003e` to remove whitespace-only text nodes from specified elements in the input document:\n\n```xml\n\u003cxsl:stylesheet version=\"1.0\" xmlns:xsl=\"http://www.w3.org/1999/XSL/Transform\"\u003e\n    \u003c!-- Strip whitespace from all elements --\u003e\n    \u003cxsl:strip-space elements=\"*\"/\u003e\n\n    \u003c!-- Or strip from specific elements --\u003e\n    \u003cxsl:strip-space elements=\"book chapter section\"/\u003e\n\n    \u003c!-- ... templates ... --\u003e\n\u003c/xsl:stylesheet\u003e\n```\n\nThe `elements` attribute accepts:\n- `*` - matches all elements\n- `name` - matches elements with the specified local name\n- `prefix:*` - matches all elements in a namespace\n- `prefix:name` - matches a specific element in a namespace\n- Multiple patterns separated by whitespace (e.g., `\"book chapter section\"`)\n\n#### `xsl:preserve-space`\n\nUse `\u003cxsl:preserve-space\u003e` to preserve whitespace in specific elements, overriding `xsl:strip-space`:\n\n```xml\n\u003cxsl:stylesheet version=\"1.0\" xmlns:xsl=\"http://www.w3.org/1999/XSL/Transform\"\u003e\n    \u003cxsl:strip-space elements=\"*\"/\u003e\n    \u003c!-- Preserve whitespace in pre and code elements --\u003e\n    \u003cxsl:preserve-space elements=\"pre code\"/\u003e\n\n    \u003c!-- ... templates ... --\u003e\n\u003c/xsl:stylesheet\u003e\n```\n\n#### Precedence Rules\n\n1. `xml:space=\"preserve\"` attribute on an element takes highest precedence\n2. `xsl:preserve-space` overrides `xsl:strip-space` for matching elements\n3. `xsl:strip-space` applies to remaining matches\n4. By default (no declarations), whitespace is preserved\n\n### Breaking Changes\n\nBreaking changes are usually documented at every major release, but we also keep a short version of them below.\n\n#### Version 2\n\nUntil version 2.3.1, use like the example below:\n\n```js\nimport { Xslt, XmlParser } from 'xslt-processor'\n\n// xmlString: string of xml file contents\n// xsltString: string of xslt file contents\n// outXmlString: output xml string.\nconst xslt = new Xslt();\nconst xmlParser = new XmlParser();\nconst outXmlString = xslt.xsltProcess( // Not async.\n\txmlParser.xmlParse(xmlString),\n\txmlParser.xmlParse(xsltString)\n);\n```\n\nVersion 3 received `\u003cxsl:include\u003e` which relies on Fetch API, which is asynchronous. Version 2 doesn't support `\u003cxsl:include\u003e`.\n\nIf using Node.js older than version v17.5.0, please use version 3.2.3, that uses `node-fetch` package. Versions 3.3.0 onward require at least Node.js version v17.5.0, since they use native `fetch()` function.\n\n#### Version 1\n\nUntil version 1.2.8, use like the example below:\n\n```js\nimport { Xslt, xmlParse } from 'xslt-processor'\n\n// xmlString: string of xml file contents\n// xsltString: string of xslt file contents\n// outXmlString: output xml string.\nconst xslt = new Xslt();\nconst outXmlString = xslt.xsltProcess(\n\txmlParse(xmlString),\n\txmlParse(xsltString)\n);\n```\n\n#### Version 0\n\nUntil version 0.11.7, use like the example below:\n\n```js\nimport { xsltProcess, xmlParse } from 'xslt-processor'\n\n// xmlString: string of xml file contents\n// xsltString: string of xslt file contents\n// outXmlString: output xml string.\nconst outXmlString = xsltProcess(\n\txmlParse(xmlString),\n\txmlParse(xsltString)\n);\n```\n\nand to access the XPath parser:\n\n```js\nimport { xpathParse } from 'xslt-processor'\n```\n\nThese functions are part of `Xslt` and `XPath` classes, respectively, at version 1.x onward.\n\n## References\n\n- XPath Specification: http://www.w3.org/TR/1999/REC-xpath-19991116\n- XSLT Specification: http://www.w3.org/TR/1999/REC-xslt-19991116\n- W3C DOM Level 3 Core Specification: http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/\n- ECMAScript Language Specification: http://www.ecma-international.org/publications/standards/Ecma-262.htm\n- Arkts Language Specification: https://gitee.com/openharmony/arkcompiler_runtime_core/releases/download/ArkTS-spec-1.2.0-alpha-20250307/arktsspecification.pdf\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdesignliquido%2Fxslt-processor","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdesignliquido%2Fxslt-processor","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdesignliquido%2Fxslt-processor/lists"}