Xslt how to style conditional odd/even rows

前端 未结 3 1505
梦谈多话
梦谈多话 2021-02-08 22:39

I\'ve an html table written using xslt transformation that looks like this


        

        
      
      
      
3条回答
  •  灰色年华
    2021-02-08 23:08

    It looks like the conditionalRowStyle template to add styles to the table is in the same stylesheet as the one building the table. If that's the case, then it will not work as expected, since the nodes selected in the conditionalRowStyle template will be from the source document (containing someNode) and not the target document (where the generated table elements are.)

    You can "hack" this by collecting the table output of the someNode templates to a variable first, which you can then run the conditionalRowStyle template on first before finally outputting the variable value as the result of the stylesheet. But it's much simpler to use two stylesheets, that you run one after the other in a pipeline. The first stylesheet converts the someNode data to a table, and the second applies conditionalRowStyle formatting to the table.

提交回复
热议问题