I want to omit addressLine1 if Address element attribute has
Posted: Mon Mar 02, 2015 9:28 pm
If the type attribute of the Address element = “Standard With Attention” I do not want to display AddressLine1. Instead I want to only display AddressLine2, AddressLine3 and AddressLine4.
My output:
Attn: Michael, 134 W Broadway ST NW, APT 3B, Washington, DC, 12345
Expected output:
134 W Broadway ST NW, APT 3B, Washington, DC, 12345
xml code
xslt code
My output:
Attn: Michael, 134 W Broadway ST NW, APT 3B, Washington, DC, 12345
Expected output:
134 W Broadway ST NW, APT 3B, Washington, DC, 12345
xml code
Code: Select all
<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>
Code: Select all
<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>