Puting attributes to the <html> root-element with xslt 2.0 -


is possible put xml:lang or lang attribute html root-element <html> using xslt 2.0?

the problem is, allowed attributes xsl:stylesheet are: id, exclude-result-prefixes, extension-element-prefixes, version , of course xmlns. other attributes being ignored xslt-processor.

there must way extend element <html> hope?

thanks lot.

code (xhtml in case):

<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'     /> 

the result looks this:

<?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"> 

you mistaking stylesheet element (the root element of xslt stylesheet) html (the root element of html document).

the attributes cite ones allowed stylesheet element. see relevant part of specification here.

so, specify lang attribute on html element output, not on stylesheet element.

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/xsl/transform" version="2.0">    <xsl:template match="/">     <html lang="en">       <!--html content-->     </html>   </xsl:template> </xsl:stylesheet> 

if want diagnose actual problem, must needs show xslt code.


Comments

Popular posts from this blog

html - Sizing a high-res image (~8MB) to display entirely in a small div (circular, diameter 100px) -

java - IntelliJ - No such instance method -

identifier - Is it possible for an html5 document to have two ids? -