我正在尝试用uml生成html文档,所有这些都很好。我的问题是,我谨随函附上以下所有报告:
<html>
<body>
//report
</body>
</html>我该怎么做?
这是我的acceleo报告模板,随函附上:
[comment encoding = UTF-8 /]
[module useCase('http://www.eclipse.org/uml2/3.0.0/UML')]
[template public generateUseCase(uc : UseCase)]
[comment @main/]
[file (('useCases.html'), true)]
<h1>UseCase: [uc.name/]</h1>
[if (uc.ownedBehavior->notEmpty())]
<h5>Part of Activity: [uc.ownedBehavior.name/]</h5>
[/if]
<h3>Extension Points:</h3>
[if (uc.extensionPoint->isEmpty())]
<p>No Extension Points</p>
[/if]
<ul>
[for (e : ExtensionPoint | uc.extensionPoint)]
<li>[e.name/]</li>
[/for]
</ul>
[/file]
[/template]发布于 2013-11-22 07:49:22
斯特凡诺
总是有可能(也是明智的)细分你的模板。在这里,您可以使用一个循环,而不是为遇到的每一个新UseCase在文件中追加:
[template public generate(p : Package)]
[comment @main/]
[file (('useCases.html'), false)]
<html>
<body>
[for (uc : UseCase | p.eAllContents(UseCase))]
[generateUseCase(uc)/]
[/for]
</body>
</html>
[/file]
[/template]
[template public generateUseCase(uc : UseCase)]
<h1>UseCase: [uc.name/]</h1>
[if (uc.ownedBehavior->notEmpty())]
<h5>Part of Activity: [uc.ownedBehavior.name/]</h5>
[/if]
<h3>Extension Points:</h3>
[if (uc.extensionPoint->isEmpty())]
<p>No Extension Points</p>
[/if]
<ul>
[for (e : ExtensionPoint | uc.extensionPoint)]
<li>[e.name/]</li>
[/for]
</ul>
[/template]请注意,像我在这里所做的那样,使用"eAllContents“是远远不够有效的,您可能希望手动导航到用例列表。
https://stackoverflow.com/questions/20120838
复制相似问题