Jamie's Space


XSLT META Tag Output

My previous problem where the XSLT processor was outputting an unclosed meta tag has been solved. The W3C XSLT spec specifies that the processor should not output a new meta tag if there is one already present. Thus the way to fix the output so it did not add a meta tag was to insert one myself. However there are a few things to note. It will only do it within an html element that has the xhtml namespace. Also, if you do not have a trailing space before the closing / it will not work. See my example below (note I tried to use include-content-type=”no” which may or may not have worked. It takes a while to recompile and deploy the service-unit so I haven’t tried it):

<xsl:output method="xhtml" include-content-type="no"/>  
<xsl:template match="result">  
<html xmlns="http://www.w3.org/1999/xhtml">  
  <meta http-equiv="Content-Type" content="text/html; charset=EUC-JP" />