How to Import stylesheets in xslt conditionally?

前端 未结 2 864
遥遥无期
遥遥无期 2021-01-19 00:37

Is there any way to import stylesheets after checking some conditions?

Like,if the value of variable $a=\"1\" then import 1.xsl or else import 2.xsl.

2条回答
  •  轮回少年
    2021-01-19 01:06

    I know this post is old, but I want to share my opinion.

    Each display could use one template instead of two. The value display will be change with a VB application.

    breakfast_menu.xml:

    
    
    
        
            
                Belgian Waffles
                $5.95
                Two of our famous Belgian Waffles with plenty of real maple syrup
                650
            
    
            
                Strawberry Belgian Waffles
                $7.95
                Light Belgian waffles covered with strawberries and whipped cream
                900
            
    
    
            
                Homestyle Breakfast
                $6.95
                Two eggs, bacon or sausage, toast, and our ever-popular hash browns
                950
            
         
        1
    
    

    In this file, I imported my displays and with a condition I tell the template what I need.

    conditionDisplay.xsl

    
    
        
        
        
            
            
                
                    
                
                
                    
    
        
            
                
                    
                        
    -

    ( calories per serving)

    display2.xsl:

    futur
    
        
            
                
                    
                        
    -

    ( calories per serving)

    I genuinely apologize for my terrible English. It will be better to the next post and I hope will help someone as I think it's not the best solution.

提交回复
热议问题