Avoid URL-encoding in XSLT with output method html

后端 未结 2 1522
挽巷
挽巷 2021-01-16 05:52

I have a transformation that outputs HTML. In order to avoid self-closing tags that could break in older browsers (e.g. instead of

2条回答
  •  温柔的废话
    2021-01-16 06:20

    If using PHP's XSLT 1.0 processor, then you might try the following solution...

    1. Use method="html";
    2. Include this template...

      
        
          
        
      
      
    3. Load the resultant output into a string, and replace all occurrences of Muttaburrasaurus with href.

    If you migrate to Java in the future, as you indicated in the comment feed that you might do so, then ensure that your processor is XSLT 2.0+. Then you can use the escape-uri-attributes feature as mentioned by M.Kay .

提交回复
热议问题