-- Learning is not just about technology, but also about dreams!
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
Introduction to XSLT
XSLT Browsers
XSLT Transformation
XSLT
XSLT
XSLT
XSLT
XSLT
XSLT
XSLT Apply
XSLT on the Client Side
XSLT on the Server Side
XSLT Editing XML
XML Editors
XSLT Summary
XSLT Examples
XSLT Elements
XSLT Functions
XSLT Conversion Tools
XSLT on the Client Side
XSLT β Editing XML
In-Depth Exploration
Programming
Software Utilities
Web Browsers
Scripting Languages
Computer Servers
Networking
Computer Hardware
Computer
Search
Programming Languages
XSLT - On the Server Side
Since not all browsers support XSLT, another solution is to perform the XML-to-XHTML transformation on the server.
Cross-Browser Solution
In previous chapters, we explained how to use XSLT in the browser to transform XML into XHTML. We created a JavaScript snippet that uses an XML parser to perform the transformation. However, the JavaScript solution will not work in browsers lacking an XML parser.
To make XML data compatible with any type of browser, we must transform the XML document on the server and then send it back to the browser as XHTML.
This is another advantage of XSLT. One of XSLTβs design goals is to enable data transformation from one format to another on the server, returning readable data to all types of browsers.
XML File and XSLT File
Consider this XML document shown in earlier chapters:
Empire Burlesque
Bob Dylan
USA
Columbia
10.90
1985
.
.
View the XML file.
And its accompanying XSL stylesheet:
My CD Collection
View the XSL file.
Note that this XML file does not contain a reference to the XSL file.
Important: This means the XML file can be transformed using multiple different XSL stylesheets.
Transforming XML to XHTML on the Server
Below is the source code for transforming an XML file into XHTML on the server:
Using PHP code for transformation:
load('cdcatalog.xml');
// Load XSL file
$xsl = new DOMDocument;
$xsl->load('cdcatalog.xsl');
// Set up transformer
$proc = new XSLTProcessor;
// Import XSL rules
$proc->importStyleSheet($xsl);
echo $proc->transformToXML($xml);
?>
Tip: If youβre unfamiliar with writing PHP, you can learn from our PHP Tutorial.
Using ASP code for transformation:
Tip: If youβre unfamiliar with writing ASP, you can learn from our ASP Tutorial.
The first block of code creates an instance of Microsoftβs XML parser (XMLDOM) and loads the XML file into memory. The second block creates another instance of the parser and loads the XSL file into memory. The final line transforms the XML document using the XSL document and sends the resulting XHTML to your browser. Great!
How it works.
XSLT on the Client Side
XSLT β Editing XML
Byte Ark Coding Plan
Supports mainstream large models including Doubao, GLM, DeepSeek, Kimi, MiniMax, etc., officially supplied for stable and reliable service.
Β₯9.9
/ month
Subscribe Now
iFLYTEK Xingchen Coding Plan
Includes free model invocation quota; supports DeepSeek, GLM, Kimi, MiniMax β an all-in-one experience and deployment platform.
Β₯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 Services
.NET
Website Development
Advertisement
XSLT Tutorial
XSLT Tutorial
XSL Language
Introduction to XSLT
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 Tool
Β· 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 Information
Β· Feedback
Β· Disclaimer
Β· About Us
Β· Article Archive
Follow on WeChat
My Favorites
Bookmark Articles
Browsing History
Clear All
No records yet