none
how do I write a xlst statement for my code? RRS feed

  • Question

  • I have the following existing xslt code. I would like to replace this code with a simple statement where I check the first three characters of CaseType/@Word = CNV instead.

    			<xsl:variable name="ConvertedFELOrGMD">
    				<xsl:choose>
    					<xsl:when test="CaseType/@Word = 'CNVAWI'">true</xsl:when>
    					<xsl:when test="CaseType/@Word = 'CNVBWI'">true</xsl:when>
    					<xsl:when test="CaseType/@Word = 'CNVDAF'">true</xsl:when>
    					<xsl:when test="CaseType/@Word = 'CNVDAG'">true</xsl:when>
    					<xsl:when test="CaseType/@Word = 'CNVDAM'">true</xsl:when>
    					<xsl:when test="CaseType/@Word = 'CNVDAT'">true</xsl:when>
    					<xsl:when test="CaseType/@Word = 'CNVDWI'">true</xsl:when>
    					<xsl:when test="CaseType/@Word = 'CNVDWK'">true</xsl:when>
    					<xsl:when test="CaseType/@Word = 'CNVFDA'">true</xsl:when>
    					<xsl:when test="CaseType/@Word = 'CNVFDK'">true</xsl:when>
    					<xsl:when test="CaseType/@Word = 'CNVFDW'">true</xsl:when>
    					<xsl:when test="CaseType/@Word = 'CNVFEL'">true</xsl:when>
    					<xsl:when test="CaseType/@Word = 'CNVFFD'">true</xsl:when>
    					<xsl:when test="CaseType/@Word = 'CNVFWI'">true</xsl:when>
    					<xsl:when test="CaseType/@Word = 'CNVGDI'">true</xsl:when>
    					<xsl:when test="CaseType/@Word = 'CNVGFD'">true</xsl:when>
    					<xsl:when test="CaseType/@Word = 'CNVGMD'">true</xsl:when>
    					<xsl:when test="CaseType/@Word = 'CNVHWI'">true</xsl:when>
    					<xsl:when test="CaseType/@Word = 'CNVKOT'">true</xsl:when>
    					<xsl:when test="CaseType/@Word = 'CNVSFL'">true</xsl:when>
    					<xsl:when test="CaseType/@Word = 'CNVSWI'">true</xsl:when>
    					<xsl:when test="CaseType/@Word = 'CNVDFL'">true</xsl:when>
    					<xsl:when test="CaseType/@Word = 'CNVDGM'">true</xsl:when>
    					<xsl:when test="CaseType/@Word = 'CNVJFL'">true</xsl:when>
    					<xsl:when test="CaseType/@Word = 'CNVJGM'">true</xsl:when>
    					<xsl:otherwise>false</xsl:otherwise>
    				</xsl:choose>
    			</xsl:variable>

    How do I do that?

    Friday, December 29, 2017 4:29 PM

All replies

  • Try this:

    <xsl:variable name="ConvertedFELOrGMD">
      <xsl:choose>
        <xsl:when test="starts-with(CaseType/@Word, 'CNV')">true</xsl:when>
        <xsl:otherwise>false</xsl:otherwise>
      </xsl:choose>
    </xsl:variable>
    

    Friday, December 29, 2017 6:29 PM