Hi I'm new to XSL and am trying to transform so that if both Company and Person details are provided, only the Company details are transformed, also if the Company Name is NULL or of Zero length, only the Person details are transformed:
I'm trying to use the code segment below, but I just can't seem to get it to work.
Could someone please assist me.
Thanks In Advance
John
I'm trying to use the code segment below, but I just can't seem to get it to work.
Could someone please assist me.
Thanks In Advance
John
Code:
<ClientName>
<StructuredName>
<xsl:if test="'./CompanyName'!=''">
<xsl:apply-templates select="xx:CompanyName"/>
</xsl:if>
<xsl:if test="'./CompanyName'=''">
<xsl:apply-templates select="xx:Title"/>
<xsl:apply-templates select="xx:FirstName"/>
<xsl:apply-templates select="xx:MiddleName"/>
<xsl:apply-templates select="xx:LastName"/>
</xsl:if>
</StructuredName>
</ClientName>
<xsl:template match="xx:CompanyName">
<StructuredCompanyName>
<xsl:value-of select ="."/>
</StructuredCompanyName>
</xsl:template>
<xsl:template match="xx:Title">
<StructuredNameTitle>
<xsl:value-of select ="."/>
</StructuredNameTitle>
</xsl:template>
<xsl:template match="xx:FirstName">
<StructuredFirstName>
<xsl:value-of select ="."/>
</StructuredFirstName>
</xsl:template>
<xsl:template match="xx:MiddleName">
<StructuredMiddleName>
<xsl:value-of select ="."/>
</StructuredMiddleName>
</xsl:template>
<xsl:template match="xx:LastName">
<StructuredLastName>
<xsl:value-of select ="."/>
</StructuredLastName>
</xsl:template>
Comment