Embed xsl into an XML file

后端 未结 3 631
慢半拍i
慢半拍i 2020-12-19 09:14

I\'m trying to embed an xsl into a XML file. The reason for doing this is to create a single file that could be moved to different computers, this would prevent the need to

3条回答
  •  一整个雨季
    2020-12-19 09:49

    Although the W3C XSLT Spec supports embedding an XSLT stylesheet into an XML document, it seems that IE and Firefox do not support this.

    UPDATE: As per the comment by Robert Niestroj, years later, in Oct. 2014, this works in FireFox 33.

    However, there is a good alternative: embed the XML document into the XSLT stylesheet.

    Below is an example.

    An XSLT stylesheet containing an embedded XML document:

    
    
     
        
            
                
                
                    Hello I am foo
                
            
        
        
          

    When tis file is opened in IE, the wanted result is displayed by the browser:

    Hello I am foo

    Do note, that it is necessary to include templates that ignore most of the XSLT instructions (in this case we are ignoring any by simply having no template body.

提交回复
热议问题