XML နှင့် XSLT
- အရေးပါသော XML XPath
- နောက်ပိုင်း XML XQuery
XSLT အသုံးပြု၍ XML အချက်အလက်ကို HTML အချက်အလက်သို့ ပြောင်းလဲလိမ့်မည်
XSLT အသုံးပြု၍ XML ကို ပြသပါ
XSLT(အင်္ဂါစကားကြောင်းသတင်းများပေါ်တွင် အသုံးပြုရန် အကူအညီပေးသော အင်္ဂါစကားပုံစံသတင်းအချက်အလက်များအား ပြောင်းလဲရန် အသုံးပြုသော အင်္ဂါစကားပုံစံအကျွမ်းကျွမ်းသည်)
XSLT သည် CSS ထက်ပို၍ လုပ်လျက်ရှိသည်။ XSLT အသုံးပြု၍ သင့်ကြိုက်သော အသုံးပြုရာမှ အရာများကို ထပ်ပေါင်း/ဖယ်ရဖို့ပါ၍ အရာများကို ပြန်လည်ပြေစီ/တိုက်တွက်ပြီး အရာများကို ဖုံးကွယ်/ပြသကြိုက်ပြီး ပြေစီကြိုက်မှုများ လုပ်ဆောင်လိမ့်မည်
XSLT သည် XPath အသုံးပြု၍ XML အချက်အလက်တွင် သတင်းကိုရှာဖွေလိမ့်မည်
XSLT အမှတ်အသား
ကျွန်တော်တို့သည်ကျွန်တော်မှာပါသော XML အချက်အလက်ကိုကြည့်လာပါသည်
<?xml version="1.0" encoding="UTF-8"?> <breakfast_menu> <food> <name>Belgian Waffles</name> <price>$5.95</price> <description>Two of our famous Belgian Waffles with plenty of real maple syrup</description> <calories>650</calories> </food> <food> <name>Strawberry Belgian Waffles</name> <price>$7.95</price> <description>Light Belgian waffles covered with strawberries and whipped cream</description> <calories>900</calories> </food> <food> <name>Berry-Berry Belgian Waffles</name> <price>$8.95</price> <description>Light Belgian waffles covered with an assortment of fresh berries and whipped cream</description> <calories>900</calories> </food> <food> <name>French Toast</name> <price>$4.50</price> <description>ကျွန်ုပ်တို့၏ ပြည့်စုံသော ဟိုးမီးရောဂါပဲ ပြုလုပ်ထားသော ဆီပုံ</description> <calories>600</calories> </food> <food> <name>ပိုင်းသီးသီး နှင့် ဆီ</name> <price>$6.95</price> <description>နှစ်လုံး သုံးတွေ့ သို့မဟုတ် ဘင်ဆင်သီးပဲ သို့မဟုတ် ကျွန်ုပ်တို့၏ အများဆုံး အကျွေးချွေးသော ဟားဘရပ်</description> <calories>950</calories> </food> </breakfast_menu>
ဘတ္ထားတွင် ပြင်ဆင်ခင့် အိမ်အောင်း XML ကို XSLT ဖြင့် HTML အသုံးပြုပါ:
XSLT ပုံစံအစားအချက်
<?xml version="1.0" encoding="UTF-8"?> <html xsl:version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <body style="font-family:Arial;font-size:12pt;background-color:#EEEEEE"> <xsl:for-each select="breakfast_menu/food"> <div style="background-color:teal;color:white;padding:4px"> <span style="font-weight:bold"><xsl:value-of select="name"/> - </span> <xsl:value-of select="price"/> </div> <div style="margin-left:20px;margin-bottom:1em;font-size:10pt"> <p> <xsl:value-of select="description"/> <span style="font-style:italic">(တစ်လုံးတာသို့ အကြေးအား 950 ကီလိုဂျီ)</span> </p> </div> </xsl:for-each> </body> </html>
XSLT ပညာရှင်
အခြား XSLT အကြောင်းကျသတ် ကို သင့်မယူ မည့်နည်းဖြင့် ကျွန်ုပ် အခြေခံ ဝင်ပန်း XSLT ပညာရှင်。
- အရေးပါသော XML XPath
- နောက်ပိုင်း XML XQuery