Altova Mailing List Archives>Archive Index >microsoft.public.xsl Archive Home >Recent entries >Thread Prev - Re: Using XSLT to transform XHTML to XHTML (again!) >Thread Next - Re: Using XSLT to transform XHTML to XHTML (again!) Re: Using XSLT to transform XHTML to XHTML (again!)To: NULL Date: 7/4/2008 6:52:00 PM William Rayer wrote: > Many thanks - that seems to work fine! But is it possible to do it from > within the context of a single template match on the root node? I am trying > to keep the HTML output in the form: > > <xsl:template match="/"> > <html> > <head> > <title> <xsl:value-of select="$title"/> </title> > </head> > <body> > > <!-- XSLT stuff in here --> > > </body> > </html> > </xsl:template> > > as I find this easier to understand.? Well using the identity transformation template and adding templates to perform some changes is a fundamental XSLT approach you should try to become familiar with. If you really insist on one template and spelling out the structure again instead of simply copying it then you need <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:param name="title"/> <xsl:variable name="h1" select="/xhtml:html/xhtml:body/xhtml:h1[. = $title]"/> <xsl:template match="/"> <html> <head> <title> <xsl:value-of select="$title"/> </title> </head> <body> <xsl:copy-of select="$h1 | $h1/following-sibling::xhtml:p[generate-id($h1) = generate-id(preceding-sibling::xhtml:h1[1])]"/> </body> </html> </xsl:template> </xsl:stylesheet> -- Martin Honnen --- MVP XML http://JavaScript.FAQTs.com/ | ||||||
| Company | Legal | Press | Partners | Careers | Sitemap | Contact Us | Altova Blog | Mobile | Full Site | |||
|
