"""
Behavior of node copy to result tree
"""
from Xml.Xslt import test_harness
SOURCE_1="""
Code Generation in Action
JackHerrington
Manning
PHP Hacks
JackHerrington
O'Reilly
Podcasting Hacks
JackHerrington
O'Reilly
"""
SHEET_1 = """
var g_books = [
];
, {
id: ,
name: '',
first: '',
last: '',
publisher: ''
}
"""
SHEET_2 = """
var g_books = [
];
, {
id: ,
name: '',
first: '',
last: '',
publisher: ''
}
"""
EXPECTED_1 = "\nvar g_books = [\n\n , {\nid: 1,\nname: 'Code Generation in Action',\nfirst: 'Jack',\nlast: 'Herrington',\npublisher: 'Manning'\n}\n \n , {\nid: 2,\nname: 'PHP Hacks',\nfirst: 'Jack',\nlast: 'Herrington',\npublisher: 'O\\'Reilly'\n}\n \n , {\nid: 3,\nname: 'Podcasting Hacks',\nfirst: 'Jack',\nlast: 'Herrington',\npublisher: 'O\\'Reilly'\n}\n \n\n];\n "
def Test(tester):
source = test_harness.FileInfo(string=SOURCE_1)
sheet = test_harness.FileInfo(string=SHEET_1)
test_harness.XsltTest(tester, source, [sheet], EXPECTED_1,
title="EXSLT str:replace within func:function")
source = test_harness.FileInfo(string=SOURCE_1)
sheet = test_harness.FileInfo(string=SHEET_2)
test_harness.XsltTest(tester, source, [sheet], EXPECTED_1,
title="EXSLT regex:replace within func:function")
return