這裏是(相關部分)我的XML模板文件(以下稱爲'TEMPLATE.XML'):XSLT - 如何測試條件下的外部XML文檔中表示
<Template>
<ObjTmplId>74</ObjTmplId>
<AttTmplId>312</AttTmplId>
<Condition>Test=52</Condition>
</Template>
<Template>
<ObjTmplId>58</ObjTmplId>
<AttTmplId>100</AttTmplId>
<Condition>TestTwo=21 or TestTwo=26</Condition>
</Template>
<Template>
<ObjTmplId>8</ObjTmplId>
<AttTmplId>10</AttTmplId>
<Condition>TestThree!=1 or TestThree!=6</Condition>
</Template>
,這裏是我的XML輸入:
<p:objectAttributes>
<p:attribute name="Test">10</p:attribute>
<p:attribute name="TestTwo">0</p:attribute>
<p:attribute name="TestThree">27</p:attribute>
</p:objectAttributes>
我現在的XSLT是這樣的:
<xsl:when test="document('template.xml')
/template/object/attribute/@name">
<xsl:for-each select="document('template.xml')/condition">
<xsl:element name="output:{@name}">
<xsl:value-of select="text()" />
</xsl:element>
</xsl:for-each>
</xsl:when>
如何使用XML轉換輸入文檔的模板小號以上是基於'template.xml'中相關模板中的<Condition>
元素表示的條件嗎?
這是沒有足夠的信息,你是「無法」。將您的XSLT代碼添加到問題中,我們很樂意指出您錯誤的位置。 – 2014-08-27 14:59:44
我已經添加了xml輸入文件 – user3983344 2014-08-27 15:19:30
XML文檔是_already_那裏。現在您添加了第二個,而不是顯示XSLT代碼。您展示的第一個示例是_not_ XSLT代碼,它是另一種形式的XML。 – 2014-08-27 15:23:43