XSLT Getting two different output for same input XML for same XSL

前端 未结 4 1387
囚心锁ツ
囚心锁ツ 2021-01-20 04:22

I have been trying my XSLT code in the online tool [XSLT 1.0 processor]:

http://www.freeformatter.com/xsl-transformer.html

Recently, I had to make

4条回答
  •  [愿得一人]
    2021-01-20 04:22

    Output 2 is definitely the correct one according to both the 1.0 and 2.0 XSLT specs for the stylesheet you give in the question. However you say this is simplified when compared to your real stylesheet.

    The thing that makes it work is the default priorities that are assigned to different types of templates. These are the same in both XSLT versions, and a match pattern that involves a predicate will overrule one that is just a single element name test.

    However a match that involves hierarchy (e.g. match="items/book") or anything more complex than just a single element name will get the same priority as the *[....] rule by default - 0.5. If you've got any of these kinds of patterns in your real XSLT then you need to add an explicit priority higher than 0.5 to the "blank-suppressor" template.

    
    

提交回复
热议问题