xml と xsl を使用して Web ページのサンプルを作成する
すべて、すべてのすべてのソースを示してください。 2 つのファイルを保存して実行するだけです。
cdcatalog.xmlはhtmlと同等です
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] 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>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>
ブラウザで cdcatalog.xml を開いて効果を確認してください。ほとんどのブラウザとプログラミング言語でサポートされています。
効果:
私のCDコレクション
タイトル
エンパイア・バーレスク | |
---|---|
帝国バーレスク2e | |
帝国バーレスク2e | |
帝国バーレスク2e | |
帝国バーレスク2e | |
帝国バーレスク2e | |
上記は、xml と xsl を使用して Web ページのサンプルを作成する内容です。その他の関連コンテンツについては、PHP 中国語 Web サイト (m.sbmmt.com) に注目してください。 |

ホットAIツール

Undress AI Tool
脱衣画像を無料で

Undresser.AI Undress
リアルなヌード写真を作成する AI 搭載アプリ

AI Clothes Remover
写真から衣服を削除するオンライン AI ツール。

Clothoff.io
AI衣類リムーバー

Video Face Swap
完全無料の AI 顔交換ツールを使用して、あらゆるビデオの顔を簡単に交換できます。

人気の記事

ホットツール

メモ帳++7.3.1
使いやすく無料のコードエディター

SublimeText3 中国語版
中国語版、とても使いやすい

ゼンドスタジオ 13.0.1
強力な PHP 統合開発環境

ドリームウィーバー CS6
ビジュアル Web 開発ツール

SublimeText3 Mac版
神レベルのコード編集ソフト(SublimeText3)

xmlschemavalidationinphpisachieveveveveveveveveddomdocumentanddomxpathclassesseswiththelibxmlextension.1)loadthexmlfilewithdomdocument.2) useschemavalidatovalidateagain stanxsdssdssdsdssdssdssdscema、throwinganexceptionifvalidations.3)forlargefiles、usexmlreaderforstreamingva

Integrateanexternalrssintososososososososososososososhopify、firstverifythefeed’svalidityandformatting.2.usecustomjavascriptwithapiLikerikerss2jsontofetheddisplaythefeedinaliquidtemplate、asshopifylacksnativeupport.3。

xmlbenefitsdeveloperswithitssimplicity、柔軟性、およびポータビリティ。1)Human-readableformataidsineasydebugging.2)customizabletagsallowforadaptableastructures.3)プラットフォーム依存の依存性を維持する

bestpracticesforusingxmlnamesspacesinwebserceare:1)usemevennamespaceuris、2)useshortanddescriptiveprefixes、3)一貫してアプリケーションスペース、4)避難所、5)ドキュメンタルスペース、および6)

高度なxmliscrucialforensuringdocumentscanbeparesedandurstoundurstoodountood bynyxmlprocessor.tocreatewell-formedxml:1)useasinglerootelementashementasthefoundation、2)ensurealltagsareporperlyclosed、for foredtags forementyine、3)

xml'suitability-forperformance-criticalapplicationsdependsonsusneeds.1)xml'sparsingoverheadcanbesificant、特にlargefiles.2)Serialization and dearization inxmlaretime-conuming.3)xml'sverbosityleadostessopargeLeargeLegerfilesizes、Impactingnetworkan

notvalidatingwell-formedxmlcanleadtoseriousissues.1)dategegrityerrorsoccur withoutvalidation.2)InteroperabilityississeaSeassySeassyssmaystreptelly.3)セキュリティリスクの装備の継続的なエクスペリティなものbymaliousioutiatiotiationiousiousioty

CommonXMLerrorsIncludeMismatchedTags、不正、Quotedattributevalues、CaseSensitivityIssues、InvalidCharacters、およびMisusedDeclarations.ToAvoidSeSE:1)usexmLeditorswithsaxhightinghightingingingingandauto-compopredismismismismismismismismismismatidtags.2)
