XSLT (XSL Transformer)
Transform an XML document using an XSL stylesheet (XSLT 1.0). Fully supports XML namespaces and lets you choose the indentation.
Loading tool...
XSLT explained
What is XSLT?
XSLT (Extensible Stylesheet Language Transformations) is a declarative language for transforming XML documents into other documents: HTML, plain text, CSV... This tool runs XSLT 1.0 entirely in your browser.
The most useful XSLT 1.0 instructions
| Instruction | Purpose |
|---|---|
<xsl:template match="pattern"> |
Defines output for matching nodes |
<xsl:apply-templates select="..."/> |
Processes selected nodes recursively |
<xsl:for-each select="..."> |
Loops over selected nodes |
<xsl:value-of select="..."/> |
Outputs the string value of an expression |
<xsl:if test="..."> |
Conditional output |
<xsl:copy-of select="..."/> |
Deep-copies nodes from the source |
<xsl:variable> |
Declares a variable |
<xsl:output method="xml|html|text"/> |
Controls serialization |
Tips
- Every prefix used in XPath must be declared on the root element of the stylesheet.
- Add
exclude-result-prefixesto drop unwantedxmlnsattributes from the result. - Namespaces in XPath are case-sensitive and namespace-aware.