Friday, 16 November 2012

BizTalk Custom XSLT if/when

BizTalk Custom XSLT, working with “if..else” and  “when…otherwise”
When….Otherwise example:
<xsl:choose>
                    <xsl:when test="Number1">
                      <ns1:Object>
                        <ns1:Value>
                          <xsl:value-of select="Number1/text()" />
                        </ns1:Value>
                      </ns1:Object>
                    </xsl:when>
                    <xsl:when test="Number2">
                      <ns1:Object>
                        <ns1:Value>
                          <xsl:value-of select="Number2/text()" />
                        </ns1:Value>
                      </ns1:Object>
                    </xsl:when>
                    <xsl:otherwise>
                      <ns1:Object>
                        <ns1:Value>
                          <xsl:value-of select="Number3/text()" />
                        </ns1:Value>
                      </ns1:Object>
                    </xsl:otherwise>
                </xsl:choose>

If….Else example:
                <xsl:if test="Number">
                <ns1:Object>
                   <ns1:Value>
                    <xsl:value-of select="Number/text()" />
                   </ns1:Value>
                </ns1:Object>
      </xsl:if>
      <xsl:if test="Number1">
                <ns1:Object>
                   <ns1:Value>
                    <xsl:value-of select="Number1/text()" />
                   </ns1:Value>
                </ns1:Object>
      </xsl:if>

No comments:

Post a Comment