how to get doctype tag with url using xsl:output

i have added the below xsl:output tag in xslt

<xsl:output method="html" indent="yes" encoding="utf-8" doctype-public="-//W3C//DTD HTML 4.0 Transitional//EN" ></xsl:output>

as a result i get the below doctype tag in the html output-

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

how can i mention the url in the doctype tag using xsl:output which would output a doctype tag that looks like below

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "_http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

Best Regards,
Keshav


A quick trip to W3Schools reveals that the XSL:Output element has a doctype-system attribute available, as well as a doctype-public . I believe this is what you need.

If you change your xsl:output to the following

<xsl:output method="html" indent="yes" encoding="utf-8" doctype-public="-//W3C//DTD HTML 4.0 Transitional//EN" doctype-system="_http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd" ></xsl:output>

You should get the DTD output you require, as follows:

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "_http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
链接地址: http://www.djcxy.com/p/15702.html

上一篇: DOCTYPE使用schema.org的良好起点

下一篇: 如何使用xsl:output获取带有网址的doctype标记