Reprinted, please indicate the source: Use xml and XSL to make webpage instances
Use XML and XSL as a web page. Just save the two files and run them.
cdcatalog.xml is equivalent to html
cdcatalog.xsl is equivalent to css
cdcatalog.xml
[html] view plaincopy
<?xml version="1.0" encoding="ISO-8859-1"?> <?xml-stylesheet type="text/xsl" href="http://www.php1.cn/"> <catalog> <cd> <title>Empire Burlesque</title> <artist>Bob Dylan</artist> <country>USA</country> <company>Columbia</company> <price>10.90</price> <year>1985</year> </cd> <cd> <title>Empire Burlesqu2e</title> <artist>Bob Dyla2n</artist> <country>USA2</country> <company>Columbia2</company> <price>10.91</price> <year>1983</year> </cd> <cd> <title>Empire Burlesqu2e</title> <artist>Bob Dyla2n</artist> <country>USA2</country> <company>Columbia2</company> <price>10.91</price> <year>1983</year> </cd> <cd> <title>Empire Burlesqu2e</title> <artist>Bob Dyla2n</artist> <country>USA2</country> <company>Columbia2</company> <price>10.91</price> <year>1983</year> </cd> <cd> <title>Empire Burlesqu2e</title> <artist>Bob Dyla2n</artist> <country>USA2</country> <company>Columbia2</company> <price>10.91</price> <year>1983</year> </cd> <cd> <title>Empire Burlesqu2e</title> <artist>Bob Dyla2n</artist> <country>USA2</country> <company>Columbia2</company> <price>10.91</price> <year>1983</year> </cd> </catalog>
cdcatalog.xsl
[html] view plaincopy
<?xml version="1.0" encoding="ISO-8859-1"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:template match="/"> <html> <body> <h2 id="My-nbsp-CD-nbsp-Collection">My CD Collection</h2> <table border="1"> <tr bgcolor="#9acd32"> <th align="left">Title</th> <th align="left">Artist</th> </tr> <xsl:for-each select="catalog/cd"> <tr> <td><xsl:value-of select="title"/></td> <td><xsl:value-of select="artist"/></td> </tr> </xsl:for-each> </table> </body> </html> </xsl:template> </xsl:stylesheet>
Open cdcatalog.xml with a browser to see the effect. Supported by most browsers and programming languages.
Effect:
My CD Collection
Title | Artist |
---|---|
Empire Burlesque | Bob Dylan |
Empire Burlesqu2e | Bob Dyla2n |
Empire Burlesqu2e | Bob Dyla2n |
Empire Burlesqu2e | Bob Dyla2n |
Empire Burlesqu2e | Bob Dyla2n |
Empire Burlesqu2e | Bob Dyla2n |
The above is the content of using xml and xsl to make web page examples. For more related content, please pay attention to the PHP Chinese website (www.php.cn)!

This article explains how to use RSS feeds for efficient news aggregation and content curation. It details subscribing to feeds, using RSS readers (like Feedly and Inoreader), organizing feeds, and leveraging features for targeted content. The bene

This article explores integrating XML and Semantic Web technologies. The core issue is mapping XML's structured data to RDF triples for semantic interoperability. Best practices involve ontology definition, strategic mapping approaches, careful att

This article details implementing content syndication using RSS feeds. It covers creating RSS feeds, identifying target websites, submitting feeds, and monitoring effectiveness. Challenges like limited control and rich media support are also discus

This article details using XML for data interoperability, focusing on healthcare and finance. It covers schema definition, XML document creation, data transformation, parsing, and exchange mechanisms. Key XML standards (HL7, DICOM, FinML, ISO 20022)

This article details securing RSS feeds against unauthorized access. It examines various methods including HTTP authentication, API keys with rate limiting, HTTPS, and content obfuscation (discouraged). Best practices involve IP restriction, revers

This article explains Atom Publishing Protocol (AtomPub) for web content management. It details using HTTP methods (GET, POST, PUT, DELETE) with Atom format for content creation, retrieval, updating, and deletion. The article also discusses AtomPub

This article details creating custom XML vocabularies (schemas) for data consistency. It covers defining scope, identifying entities & attributes, designing XML structure, choosing a schema language (XSD or Relax NG), schema development, testing

This article explains how optimizing RSS feeds indirectly improves website SEO. It focuses on enhancing feed content (descriptions, keywords, metadata), structure (XML, formatting, encoding), and distribution to boost user engagement, content discov


Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Atom editor mac version download
The most popular open source editor

VSCode Windows 64-bit Download
A free and powerful IDE editor launched by Microsoft

MinGW - Minimalist GNU for Windows
This project is in the process of being migrated to osdn.net/projects/mingw, you can continue to follow us there. MinGW: A native Windows port of the GNU Compiler Collection (GCC), freely distributable import libraries and header files for building native Windows applications; includes extensions to the MSVC runtime to support C99 functionality. All MinGW software can run on 64-bit Windows platforms.

SublimeText3 Linux new version
SublimeText3 Linux latest version

mPDF
mPDF is a PHP library that can generate PDF files from UTF-8 encoded HTML. The original author, Ian Back, wrote mPDF to output PDF files "on the fly" from his website and handle different languages. It is slower than original scripts like HTML2FPDF and produces larger files when using Unicode fonts, but supports CSS styles etc. and has a lot of enhancements. Supports almost all languages, including RTL (Arabic and Hebrew) and CJK (Chinese, Japanese and Korean). Supports nested block-level elements (such as P, DIV),
