×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

How do I change existing xslt code to a simple statement?

How do I change existing xslt code to a simple statement?

How do I change existing xslt code to a simple statement?

(OP)
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.

CODE --> xslt

<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> 

RE: How do I change existing xslt code to a simple statement?

If you need ConvertedFELOrGMD to hold the string value of "true" or "false":

CODE --> XSLT

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

If you need ConvertedFELOrGMD to hold a boolean value:

CODE --> XSLT

<xsl:variable name="ConvertedFELOrGMD" select="substring(CaseType/@Word, 1, 3) = 'CNV'"/> 

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close