I have the following XML:
<content>
<p>Para one</p>
<p>Para two</p>
<img src='pic.jpg' alt='pic'/>
</content>
In my XSLT I have
<xsl:processing-instruction name="php">
$content = "<xsl:copy-of select="content/node()"/>";
</xsl:processing-instruction>
But it's outputting:
$content = "Para one
Para two";
I want it to output:
$content = "<p>Para one</p><p>Para two</p><img src='pic.jpg' alt=='pic'/>";
How do I do that?
This script as well as this script gave me the result I desired:
<xsl:include href="nodetostring.xsl"/>
<xsl:template match="content">
<xsl:param name="content">
<xsl:apply-templates mode="nodetostring" select="node()"/>
</xsl:param>
<xsl:processing-instruction name="php">
$content = '<xsl:copy-of select="$content"/>';
</xsl:processing-instruction>
</xsl:template>