How do I preserve markup tags?

后端 未结 5 1518
太阳男子
太阳男子 2021-02-18 23:52

I\'ve got an XML document containing news stories, and the body element of a news story contains p tags amongst the plain text. When I use XSL to retrieve the body, e.g.

5条回答
  •  时光说笑
    2021-02-18 23:53

    If you don't have control over the input document, copy-of should work:

    From http://www.xml.com/pub/a/2000/06/07/transforming/index.html

    "The xsl:copy-of element, on the other hand, can copy the entire subtree of each node that the template selects. This includes attributes, if the xsl:copy-of element's select attribute has the appropriate value. In the following example, the template copies title element nodes and all of their descendant nodes -- in other words, the complete title elements, including their tags, subelements, and attributes:"

    
      
    
    

提交回复
热议问题