Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


Using XSLT to transform XHTML to XHTML

From: WilliamRayer@-----------.---------.---
To: NULL
Date: 6/26/2008 1:50:00 AM

Dear XSL newsgroup

I have input XHTML (indirectly produced from MS Word) and I am using XSLT to 
produce an output XHTML document. The input XHTML contains many topics, the 
transform selects one topic of interest and the output XHTML can be displayed 
as a web page. I have ensured the input is well-formed and valid.

In the transform I am trying to produce all my XHTML by means of a single 
<xsl:template match="/"> which includes all the output <html> ... </html> 
elements. My problem is that within the <xsl:template match="/"> element, all 
use of xsl:value-of seems incapable of retrieving anything from the input 
XHTML. Here are the documents:

----------------input.xhtml-------------------
<?xml version="1.0"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">  
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
  <head>
    <title>Fruits</title>
  </head>
  <body>
    <h1>Apples</h1>
    <p>Round fruits that grow on trees.</p>
    <h1>Bananas</h1>
    <p>Yellow fruits that grow in clumps.</p>
  </body>
</html>
----------------input.xhtml-------------------


----------------transform.xslt-------------------
<xsl:stylesheet version="1.0" 
 xmlns="http://www.w3.org/1999/xhtml"
 xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
 xmlns:xhtml="http://www.w3.org/1999/xhtml"
 exclude-result-prefixes="xhtml xsl">
 
  <xsl:output method="xml" indent="yes" omit-xml-declaration="yes" 
  doctype-public="-//W3C//DTD XHTML 1.0 Transitional//EN" 
  doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"/>

<xsl:template match="/">
  <html>
  <head>
  <title> Title: <xsl:value-of select="xhtml:title"/> </title>
  </head>
  <body> Body: <xsl:value-of select="xhtml:p"/> </body>
  </html>
</xsl:template>

</xsl:stylesheet>
----------------transform.xslt-------------------


-------------output.html------------
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
	<head>
		<title> Title: </title>
	</head>
	<body> Body: </body>
</html>
-------------output.html------------


Although the output is valid it's not picking up the xhtml:title or xhtml:p 
elements from the input. Any help would be greatly appreciated!

Kind regards
Will Rayer



transparent
Print
Mail
Digg
delicious
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent