Jump to content
Sign in to follow this  

How do I add the word/boolean false to a empty string?

Recommended Posts

I would like to display the word false instead of an empty string "" for the

<ext:AddressReference ext:currentIndicator="">

How do I do this?


My output which is wrong

<ext:AddressReference ext:currentIndicator="true">    <nc:LocationReference s:ref="INT10566286"/></ext:AddressReference><ext:AddressReference ext:currentIndicator="">    <nc:LocationReference s:ref="INT4279606"/></ext:AddressReference>

Desired output adds the word false to the empty string

<ext:AddressReference ext:currentIndicator="true">    <nc:LocationReference s:ref="INT10566286"/></ext:AddressReference><ext:AddressReference ext:currentIndicator="false">    <nc:LocationReference s:ref="INT4279606"/></ext:AddressReference>

My xml code

<Address PartyCorrespondence="true" PartyCurrent="true" ID="10566286" Type="Standard">    <AddressLine2>772 Minnesota AVE</AddressLine2>    <AddressLine4>Big Lake, MN, 55309</AddressLine4>    <Street>Minnesota</Street>    <City>Big Lake</City>    <State>MN</State>    <Zip>55309</Zip></Address><Address ID="4279606" Type="Non Standard">    <AddressLine1>8435 OAK LANE</AddressLine1>    <AddressLine4>BECKER, MN, 55308</AddressLine4>    <City>BECKER</City>    <State>MN</State>    <Zip>55308</Zip></Address>

My xslt code

<xsl:for-each select="Address">    <ext:AddressReference>        <xsl:attribute name="ext:currentIndicator"><xsl:value-of select="@PartyCurrent"/></xsl:attribute>   <nc:LocationReference>       <xsl:attribute name="s:ref"><xsl:text>INT</xsl:text><xsl:value-of select="@ID"/></xsl:attribute>   </nc:LocationReference>    </ext:AddressReference></xsl:for-each>

Share this post

Link to post
Share on other sites

Use an <xsl:choose>. If @PartyCurrent is "true" then show "true", otherwise show "false".

<xsl:attribute name="ext:currentIndicator">    <xsl:choose>        <xsl:when test="@PartyCurrent = 'true'">true</xsl:when>        <xsl:otherwise>false</xsl:otherwise>    </xsl:choose></xsl:attribute>
  • Like 1

Share this post

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

  • Create New...