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