Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using XSLT to remove ALL processing instructions from an XML file

Tags:

xml

xslt

I'm transforming an XML document to an HTML one. I'd like to remove every instance of a processing instruction from the source doc.

I've figured out how to remove specific processing instructions via <xsl:template match="processing-instruction('processing_instruction_name')"/> but the processing instructions I'm dealing with vary from document to document.

I've tried variations of * for the processing_instruction_name, but my XSL engine keeps throwing parsing errors. Is what I want to do possible? If so, how do I do it?

Any help is appreciated!

like image 399
Matt Avatar asked Dec 25 '22 08:12

Matt


1 Answers

You just need to create an empty template to match all processing-instruction() nodes in your stylesheet:

<xsl:template match="//processing-instruction()" />
like image 52
helderdarocha Avatar answered Jan 06 '23 00:01

helderdarocha