Two XSL IF Conditions

Hey guys,

having a bit of bother … I want to transform an xml file but only if 2 conditions are true …

so eg.

If my content type is sport and my format is football.

I tried this …

<xsl:variable name="format">
    <xsl:value-of select="format"/>
  <xsl:variable name="content_type">
    <xsl:value-of select="content_type"/>

I then tried 2 if statements to check the conditions …

<xsl:if test="$format = 'football''">
    <xsl:if test="$content_type = 'sport'">
         <!-- other stuff here -->

I get a blank document once parsed.



  1. You had a typo, 2 apostrophes after “football”.
  2. You can test for two conditions in one statement:

<xsl:if test="$format = 'football' and $content_type='sport'">
         <!-- other stuff here -->

Cheers vgarcia … found out my problem …

I had multiple formats and as my 1st format in the xml file did not always = football it failed.

I now cycle through each format and check if it = football …

<xsl:for-each select="List[format='football']"

Thanks for your help …