JET 与 DPTK 中的等价标记

可以使用本主题中的映射表来了解 JET 与设计模式工具箱(DPTK)标记之间的差别。
此映射表对等价的 JET 标记与 DPTK 标记进行比较。注释列摘录了迁移时存在的任何特殊问题。
DPTK 标记 JET 标记 注释
applyPattern c:invokeTransform  
attr c:get
attr 标记的格式属性不受 c:get 标记支持。JET 提供的大量 XPath 函数可以与它起到等效作用。以下 DPTK 标记等价于 JET 标记:
  • DPTK 标记 - <attr node="child" name="name" format="U"/>
  • JET 标记 - <c:get select="upper-case($child/@name)"/>
case c:when 请参阅有关 select 的注意事项。
cond c:if XPath 函数基数解释了 cond 标记的 card 属性值。
  • DPTK - <cond node="parent/children" card="m"> ....</cond>
  • JET - <c:if test="cardinality($parent/children,'m')"> ....</c:if>
content c:get 以下标记等价:
  • DPTK - <content node="parent"/>
  • JET - <c:get select="$parent"/>
请参阅 attr,以获取有关转换 DPTK 格式属性的详细信息。
copyResource ws:copyFile 请参阅有关 select 的注意事项。
exists c:if 请使用 <c:if test=" ... "> ... </c:if>
下表提供了常用 <exists> 格式的等价标记:
<exists node="mother/children"> <c:if test="$mother/children">
<exists node="mother/children gender='F'"> <c:if test="$mother/children[@gender = 'F']">
<exists node="child gender='F'"> <c:if test="$child/@gender = 'F'">
<exists node="person" name="partner"> <c:if test="$person/@partner">
extend c:load  
formatNow f:formatNow  
genParm 无直接等价标记 传递至 JET 变换的参数被作为 XPath 变量。
include c:include  
inlineExtend c:loadContent  
initialCode c:initialCode  
iterate c:iterate  
marker c:marker  
milliseconds f:milliseconds  
newFolder ws:folder  
newNode c:addElement  
newProject ws:project  
newText c:addTextElement  
nexists c:if 请使用 <c:if test="not( ... )"> ...</c:if>。请参阅 exists 标记,以获取更多示例。
nodeAttributes 无直接等价标记 以下 c:iterate 语句迭代元素的所有属性:
<c:iterate select="$element/@*" var="attr">
	<c:get select="name($attr)"/> = <c:get select="string($attr)"/>
</c:iterate>
overrides c:override 虽然提供了以上标记,但还是建议用户使用 plugin.xml 中 transform 元素的 overrides 属性。
prune c:removeElement  
rebuildWorkspace ws:rebuildWorkspace 虽然提供了此标记,但是 JET 变换通常并不需要该标记。
removeAttr 无直接等价标记  
replaceStrings c:replaceStrings  
roundtrip c:userRegion  
select c:choose JET 提供了两种格式的 <c:choose> 标记。
  • 一种类似于 DPTK <select> 标记:
    <c:choose select="$element/@kind">
        <c:when test="'FIELD'">
    	    ...
        <c:when>
        <c:when test="'LIST'">
    	    ...
        <c:when>
        ...
    </c:choose>
  • JET 还具有一个 if/elseif/else 变体,其中省略了 c:choose 的“select”属性:
    <c:choose>
        <c:when test="$element/@kind = 'FIELD'">
            ...
        </c:when>
        <c:when test="$element/@kind = 'LIST'">
            ...
        </c:when>
        <c:otherwise>
            ...
        </c:otherwise>
    </c:choose>
setAttr c:set  
statusMessage c:log  
start ws:file 或 java:class 必要时,DPTK 以静默方式将 Java™ 源文件夹添加至“resource”路径的开头。而 JET ws:file 标记则不会将 Java 源文件夹添加至“resource”路径的开头 。JET java:class 标记是 Java 标记,具有“srcFolder”属性。
stringTokens c:stringTokens  
substring 无直接等价标记 请使用 XPath 函数 substring
sum 无直接等价标记 请使用下列等价标记:
<sum name="xx" initialize="1"/> <c:setVariable var="xx" select="1"/>
<sum name="xx"/> <c:get select="$xx"/>
<sum name="xx" increment="2"/> <c:setVariable var="xx" select="$xx + 2"/>
targetProject 无直接等价标记 XPath 变量 $org.eclipse.jet.resource.project.name 涉及包含输入资源的项目。<ws:...> 标记全部接受路径中的显式项目引用。
templateComment <%-- ... --%>  
unique f:unique  
userNode c:setVariable  
workingSet 不受支持 JET 没有标记用于创建 Eclipse 工作集。
zilch 不受支持 用作转义机制或有时作为注释。请使用 @taglib 伪指令来切换标记名称空间或使用 <%-- ... --%> 来创建注释。
相关概念
DPTK 与 JET 差别
相关任务
将 DPTK 兼容性安装在 Rational 建模产品中
迁移到 JET 项目格式
将 DPTK 标记迁移到 JET 标记
运行 JET 变换
导出可部署 JET 变换
使用可部署 JET 变换插件

反馈