Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Conditional Options based on what is in field, else call template to return something else.

Status
Not open for further replies.

MKH2001

Technical User
Jan 7, 2003
90
0
0
GB
Hello,

Been a long time absent from any coding of any descript (do not know if that has been a good or bad thing =P I think probably bad).

Anyway I have a xsl that looks at just mapping a cost code, based on an unrelated area field.
However I only want to do this if the cost code in the original provision file is not one of two values:

IE Something like :

Code:
<!--Cost Code-->
<xsl:when test="../costCodeCode = '1000000.1'">799X.KN9003</xsl:when>
<xsl:when test="../costCodeCode = '1000000.2'">799X.KN9003</xsl:when>
<xsl:otherwise>
<xsl:call-template name="costCodeMap"
<xsl:with-param name="input" select="areaName"/>
</xsl:call-template>
</xsl:otherwise>
</choose>
<xsl:text>,</xsl:text>

<xsl:template name="costCodeMap">
<xsl:param name="input"></xsl:param>
<xsl:choose>
<xsl:when test - "$input = 'Blergh1'">799X.KN0001<xsl:when>
<xsl:when test - "$input = 'Blergh2'">799X.KN0002<xsl:when>
<xsl:when test - "$input = 'Blergh3'">799X.KN0003<xsl:when>
<xsl:when test - "$input = 'Blergh4'">799X.KN0004<xsl:when>
<xsl:when test - "$input = 'Blergh5'">799X.KN0005<xsl:when>
<xsl:otherwise>nca</xsl:otherwise>
<xsl:choose>
</xsl:template>

It is an exiting translation, however I am trying to put the exception in of occasions where I do not want it to use the alternative selection method derived from a different field. IE if the cost code supplied in the provision field is either '1000000.1' or '1000000.2' then I want it to put in a particular value... otherwise it is to do the additional based on the template?

Apologies if this seems long winded, or if I am not quite describing things right.. posting in the wrong location etc.
As say, been away from any real form of scripting for a while now.
And completely new at xsl (
Please bare with =(
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top