tailieunhanh - Essential xml Quick Reference PHẦN 5

Ví dụ này minh họa làm thế nào để sử dụng một biến để trả về một giá trị từ một mẫu. Chú ý rằng lệnh gọi-mẫu được chứa trong một yếu tố biến. Bởi vì điều này, bất cứ điều gì là đầu ra trong bản mẫu thêm được thêm vào đoạn cây kết quả cho biến tổng hợp. | 146 Essential XML Quick Reference employee fullname xsl value-of select fullname fullname title xsl value-of select aaron title title employee xsl template This example stores the results of several expressions in variables for later use. Returning values from templates xsl template name add xsl param name x xsl param name y xsl value-of select x y xsl template xsl template match xsl variable name sum xsl call-template name add xsl with-param name x select 30 xsl with-param name y select 70 xsl call-template xsl variable sum xsl value-of select sum sum xsl template This example illustrates how to use a variable to return a value from a template. Notice that the call-template instruction is contained within a variable element. Because of this anything that is output within the add template is added to the result tree fragment for the sum variable. Using variables with recursive templates xsl template name totalSalaries xsl param name empList xsl choose XSL Transformations 147 xsl when test empList xsl variable name first select empList 1 xsl variable name total xsl call-template name totalSalaries xsl with-param name empList select empList postion 1 xsl call-template xsl variable xsl value-of select first salary total xsl when xsl otherwise 0 xsl otherwise xsl choose xsl template xsl template match xsl variable name salaries xsl call-template name totalSalaries xsl with-param name empList select emp xsl call-template xsl variable Total Salaries xsl value-of select salaries xsl template This example illustrates how to call a template recursively to total a list of employee salaries. XSLT when xsl when test boolean-expression -- Content template -- xsl when Description Defines a conditional template that is used within the choose element. See choose for more details and an example. 148 Essential XML Quick Reference Attribute Name Default Description test required Specifies an XPath expression that is evaluated as a boolean. with-param xsl with-param

TỪ KHÓA LIÊN QUAN
TÀI LIỆU MỚI ĐĂNG
170    252    4    29-03-2024
31    225    0    29-03-2024
8    163    0    29-03-2024
10    148    0    29-03-2024
24    127    0    29-03-2024
41    108    0    29-03-2024
crossorigin="anonymous">
Đã 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.