如果Address元素的type屬性=「Standard With Attention」,我不想顯示AddressLine1。相反,我只想顯示AddressLine2,AddressLine3和AddressLine4。 我的輸出如果元素屬性有注意,我想省略addressLine1
經辦人:邁克爾,134 w ^百老匯ST NW,APT 3B,華盛頓特區,12345
預期輸出: 134W¯¯百老匯ST NW,APT 3B,華盛頓特區12345
我的XML
<ProtectedAddresses>
<Address InternalAddressID="1618613567" Type="Standard With Attention">
<AddressLine1>Attn: Michael</AddressLine1>
<AddressLine2>134 W Broadway ST NW</AddressLine2>
<AddressLine3>APT 3B</AddressLine3>
<AddressLine4>Washington, DC, 12345</AddressLine4>
<Attention>James</Attention>
</Address>
</ProtectedAddresses>
XSLT
<xsl:for-each select="Addresses/Address">
<xsl:for-each select="ancestor::ProtectionOrder/ProtectionOrderParties/ProtectionOrderParty/DCProtectionOrderPartyAdditional/ProtectedAddresses/Address[@InternalAddressID=current()/@InternalAddressID]">
<xsl:for-each select="AddressLine1 | AddressLine2 | AddressLine3 | AddressLine4">
<xsl:value-of select="."/>
<xsl:if test="position()!=last()">, </xsl:if>
</xsl:for-each>
<xsl:text>; </xsl:text>
</xsl:for-each>
</xsl:for-each>
令人敬畏的把條件放在AddressLine1上工作 – Angela 2015-03-02 19:21:36