XHTML to XML XSLT conversion

后端 未结 3 497
感动是毒
感动是毒 2020-12-17 07:19

I am doing a very simple xslt to convert a html page to a xml file.

But it appears to me that the starting point is not that straightforward to me.My first goal is t

相关标签:
3条回答
  • 2020-12-17 07:46

    The purpose of XSLT is to transform XML documents into other XML documents. HTML is not a XML document. While XHTML is XML, it is actually HTML reformulated so I'm just not sure what you want to do is easy or possible with XSLT.

    0 讨论(0)
  • 2020-12-17 07:47

    You may want to try to remove the first template or make it more specific than matching every node with node().

    0 讨论(0)
  • 2020-12-17 08:01

    XSLT 1.0:

    Try adding xmlns:x="http://www.w3.org/1999/xhtml" to your xsl:stylesheet and changing your match to match="x:html". (Note: you don't have to use "x"; you can choose anything you want.)

    XSLT 2.0:

    Either use the above method or replace the namespace prefix in your match(es) to "*" (match="*:html"). You could also add xpath-default-namespace="http://www.w3.org/1999/xhtml" to the xsl:stylesheet.

    0 讨论(0)
提交回复
热议问题