β
Home HTML JAVASCRIPT CSS VUE REACT PYTHON3 JAVA C C++ C# AI GO SQL LINUX VS CODE BOOTSTRAP GIT Local Bookmarks
XSLT Tutorial
XSLT Tutorial
XSL Language
XSLT Introduction
XSLT Browsers
XSLT Transformation
XSLT <template>
XSLT <value-of>
XSLT <for-each>
XSLT <sort>
XSLT <if>
XSLT <choose>
XSLT Apply
XSLT Client-side
XSLT Server-side
XSLT Editing XML
XML Editors
XSLT Summary
XSLT Examples
XSLT Elements
XSLT Functions
XSLT Transformation Tools
XSLT Browsers
XSLT <xsl:template> Element
XSLT - Transformation
Case Study: How to use XSLT to transform XML into XHTML.
We will explain the details of this example in the next chapter.
Correct Stylesheet Declaration
The root element that declares a document as an XSL stylesheet is either <xsl:stylesheet> or <xsl:transform>.
Note: <xsl:stylesheet> and <xsl:transform> are completely synonymous and can both be used!
According to the W3C XSLT standard, the correct way to declare an XSL stylesheet is:
Or:
To access XSLT elements, attributes, and features, we must declare the XSLT namespace at the top of the document.
xmlns:xsl="http://www.w3.org/1999/XSL/Transform" points to the official W3C XSLT namespace. If you use this namespace, you must include the version="1.0" attribute.
Starting from a Raw XML Document
We now want to transform the following XML document ("cdcatalog.xml") into XHTML:
Viewing XML files in Firefox and Internet Explorer: Open the XML file (usually by clicking a link) β the XML document will display the root and child elements with color-coded syntax. Click the plus (+) or minus (-) signs to the left of elements to expand or collapse their structure. To view the raw XML source (without plus/minus signs), select "View Page Source" or "View Source" from your browser menu.
Viewing XML files in Netscape 6: Open the XML file, right-click within it, and select "View Page Source". The XML document will display the root and child elements with color-coded syntax.
Viewing XML files in Opera 7: Open the XML file, right-click within it, choose "Frame" / "View Source". The XML document will appear as plain text.
View "cdcatalog.xml"
Creating an XSL Stylesheet
Next, create an XSL stylesheet ("cdcatalog.xsl") with a transformation template:
My CD Collection
| Title | Artist |
|---|---|
View "cdcatalog.xsl"
Linking the XSL Stylesheet to the XML Document
Add a reference to the XSL stylesheet in the XML document ("cdcatalog.xml"):
If your browser supports XSLT, it will smoothly transform your XML into XHTML.
View Result
We will explain the details of the above example in the next chapter.
XSLT Browsers
XSLT <xsl:template> Element
ByteArk Coding Plan
Supports mainstream large models including Doubao, GLM, DeepSeek, Kimi, MiniMax, etc., officially provided and stable/reliable.
Β₯9.9
/ month
Subscribe Now
iFlytek Starlight Coding Plan
Includes free model invocation quotas; one-stop platform for experiencing and deploying DeepSeek, GLM, Kimi, MiniMax, etc.
Β₯3.9
/ month
Subscribe Now
Click to Share Notes
Category Navigation
Python / Data Science
AI / Intelligent Development
Frontend Development
Backend Development
Databases
Mobile Development
DevOps / Engineering
Programming Languages
Computer Fundamentals
XML / Web Service
.NET
Website Building
Advertisement
XSLT Tutorial
XSLT Tutorial
XSL Language
XSLT Introduction
XSLT Browsers
XSLT Transformation
XSLT
Online Examples
Β· HTML Examples
Β· CSS Examples
Β· JavaScript Examples
Β· Ajax Examples
Β· jQuery Examples
Β· XML Examples
Β· Java Examples
Character Sets & Tools
Β· HTML Character Set Settings
Β· HTML ASCII Character Set
Β· JS Obfuscation/Encryption
Β· PNG/JPEG Image Compression
Β· HTML Color Picker
Β· JSON Formatter
Β· Random Number Generator
Latest Updates
Β· docker compose ...
Β· GraphRAG Beginner Tutorial
Β· Dart Enums and Symbols
Β· Dart Unit Testing
Β· Dart Concurrency and Iso...
Β· Dart Stream
Β· Dart Asynchronous Programming
Site Info
Β· Feedback
Β· Disclaimer
Β· About Us
Β· Article Archive
Follow WeChat
My Favorites
Bookmark Article
Browsing History
Clear All
No Records Yet
YouTip