【发布时间】:2013-01-30 00:25:37
【问题描述】:
作为我previous question 的后续行动,我正在尝试真正简化从在 Word 2010 中创建的.docx 文件中提取的几个xml 模板,并在 OpenTBS 中用作子模板,以加快我的文档创建速度。子模板包含一个 mc:AlternateContent 块,这是我在主模板中使用的全部内容,如下所示:
[LineItem.template;block=w:r;file='templates/[val].xml';getpart=(mc:AlternateContent)]
我注意到多个 (20) 个大 (>100KB) 子模板会严重影响 OpenTBS 的速度,因此我想删除我不使用的代码(在 mc:AlternateContent 之外)。我已经计划通过 TBS 对我的模板进行其他处理并缓存简化版本,所以如果我可以使用 OpenTBS 的 getpart 功能同时从更大的模板中提取这些数据,那就太好了。这可能吗?
例如,为了能够将此(伪)代码放入我的处理中:
foreach($templates as $template){ //loop through xml templates
$TBS->LoadTemplate($template);
$simpleTemplate = $template->getpart('mc:AlternateContent');
/*
/ simpleTemplate now holds all the xml inside the mc:AlternateContent tags
/ (everything that would have been included in my template had I used attribute
/ getpart=(mc:AlternateContent) in my file inclusion)
*/
$simpleTemplate->save('simple/'.$template);
}
附注我应该在the TBS forum 上问这个吗?
【问题讨论】:
-
"同时从更大的模板中提取这些数据" => 你是什么意思?你能给出更精确的吗? “P.S.我应该在TBS论坛上问这个吗?” => 如你所愿,两者都可以。
-
对不起,我没有说清楚,我添加了一些伪代码,希望能解释得更好。
标签: opentbs tinybutstrong