是否可以使用 xslt 2.0为 html 根元素添加一个xml:lang或属性?lang<html>
问题是,唯一允许的属性xsl:stylesheet是:id、exclude-result-prefixes、extension-element-prefixes,version当然还有xmlns。任何 xslt 处理器都会忽略其他属性。
必须有一种方法来扩展<html>我希望的元素?
非常感谢。
代码(在本例中为 xhtml):
<xsl:stylesheet
xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0"
xmlns:fn="http://www.w3.org/2005/xpath-functions"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:tst="http://www.ma-buwi-fh.de"
xmlns="http://www.w3.org/1999/xhtml"
xml:lang="de">
<xsl:output method="xhtml"
encoding="UTF-8"
indent="yes"
doctype-public='-//W3C//DTD XHTML 1.1//EN'
doctype-system='http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd'
/>
结果如下所示:
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:fn="http://www.w3.org/2005/xpath-functions"
xmlns:tst="http://www.ma-buwi-fh.de"
xmlns="http://www.w3.org/1999/xhtml">