7.3 Creating Processing Instructions
Creating Processing Instructions
<
processing-instruction
name=
{
ncname
}
>
<-- Content: -->
<
/processing-instruction>
The xsl:processing-instruction element is instantiated
to create a processing instruction node. The content of the
xsl:processing-instruction element is a template for the
string-value of the processing instruction node. The
xsl:processing-instruction element has a required
name attribute that specifies the name of the processing
instruction node. The value of the name attribute is
interpreted as an Attribute Value Template.
For example, this
<xsl:processing-instruction name="xml-stylesheet">href="book.css" type="text/css"</xsl:processing-instruction>
would create the processing instruction
<?xml-stylesheet href="book.css" type="text/css"?>
It is an error if the string that results from instantiating the
name attribute is not both an NCName and a PITarget. An XSLT processor may signal
the error; if it does not signal the error, it must recover by not
adding the processing instruction to the result tree.
NOTE:
This means that xsl:processing-instruction
cannot be used to output an XML declaration. The
xsl:output element should be used instead (see [Output]).
It is an error if instantiating the content of
xsl:processing-instruction creates nodes other than
text nodes. An XSLT processor may signal the error; if it does not
signal the error, it must recover by ignoring the offending nodes
together with their content.
It is an error if the result of instantiating the content of the
xsl:processing-instruction contains the string
?>. An XSLT processor may signal the error; if it does
not signal the error, it must recover by inserting a space after any
occurrence of ? that is followed by a >.
|