>A processing instruction is represented in the XML Infoset and can easily
Quote:
Originally Posted by
Quote:
Originally Posted by
>be copied from one document to another.
> [...]
>
So please show me how.
Use the <xsl:copy-ofinstruction.
Here's a simple example:
This transformation:
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output 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" <Dennis.Benzinger@gmx.netwrote in message
news:44ba96d9$1@news.uni-ulm.de...
Quote:
Originally Posted by
Dimitre Novatchev wrote:
Quote:
Originally Posted by
Quote:
Originally Posted by
>>(Use case: I have a xml document where I just want to add a processing
>>instruction without modifing the rest of the document)
>>
>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.
>
Quote:
Originally Posted by
>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