Altova Mailing List Archives>Archive Index >microsoft.public.xsl Archive Home >Recent entries >Thread Prev - XSLT removes HTML tags [Thread Next] Re: XSLT removes HTML tagsTo: NULL Date: 3/6/2009 12:58:00 PM Majid wrote: > Hi, > I use the following XSLT file to transfer a xml document into XHTML format > and everything goes fine except the fact that XSLT removes all my html tags > such as <br /> tags or <b></b> and only uses the text content. > This is the XSLT file : > > > <?xml version="1.0" encoding="utf-8"?> > <xsl:stylesheet version="1.0" > xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> > <xsl:output method="html" indent="yes"/> > <xsl:output omit-xml-declaration="yes"/> > <xsl:template match="/"> > <html xmlns="http:////www.w3.org/1999/xhtml"> > <head> > <title>Test title</title> > </head> > <body> > > <xsl:apply-templates select="/emaillist/email_content"/> > > </body> > </html> > </xsl:template> > <xsl:template match="item"> > </xsl:template> You need at least to add a template for email_content that copies the child nodes to the result tree <xsl:template match="email_content"> <xsl:copy-of select="node()"/> </xsl:template> However as your XML below has elements in no namespace while you want to output elements in the XHTML namespace you will not get the result you want. Consider to have the stylesheet generate HTML 4 not XHTML, then the above works. Otherwise you would need to write templates that transform e.g. br or b elements in no namespace to the XHTML namespace. > <emaillist> > <email_content> > <b>Test Text</b>,<br /> > > Test Text,<br /> > > > </email_content> > </emaillist> -- Martin Honnen --- MVP XML http://JavaScript.FAQTs.com/ | ||||||
| Company | Legal | Press | Partners | Careers | Sitemap | Contact Us | Altova Blog | Mobile | Full Site | |||
|
