变量未赋值

时间:2014-03-16 20:33:48

标签: xml xslt xslt-2.0

现在我正在尝试将模板保存到变量DatumMoves。在调试器中运行时,它会跳过DatumMoves的变量,但在没有分配给变量时执行正常。

                <xsl:variable name="SlaveMoves">
                <xsl:call-template name="ReadFiles">
                    <xsl:with-param name="FileType" select="'Slave'"/>
                    <xsl:with-param name="Activities" select='$slavefile/OLPData/Resource/ActivityList/Activity'/>
                    <xsl:with-param name="GH_IML_EE" select="$GH_IML_EE"/>
                </xsl:call-template>
            </xsl:variable>
            <!--LOOP THROUGH THE OPERATIONS AND DO A RECURSIVE CALL TO COMBINE ROBOTS-->
            <xsl:for-each select="$MasterMoves/Operation">
                <xsl:copy><xsl:copy-of select="@*"/>
                    <!--<Relocation>
                        <xsl:variable name="relocation" select="$DatumFile/CellProgram/WorkSequence/Operation/Block[@Type = 'WORK' and not(RobotPoint[@Process='NOP'])]"/>
                        <xsl:for-each select="$relocation/RobotPoint">
                            <xsl:copy>
                                <xsl:element name="Target">
                                    <xsl:copy-of select="@RobotIndex"/>
                                    <xsl:copy-of select="Data/@Location"/>
                                </xsl:element>
                            </xsl:copy>
                        </xsl:for-each>
                    </Relocation>-->
                    <xsl:variable name="DatumMoves">
                        <xsl:call-template name="process-next">
                            <xsl:with-param name="mastermoves" select='Move' tunnel='yes'/>
                            <xsl:with-param name="slavemoves" select='$SlaveMoves/Operation[@Name=current()/@Name]/Move' tunnel='yes'/>
                        </xsl:call-template>
                    </xsl:variable>
                    <Options RobotIndex="1"><xsl:copy-of select="Options/@*"/></Options>
                    <Options RobotIndex="2"><xsl:copy-of select="$SlaveMoves/Operation[@Name=current()/@Name]/Options/@*"/></Options>
                    <xsl:call-template name="process-next">
                        <xsl:with-param name="mastermoves" select='Move' tunnel='yes'/>
                        <xsl:with-param name="slavemoves" select='$SlaveMoves/Operation[@Name=current()/@Name]/Move' tunnel='yes'/>
                    </xsl:call-template>
                </xsl:copy>

1 个答案:

答案 0 :(得分:2)

确保在某处使用变量值,否则XSLT处理器可以完全不计算其值。