XML İpuçları
Bu dosyada XML ile ilgili ipuçları bulunmaktadır
Genel
XSL çalışmak için en kolay yol, bir browser kullanmaktır.
nternet Explorer 5.5'ten yukarısı Netscape 6'dan yukarısı XML desteklemektedir. Bunun için yazılan XML belgesinin içerisine
<?xml-stylesheet href="mystylesheet.xsl" type="text/xsl"?>
yazmak yeterlidir. XML belgesini yükleyen browser bu ifadeyi görünce belirtilen XSL'i yükler, XML dosyasını bu XSL'den geçirerek sonucu ekranda gösterir. Örneğin XML şöyle olsun :
<? xml version ="1. 0" encoding ="ISO- 8859- 9"? >
<? xml - stylesheet href ="test. xsl" type ="text/ xsl"? > <! - - BOLD OLACAK - - >
<person code="007" >
<nme first="James" last="Bond"/ >
<address>
<line1>Ekzemelci Osman Paşa Caddesi</ line1>
<line2>Ekzesel Apt. No: 10 D:1</ line2>
<district>Mecidiyeköy</ district>
<province>İstanbul</ province>
<country>Türkiye</ country>
</ address>
</ person>
Bu belgede belirtilen XSL (test.xsl)de şöyle olsun
<? xml version ="1. 0" encoding ="ISO- 8859- 9"? >
<xsl :stylesheet version ="1. 0" xmlns :xsl ="http:/ / www. w3. org/ 1999/ XSL / Transform" >
<xsl :template match ="/ ">
<html>
<body>
<h1>Kod : <xsl :value - of select ="/ person/ @ code"/ ></ h1>
<h3><xsl :text> İsim </ xsl :text></ h3>
<xsl :value - of select ="/ person/ name / @ first"/ >
<xsl :text> </ xsl :text>
<xsl :value - of select ="/ person/ name / @ last"/ >
<h3><xsl :text> Adres </ xsl :text></ h3>
<xsl :value - of select ="/ person/ address/ line1"/ ><br/ >
<xsl :value - of select ="/ person/ address/ line2"/ ><br/ ><br/ >
<xsl :value - of select ="/ person/ address/ district"/ ><br/ >
<xsl :value - of select ="/ person/ address/ province"/ ><br/ >
<xsl :value - of select ="/ person/ address/ country"/ >
</ body>
</ html>
</ xsl :template >
</ xsl :stylesheet >
Bunun sonucunda HTML üretilir ve gösterilir.
Dosya Listesi