Microsoft XML 2.5 SDK


 

xsl:pi Element

[This is preliminary documentation and subject to change.]

Generates a processing instruction in the output.

Syntax

<xsl:pi

    name="pi-name"  >

</xsl:pi>

Attributes

name

Name of the processing instruction.

Element Information

Number of occurrences Unlimited
Parent elements xsl:copy, xsl:element, xsl:for-each, xsl:if, xsl:otherwise, xsl:template, xsl:when, output elements
Child elements xsl:apply-templates, xsl:choose, xsl:copy, xsl:eval, xsl:for-each, xsl:if, xsl:value-of
Requires closing tag Yes. XSL is an XML grammar and, like all XML grammars, all tags must have closing tags to satisfy the definition of well-formed.

Remarks

The xsl:pi element generates a processing instruction (PI) in the output. The name is indicated by the name attribute. The content of the element provides the rest of the PI.

Example

This example shows a template that generates the XML declaration and a style sheet processing instruction in the output.

<xsl:template match="/">
  <xsl:pi name="xml">version='1.0' standalone='yes'</xsl:pi>
  <xsl:pi name="xml-stylesheet">type="text/xsl" href="style.xsl"</xsl:pi>
  <xsl:apply-templates />
</xsl:template>

See Also

Generating More Sophisticated XML Output