Learning XML phần 8

Cách dễ nhất để đại diện cho cấu trúc của một cây con bằng cách chỉ đơn giản là viết ra các cây con như nó sẽ xuất hiện. Mô hình này theo nghĩa đen được gọi là một bản mẫu, vì vậy chúng ta gọi là quy tắc trong một quy tắc mẫu chuyển đổi. Dưới đây là một ví dụ về một quy tắc mẫu: | Learning XML Putting it all together in one stylesheet we get the listing in Example . Example Checkbook Transformation Stylesheet xml version -- A simple transformation stylesheet to get information out of a cheCkbook. -- xsl stylesheet xmlns xsl http 1999 XSL Transform version xsl template match checkbook html head body h3 xsl text Income from xsl text xsl value-of select child 1 date xsl text until xsl text xsl value-of select child last date xsl text xsl text h3 xsl apply-templates select deposit h3 xsl text Expenditures from xsl text xsl value-of select child 1 date xsl text until xsl text xsl value-of select child last date xsl text ranked from highest to lowest xsl text h3 xsl apply-templates select payment xsl sort data-type number order descending select amount xsl apply-templates h3 Balance h3 p xsl text Your balance as of xsl text xsl value-of select child last date xsl text is xsl text tt b xsl choose xsl when test sum payment amount sum deposit amount font color red xsl text xsl text xsl value-of select sum deposit amount - sum payment amount font xsl when xsl otherwise font color blue xsl text xsl text xsl value-of select sum deposit amount - sum payment amount font xsl otherwise xsl choose b tt p xsl if test sum payment amount sum deposit amount p font color red xsl text DANGER Deposit money quick xsl text font p xsl if body html xsl template xsl template match payment @type atm p xsl value-of select position xsl text . On xsl text xsl value-of select date xsl text you withdrew xsl text tt b xsl text xsl text xsl value-of select amount b tt xsl text from an ATM for xsl text xsl value-of select description xsl text . xsl text p xsl template page 187 Learning XML xsl template match payment p xsl value-of select position xsl text . On xsl text xsl value-of select date xsl text you paid xsl text tt b xsl text xsl text xsl value-of select amount b tt xsl text to xsl text i xsl value-of select payee i xsl text for xsl text xsl .

Không thể tạo bản xem trước, hãy bấm tải xuống
TỪ KHÓA LIÊN QUAN
TÀI LIỆU MỚI ĐĂNG
Đã phát hiện trình chặn quảng cáo AdBlock
Trang web này phụ thuộc vào doanh thu từ số lần hiển thị quảng cáo để tồn tại. Vui lòng tắt trình chặn quảng cáo của bạn hoặc tạm dừng tính năng chặn quảng cáo cho trang web này.