Sunday, February 6, 2011

Simple Xml with StyleSheet

Simple XML with stylesheet

Both in same folder or change href

Order.xml
<?xml version="1.0"encoding="ISO-8859-1"?>
<?xml-stylesheettype="text/css" href="order.css"?>
<Order>
  <Customerid="c32">Chez Fred</Customer>
  <Product>
    <Name>BirdsongClock</Name>
    <SKU>244</SKU>
   <Quantity>12</Quantity>
    <Pricecurrency="USD">21.95</Price >
  </Product>
  <ShipTo>
    <Street>135 AirlineHighway</Street >
   <City>Narragansett</City> <State>RI</State><Zip>02882</Zip>
  </ShipTo>
  <Subtotalcurrency='USD'>263.40</Subtotal>
  <Tax rate="7.0"
       currency='USD'>18.44</Tax>
  <Shipping method="USPS" currency='USD'>8.95</Shipping>
  <Total currency='USD'>290.79</Total>
</Order>
Order.css
Order {font-family: serif;font-size: 16pt;
       display: block; line-height:20pt;
       margin-left: 0.25in
      }
ShipTo {margin-left: 0.5in; display:block }
ShipTo:before {content: "Shipto:"; margin-left: -0.25in }
Product {font-size: 12pt; display:block }
Customer {font-weight: bold;display: block }
GiftMessage {font-family:ZapfChancery, script}
Street, Subtotal, Tax, Shipping,Total {display: block}
Quantity:before {content:"Quantity: "}
SKU {display: none}
Subtotal:before {content:"Subtotal: $"}
Price:before {content: "UnitPrice: $"}
Tax:before {content: "Tax:$"}
Shipping:before {content:"Shipping: $"}
Total:before {content: "Total:$"}

No comments:

Post a Comment