0
我遇到了嵌套循环的问题。当我尝试将其选回时,该变量超出范围。我明白为什么(我认为),但我不知道我的选择是要解决它。Xsl嵌套循环
<xsl:for-each select="/objects/InstalledSQLServices">
<xsl:variable name="InstalledService" select="./Property[@Name ='Name']"></xsl:variable>
<tr>
<td align="left">
<xsl:value-of select="./Property[@Name ='DisplayName']"/>
</td>
<td align="left">
<xsl:value-of select="./Property[@Name ='Status']"/>
</td>
<xsl:for-each select="/objects/SqlVersion">
<xsl:variable name="SqlInstance" select="concat('MSSQL$',./Property[@Name ='Instance'])"></xsl:variable>
<xsl:variable name="SqlDescription">
<xsl:choose>
<xsl:when test="$InstalledService=$SqlInstance">
<xsl:value-of select="concat(./Property[@Name ='Version'],' ', ./Property[@Name ='Edition'])"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="None"/>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
</xsl:for-each>
<td align="left" style="color: rgb(255,0,0); font-weight: bold">
<xsl:copy-of select="$SqlDescription"/>
</td>
</tr>
</xsl:for-each>
我想抓住从XML文档中的不同节点的值,如果没有当前节点的匹配。因此,如果/ objects/InstalledSQLServices/Name =/objects/SqlVersion/Instance,使用来自/ objects/SqlVersion/Instance(版本,版本等)的属性填充一个列。 – sqlpadawan
回答我自己的问题,这只是一个问题获取循环更正 – sqlpadawan
@sqlpadawan要么关闭它,要么发布答案并接受它,以便其他人可以从中受益:) – FailedDev