Altova Mailing List Archives>Archive Index >microsoft.public.xsl Archive Home >Recent entries >Thread Prev - XML to XML: how to remove stylesheet; how to add line ... ?> [Thread Next] Re: XML to XML: how to remove stylesheet; how to add line ... ?>To: NULL Date: 7/2/2004 1:35:00 PM qluo wrote: > How can I remove the following line from my xml output: > > <?xml-stylesheet href="template.xsl" type="text/xsl"?> That is a processing instruction that can be created with the <xsl:processing-instruction> element. The following is an example of an XSLT stylesheet matching a processing instruction and replacing it: <?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> <xsl:output method="xml" encoding="UTF-8" /> <xsl:template match="processing-instruction()[contains(., 'href="template.xsl"')]"> <xsl:processing-instruction name="mso-application"> <xsl:text>progid="Excel.Sheet"</xsl:text> </xsl:processing-instruction> </xsl:template> <xsl:template match="@* | node()"> <xsl:copy> <xsl:apply-templates select="@* | node()" /> </xsl:copy> </xsl:template> </xsl:stylesheet> If applied to the following input <?xml version="1.0" encoding="UTF-8"?> <?xml-stylesheet href="template.xsl" type="text/xsl"?> <root> <?some-procinstruction god="Kibo"?> <whatever /> </root> the output is <?xml version="1.0" encoding="UTF-8"?> <?mso-application progid="Excel.Sheet"?> <root> <?some-procinstruction god="Kibo"?> <whatever/> </root> -- Martin Honnen http://JavaScript.FAQTs.com/ | ||||||
| Company | Legal | Press | Partners | Careers | Sitemap | Contact Us | Altova Blog | Mobile | Full Site | |||
|
