# Result tree fragments should have a root node. If you apply-templates to # a fragment that has been converted to a node-set, the first template to # fire should match the root node of the converted fragment. If there is # no template matching this node, the built-in template, containing just # xsl:apply-templates, will match. Parameters will not be passed from here. # # sheet_1 explicitly matches the root node of the fragment and mimics the # behavior of the built-in template, but provides some extra output to # indicate that it ran. # # sheet_2 lets the built-in template fire for the root node. # # In either case, the template that matches the children of the fragment's # root node should not receive the parameter that was passed in the initial # apply-templates. # from Xml.Xslt import test_harness sheet_1 = """\ Processing the root node of the fragment. Processing the 'myElement' node of the fragment. This element has ancestor(s). """ expected_1 = """\ Processing the root node of the fragment. hello world Processing the 'myElement' node of the fragment. This element has 1 ancestor(s). """ sheet_2 = """\ Processing the 'myElement' node of the fragment. """ expected_2 = """\ Processing the 'myElement' node of the fragment. """ def Test(tester): source = test_harness.FileInfo(string=sheet_1) sheet = test_harness.FileInfo(string=sheet_1) test_harness.XsltTest(tester, source, [sheet], expected_1, title='Case 1') source = test_harness.FileInfo(string=sheet_2) sheet = test_harness.FileInfo(string=sheet_2) test_harness.XsltTest(tester, source, [sheet], expected_2, title='Case 2') return