Usually, copy-of="node()"
retrieves the child nodes of an element. But in the case of processing instructions it seems that only text content is output.
This does not make sense to me, but the solution below is a workaround for this.
Stylesheet
<?xml version="1.0"?>
<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" indent="yes" omit-xml-declaration="yes"/>
<xsl:strip-space elements="*"/>
<xsl:template match="/content">
<xsl:processing-instruction name="php">
<xsl:text>$content = "</xsl:text>
<xsl:apply-templates/>
<xsl:text>";</xsl:text>
</xsl:processing-instruction>
</xsl:template>
<xsl:template match="content/*">
<xsl:text><</xsl:text><xsl:value-of select="name()"/><xsl:text>></xsl:text>
<xsl:value-of select="."/>
<xsl:text></</xsl:text><xsl:value-of select="name()"/><xsl:text>></xsl:text>
</xsl:template>
</xsl:stylesheet>
Output
<?php $content = "<p>Para one</p><p>Para two</p>";?>