Đang chuẩn bị liên kết để tải về tài liệu:
xslt cookbook phần 5

Không đóng trình duyệt đến khi xuất hiện nút TẢI XUỐNG

Những bộ phải được bình đẳng khi các bản sao được bỏ qua. Bạn cũng phải làm nhiều hơn so với loại bỏ phần tử đầu tiên trên bước đệ quy, bạn nên loại bỏ tất cả các phần tử có giá trị như các yếu tố đầu tiên, cũng giống như bạn làm cho các thiết lập thứ hai. | xsl call-template name vset equal-text-values xsl with-param name nodes1 select nodes1 not . nodes1 1 xsl with-param name nodes2 select nodes2 not . nodes1 1 xsl call-template xsl when xsl otherwise xsl choose xsl template Notice that we have commented out the test for unequal sizes because that test is not valid in the presence of duplicates. For example one set might have three occurrences of an element with string value foo while the other has a single element foo. These sets should be equal when duplicates are ignored. You also must do more than remove just the first element on the recursive step you should remove all elements with the same value as the first element just as you do for the second set. This will ensure that duplicates are fully accounted for on each recursive pass. These changes make all equality tests based on text value come out correct but at the cost of doing additional work on sets that are obviously unequal. These equality tests are not as general as the value-set operations produced in Recipe 7.2 because they presume that the only notion of equality you care about is text-value equality. You can generalize them by reusing the same technique you used for testing membership based on a test of element equality that can be overridden by an importing stylesheet xsl template name vset equal xsl param name nodes1 select . xsl param name nodes2 select . xsl if test count nodes1 count nodes2 xsl call-template name vset equal-impl xsl with-param name nodes1 select nodes1 xsl with-param name nodes2 select nodes2 xsl call-template xsl if xsl template -- Once we know the sets have the same number of elements -- -- we only need to test that every member of the first set is -- -- a member of the second -- xsl template name vset equal- impl xsl param name nodes1 select . xsl param name nodes2 select . xsl choose xsl when test not nodes1 xsl value-of select true xsl when xsl otherwise xsl variable name test xsl apply-templates select nodes2 mode vset .

Đã 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.