XSLT 2.0
XSLT 2.0 stylesheet
XSLT 2.0 stylesheets checked against the W3C schema for XSLT: elements, attributes and where they may appear.
About
The schema is published with the XSLT 2.0 Recommendation. It catches misplaced instructions, unknown xsl: elements and wrong attributes before a processor such as Saxon is run.
It imports XMLSchema.xsd and xml.xsd, included here.
Good to know
- XPath expressions in select, match and test are checked as strings only, not parsed.
- Stylesheets marked version="1.0" can also be checked; elements new in 2.0 are then still allowed.
- The example is by xmlvalid.com.
Files
3 files · 136.1 KB-
schema-for-xslt20.xsd main
-
xml.xsd
-
XMLSchema.xsd
The validator loads all of these with their folder structure, so includes and imports resolve as published.
Example document
invoice-to-html.xsl · 812 B · valid against this schema
In CI and from code
The same schema by its name, xslt-2.0, through the API.
npx @xmlvalid/cli validate "**/*.xml" --schema xslt-2.0
- uses: xmlvalid/validate-action@v1
with:
files: "**/*.xml"
schema: xslt-2.0
api-key: ${{ secrets.XMLVALID_API_KEY }}
curl https://xmlvalid.com/api/v1/validations \
-H "Authorization: Bearer $XMLVALID_API_KEY" \
-F document={{ $schema->example ?? 'document.xml' }} -F schema=xslt-2.0
Free accounts get 100 API validations a month. On Pro, a URL monitor can check a published document against this schema every hour and email you when it breaks. More CI setups