选择选项不工作
问题描述:
我的构建脚本创建构建选择选项不工作
STP_13_00_00_00_RC01
STPMON_13_00_00_00_RC01
STPWEB_13_00_00_00_RC01
STPPRODUCTS_13_00_00_00_RC01
所以我想4个不同的名称时,脚本创建名称**STP_13_00_00_00_RC01**
构建它应该创建文件夹,然后tar文件复制该文件夹中和之后,它应该多一个文件夹,而如果构建名称以其他名称STPMON,STPWEB.STPPRODUCTS开头,那么它应该只是创建文件夹并复制该文件夹中的tar文件所以我使用了下面的condidtion.But对于所有的构建它去进入其他条件或者构建是用STP创建的
</xsl:element>
<xsl:element name="gzip">
<xsl:attribute name="destfile"
>${archive.base}/${gbl.dist.label}.tar.gz</xsl:attribute>
<xsl:attribute name="src"
>${archive.base}/${gbl.dist.label}.tar</xsl:attribute>
</xsl:element>
<xsl:choose>
<xsl:when test="contains(node,'STP')">
<xsl:element name="mkdir">
<xsl:attribute name="dir"
>/mnt/projects/autoblds_dev_build/blds_dev_stp2build/${gbl.dist.label}</xsl:attribute>
</xsl:element>
<xsl:element name="copy">
<xsl:attribute name="file">${archive.base}/${gbl.dist.label}.tar.gz</xsl:attribute>
<xsl:attribute name="todir"
>/mnt/projects/autoblds_dev_build/blds_dev_stp2build/${gbl.dist.label}/</xsl:attribute>
<xsl:attribute name="overwrite">no</xsl:attribute>
</xsl:element>
<xsl:element name="mkdir">
<xsl:attribute name="dir"
>/mnt/projects/autoblds_dev_build/blds_dev_stp2build/${soa.release.version}</xsl:attribute>
</xsl:element>
</xsl:when>
<xsl:otherwise>
<xsl:element name="mkdir">
<xsl:attribute name="dir"
>/mnt/projects/autoblds_dev_build/blds_dev_stp2build/${gbl.dist.label}_Test</xsl:attribute>
</xsl:element>
<xsl:element name="copy">
<xsl:attribute name="file"
>${archive.base}/${gbl.dist.label}.tar.gz</xsl:attribute>
<xsl:attribute name="todir"
>/mnt/projects/autoblds_dev_build/blds_dev_stp2build/${gbl.dist.label}_Test/</xsl:attribute>
<xsl:attribute name="overwrite">no</xsl:attribute>
</xsl:element>
</xsl:otherwise>
</xsl:choose>
在条件
contains(node,'STP')
这至少有一个问题,可能有两个3210
答
你的选择指令分支。
你的问题的说明说,你要表现得名为STP_13_00_00_00_RC01
构建的一种方式,并针对不同的名称开头STPMON
,STPWEB
,或STPPRODUCTS
的构建。但所有这些构建名称都包含字符串'STP',因此您的测试条件无法区分它们。换句话说,你的代码不会做你想做的事,因为你没有说出你的意思。
你说测试永远不会成功(样式表始终采用otherwise
分支)。这表明node
这个表达式并没有对你期望的字符串进行评估,也没有对可能被强制转换为你期望的字符串的文档节点进行评估。可能的原因包括:
- 您的XML没有名为
node
的元素。 - 您的XML有一个名为
node
的元素,但它不是引用您的代码的模板的上下文节点的子元素。 - 您的XML有一个名为
node
的元素,它是上下文节点的子元素,但其字符串值不是构建的名称。
这些都是可能的,但如果我不得不猜测,我猜这是第一个。