From 09be635f9ff26a662e9461dcf1c264a9a3f7dde3 Mon Sep 17 00:00:00 2001 From: Erik Hetzner Date: Wed, 27 May 2026 11:43:21 -0700 Subject: [PATCH 1/4] readme updates --- README.md | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 82ec87d..5a71a54 100644 --- a/README.md +++ b/README.md @@ -11,13 +11,24 @@ XJSLT runs in javascript runtimes and on the browser. It has been tested with [n ## Installation: ``` -npm install && npm run build +npm install -g xjslt +``` + +Or use + +``` +npx xjslt … +``` +or from source: + +``` +git clone https://github.com/egh/xjslt.git && cd xjslt ``` ## Command line invocation: ``` -xjslt run jats-html.xsl <(curl -s https://jats.nlm.nih.gov/publishing/tag-library/1.1/FullArticleSamples/bmj_sample.xml) +xjslt run <(curl -s https://raw.githubusercontent.com/egh/xjslt/refs/heads/main/jats-html.xsl) <(curl -s https://jats.nlm.nih.gov/publishing/tag-library/1.1/FullArticleSamples/bmj_sample.xml) ``` # Compilation examples @@ -26,6 +37,8 @@ XJSLT can compile XSLT stylesheets into executable JavaScript code, which can th ## In the browser +For the following commands you will want to have the source checked out. + ``` xjslt compile --web jats-html.xsl examples/html/transform.js ``` @@ -34,6 +47,8 @@ xjslt compile --web jats-html.xsl examples/html/transform.js ## For reuse in the command line +Pre-compiling a `.js` file will speed up transformation. + ``` xjslt compile jats-html.xsl ``` From e3f6199700f352e577f6c5ac7a41c711a8b3a10c Mon Sep 17 00:00:00 2001 From: Erik Hetzner Date: Wed, 27 May 2026 19:03:25 -0700 Subject: [PATCH 2/4] running tests is simpler now --- README.md | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 5a71a54..8539401 100644 --- a/README.md +++ b/README.md @@ -109,17 +109,13 @@ All core features of XSLT 2.0. Roughly 50% of tests in the XSLT test suite (htt # Running tests -The test suite includes both unit tests and a subset of the [W3C XSLT 3.0 test suite](https://github.com/w3c/xslt30-test). To run tests: +The test suite includes both unit tests and a subset of the [W3C XSLT 3.0 test suite](https://github.com/w3c/xslt30-test). To run tests, ensure dependencies are installed: + -1. Clone the W3C test suite into the project root: -``` -git clone --depth=1 https://github.com/w3c/xslt30-test.git -``` -2. Build (including preprocessors): ``` -npm run build-preprocessors +npm install ``` -3. Run tests: +and then run: ``` npm test ``` From 3fadbafe33d41d45c8ddd788e6261ada26de12fd Mon Sep 17 00:00:00 2001 From: Erik Hetzner Date: Wed, 27 May 2026 19:10:19 -0700 Subject: [PATCH 3/4] lint --- .github/workflows/test.yml | 2 +- .vscode/launch.json | 20 ++++---------------- README.md | 17 ++++++++++++++--- 3 files changed, 19 insertions(+), 20 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 611b452..85e5fca 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -22,7 +22,7 @@ jobs: - name: Set up Node.js uses: actions/setup-node@v5 with: - cache: 'npm' + cache: "npm" - name: Install dependencies run: npm ci diff --git a/.vscode/launch.json b/.vscode/launch.json index 212c6d0..cbeff36 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -6,12 +6,7 @@ "request": "launch", "name": "Debug Jest Currently select test name", "program": "${workspaceFolder}/node_modules/.bin/jest", - "args": [ - "--runInBand", - "--no-coverage", - "-t", - "${selectedText}" - ], + "args": ["--runInBand", "--no-coverage", "-t", "${selectedText}"], "console": "integratedTerminal", "sourceMaps": true }, @@ -20,10 +15,7 @@ "request": "launch", "name": "Debug Jest Tests", "program": "${workspaceFolder}/node_modules/.bin/jest", - "args": [ - "--runInBand", - "--no-coverage" - ], + "args": ["--runInBand", "--no-coverage"], "console": "integratedTerminal", "sourceMaps": true }, @@ -32,13 +24,9 @@ "request": "launch", "name": "Debug Jest Current File", "program": "${workspaceFolder}/node_modules/.bin/jest", - "args": [ - "--runInBand", - "--no-coverage", - "${fileBasenameNoExtension}" - ], + "args": ["--runInBand", "--no-coverage", "${fileBasenameNoExtension}"], "console": "integratedTerminal", "sourceMaps": true } ] -} \ No newline at end of file +} diff --git a/README.md b/README.md index 8539401..eebe234 100644 --- a/README.md +++ b/README.md @@ -14,11 +14,12 @@ XJSLT runs in javascript runtimes and on the browser. It has been tested with [n npm install -g xjslt ``` -Or use +Or use ``` npx xjslt … ``` + or from source: ``` @@ -52,6 +53,7 @@ Pre-compiling a `.js` file will speed up transformation. ``` xjslt compile jats-html.xsl ``` + ``` xjslt run transform.js <(curl -s https://jats.nlm.nih.gov/publishing/tag-library/1.1/FullArticleSamples/bmj_sample.xml) ``` @@ -65,15 +67,19 @@ XJSLT can be used to compile XSLT into JavaScript that can be used in, for examp ``` xjslt compile --standalone jats-html.xsl examples/google-cloud/transform.js ``` + ``` cd examples/google-cloud ``` + ``` npm install ``` + ``` npx @google-cloud/functions-framework --target=transform ``` + - Visit http://localhost:8080/?url=https://jats.nlm.nih.gov/publishing/tag-library/1.1/FullArticleSamples/bmj_sample.xml ## In a cloudflare edge function @@ -81,20 +87,24 @@ npx @google-cloud/functions-framework --target=transform ``` xjslt compile --standalone jats-html.xsl examples/cloudflare/src/transform.js ``` + ``` cd examples/cloudflare ``` + ``` npm install ``` + ``` npm run start ``` + - Visit http://localhost:8787/?url=https://jats.nlm.nih.gov/publishing/tag-library/1.1/FullArticleSamples/bmj_sample.xml # Supported features -All core features of XSLT 2.0. Roughly 50% of tests in the XSLT test suite (https://github.com/w3c/xslt30-test) pass - but many of these tests are for edge cases. +All core features of XSLT 2.0. Roughly 50% of tests in the XSLT test suite (https://github.com/w3c/xslt30-test) pass - but many of these tests are for edge cases. # Incompletely supported features @@ -111,11 +121,12 @@ All core features of XSLT 2.0. Roughly 50% of tests in the XSLT test suite (htt The test suite includes both unit tests and a subset of the [W3C XSLT 3.0 test suite](https://github.com/w3c/xslt30-test). To run tests, ensure dependencies are installed: - ``` npm install ``` + and then run: + ``` npm test ``` From e1b464ff027d71a07d263afddd0dc2326928da43 Mon Sep 17 00:00:00 2001 From: Erik Hetzner Date: Wed, 27 May 2026 19:13:17 -0700 Subject: [PATCH 4/4] lint --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index acfa51b..ef35828 100644 --- a/package.json +++ b/package.json @@ -16,7 +16,7 @@ "scripts": { "build": "tsc && chmod +x dist/cli.js", "prebuild-preprocessors": "npm run build && rm src/preprocess/*js", - "build-preprocessors": "bash -c \"for n in src/preprocess/*xsl ; do npm exec -- xjslt compile --standalone \\$n \\${n/xsl/js} ; done\"", + "build-preprocessors": "bash -c \"for n in src/preprocess/*xsl ; do npm exec -- xjslt compile --standalone \\$n \\${n/xsl/js} ; done\"", "postbuild-preprocessors": "prettier -w src/preprocess/ && npm run build", "pretest": "if [ -d xslt30-test ] ; then cd xslt30-test && git pull && cd .. ; else git clone --depth 1 https://github.com/w3c/xslt30-test/ ; fi", "test": "jest --coverage --verbose",