Hello all,
I'm trying to use XSLT to generate some XHMTL with inline PHP. I've run across a problem with generating inline PHP in attributes.
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:html="http://www.w3.org/1999/xhtml" version="1.0">
<xsl:output method="xml"
indent="yes"
doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"
doctype-public="-//W3C//DTD XHTML 1.0 Transitional//EN"
omit-xml-declaration="yes" />
<xsl:template match="/">
<html lang="<?php echo getLang(); ?>" xml:lang="<?php echo getLang(); ?>">
<head>
<xsl:processing-instruction name="php">include_title();</xsl:processing-instruction>
(Much more code ...)
gives the following results:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns:html="http://www.w3.org/1999/xhtml" lang="" xml:lang="">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<?php include_title();?>
(Much more code ...)
Take note that the "lang" and "xml:lang" attributes of the html element are empty! So clearly, this is the wrong way to process inline PHP.
So does anyone know how to change the xsl code to get the desired result shown below?
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns:html="http://www.w3.org/1999/xhtml" lang="<?php echo getLang(); ?>" xml:lang="<?php echo getLang(); ?>">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<?php include_title();?>
(Much more code ...)
Thanks, Kevin