Skip to main content

XML format

XSLT stylesheet

A transformation program written in XML, used to reshape one XML vocabulary into another.

XSLT is still the shortest path from one XML vocabulary to another, and it is common in integration pipelines that map a partner's payload onto an internal format. A stylesheet's root may be <xsl:stylesheet> or the synonym <xsl:transform>.

The namespace URI is identical across XSLT 1.0, 2.0 and 3.0; only the version attribute distinguishes them. A 1.0-only processor will accept a 3.0 stylesheet's namespace and then fail on its instructions.

Constraints that bite

  • Check the version attribute, not the namespace, to know which XSLT level a stylesheet needs.
  • XSLT 1.0 processors are still common; 2.0+ features fail at runtime rather than at parse time.
  • document() and external entity resolution can reach the network or filesystem — a risk with untrusted stylesheets.
  • Output method and encoding are declared by <xsl:output>, not by the input document.
Root element
<stylesheet>
Media type
application/xslt+xml
Extensions
.xsl, .xslt
Namespaces
  • http://www.w3.org/1999/XSL/Transform
XMLDir label
xml

Specification: XSLT 3.0

A minimal valid document

Every example on this site is checked against the same parser the workspace uses, so what you see below is known to be well-formed.

xslt.xml
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
                xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
  <xsl:output method="xml" indent="yes"/>
  <xsl:template match="/Order">
    <Summary id="{OrderId}"/>
  </xsl:template>
</xsl:stylesheet>

Get started

Bring order to the XML your team can't afford to ignore.

Create a free account and get a private workspace to search, validate, diff, and monitor your XML feeds, sitemaps, schemas, and vendor integrations.