How to implement if-else statement in XSLT?

后端 未结 5 1285
一整个雨季
一整个雨季 2020-11-28 05:28

I am trying to implement an if -else statement in XSLT but my code just doesn\'t parse. Does anyone have any ideas?

  

        
5条回答
  •  星月不相逢
    2020-11-28 05:44

    The most straight-forward approach is to do a second if-test but with the condition inverted. This technique is shorter, easier on the eyes, and easier to get right than a choose-when-otherwise nested block:

    
         
         date:  
         
            

    mooooooooooooo

    dooooooooooooo

    Here's a real-world example of the technique being used in the style-sheet for a government website: http://w1.weather.gov/xml/current_obs/latest_ob.xsl

提交回复
热议问题