A processing instruction is represented in the XML Infoset and can easily
be copied from one document to another.
[...]
So please show me how.
Use the <xsl:copy-of> instruction.
Here's a simple example:
This transformation:
<xsl:stylesheet version="1.0"
xmlns:xsl="
http://www.w3.org/1999/XSL/Transform">
<xsl
utput omit-xml-declaration="yes"/>
<xsl:template match="node()|@*">
<xsl:copy>
<xsl:apply-templates select="node()|@*"/>
</xsl:copy>
</xsl:template>
<xsl:template match="processing-instruction()">
<xsl:copy-of select="."/>
</xsl:template>
</xsl:stylesheet>
when applied on this source xml document:
<t>
<?PI xxx="yyy" ?>
</t>
produces this result:
<t>
<?PI xxx="yyy" ?>
</t>
The processing instruction matched by the 2nd (last template) and this
template is selected for processing it. The action is simply to copy the
current node (the processing instruction) to the output.
Hope this helps.
Cheers,
Dimitre Novatchev
Dennis Benzinger said:
Dimitre said:
The xml declaration is not a processing instruction.
Yes, I know that. But I don't want to copy the xml declaration, I want to
add a processing instruction.
A processing instruction is represented in the XML Infoset and can easily
be copied from one document to another.
[...]
So please show me how.
Dennis