#Based on Andy Turk's RTF FAQ (18 June 2000). Interesting because of the fact that his RTF consists of a grove of attributes. Note that his xsl:value-ofs had to be changed to xsl:copy-ofs from Ft.Xml.Xslt import XsltException, Error from Xml.Xslt import test_harness #This one should bomb: implicit conversion from RTF to node-set sheet_1 = """ """ #Do it the right way sheet_2 = """ """ #Do it by using the node-set extension sheet_3 = """ """ xml_source=""" """ expected_2 = """ """ # RTFs cannot contain attribute/namespace nodes as # immediate children expected_3 = """ """ def Test(tester): source = test_harness.FileInfo(string=xml_source) sheet = test_harness.FileInfo(string=sheet_1) test_harness.XsltTest(tester, source, [sheet], "", exceptionCode=Error.INVALID_FOREACH_SELECT, title='Invalid use of RTF') source = test_harness.FileInfo(string=xml_source) sheet = test_harness.FileInfo(string=sheet_2) test_harness.XsltTest(tester, source, [sheet], expected_2, title="RTF as variable") source = test_harness.FileInfo(string=xml_source) sheet = test_harness.FileInfo(string=sheet_3) test_harness.XsltTest(tester, source, [sheet], expected_3, title="Conversion with exsl:node-set") return