XSLT IF Multiple Conditions
Posted: Mon May 11, 2015 5:32 pm
Hi,
I have created a CV as my XML document. I have than made a XSL which produces either a accept/reject letter based on if certain words appear in the XML.
That criteria is as follows: If the word 'Web Developer' appear in <experienceSummary> AND 'Information' OR 'Computer' OR 'Web' appear in <educationSummary> then load up a accept letter. If this criteria is not met load up a reject letter.
I have got it working for the word 'Web Developer' but I'm not sure how to connect the other words to this expression.
I have searched almost everywhere for a solution with no luck!! Surely it can't be that hard to have a IF test with multiple conditions. Thanks in advance for any help given, will be much appreciated!
I have created a CV as my XML document. I have than made a XSL which produces either a accept/reject letter based on if certain words appear in the XML.
That criteria is as follows: If the word 'Web Developer' appear in <experienceSummary> AND 'Information' OR 'Computer' OR 'Web' appear in <educationSummary> then load up a accept letter. If this criteria is not met load up a reject letter.
I have got it working for the word 'Web Developer' but I'm not sure how to connect the other words to this expression.
Code: Select all
<xsl:variable name="search">
<xsl:value-of select="//experienceSummary"/>
</xsl:variable>
<xsl:variable name="expSearch">
<xsl:value-of select="//educationSummary"/>
</xsl:variable>
<xsl:if test="contains($search, 'Web Developer')">
<!-- <xsl:if test="contains($search, 'Web Developer' and ($expSearch='Computer' or $expSearch='Information' or $expSearch='Web' ))"> -->
<!-- <xsl:if test="contains($search, 'Web Developer' and (contains($expSearch, 'Computer' or 'Information' or 'Web' )))"> -->
<p>Buckinghamshire New University regard that your experience as a Web Developer to be relevant to this post.</p>
<p>Your award [item title from CV XML], also fulfils elements of the job description.</p>
<p>We are therefore pleased to invite to an interview on: Monday 18th May 2015.</p>
</xsl:if>
<xsl:if test="not(contains($search, 'Web Developer'))">
<p>Buckinghamshire New University received many applications for this post. Due to the strength of the field we regret that you have not been selected for an interview on this occasion.</p>
<p>We will, however, keep your CV on file for consideration when similar opportunities arise.</p>
</xsl:if>