Here is a snippet of my code. The input is now supposed to include 2 optional fields. So I thought to create 4 if statements, as the URL has to be different if the fields exist or not. The choose/when works, and the first IF statement works. But the last 3 if one or both of the fields are not in the input, blows up. The URL variable(DVURL) does not get populated at all. I'm sure this is easy answer...i hope.
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:func="http://exslt.org/functions" xmlns:date="http://exslt.org/dates-and-times" xmlns:string="http://symphony-cms.com/functions" xmlns:dpfunc="http://www.datapower.com/extensions/functions">
<xsl:output method="xml"/>
<xsl:template match="/">
<xsl:variable name="datavalueagg" select="test1"/>
<xsl:variable name="valueagg" select="test2"/>
<xsl:variable name="variable1" select="Y"/>
<xsl:choose>
<xsl:when test="($variable1 = 'Y' or $variable1 = 'N')">
<xsl:if test="(($datavalueagg != '') and ($valueagg != ''))">
<xsl:variable name="DVURL" select="concat('http://server.com/$valueagg/$datavalueagg')"/>
</xsl:if>
<xsl:if test="(($datavalueagg != '') and ($valueagg = ''))">
<xsl:variable name="DVURL" select="concat('http://server.com/$datavalueagg')"/>
</xsl:if>
<xsl:if test="$datavalueagg = '' and $valueagg != ''">
<xsl:variable name="DVURL" select="concat('http://server.com/$valueagg')"/>
</xsl:if>
<xsl:if test="$datavalueagg = '' and $valueagg = ''">
<xsl:variable name="DVURL" select="concat('http://server.com/none')"/>
</xsl:if>
</xsl:when>
<xsl:otherwise>
<xsl:variable name="DVURL" select="concat('http://server.com/all')"/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
</xsl:stylesheet>