Sun N1 Service Provisioning System 5.1 XML Schema Reference Guide

<stylesheet> Element

The <stylesheet> element is a child of the <transform> step. This element specifies an XSLT transformation to apply to the input source. At most one <stylesheet> element can appear as a child of a particular <transform> element. You cannot use the <stylesheet> element in conjunction with other child elements.

The <stylesheet> element is an XSLT Version 1.0 element as defined by the http://www.w3.org/1999/XSL/Transform name space. For more information, see Version 1.0 of the XSL Transformations (XSLT) specification at http://www.w3.org/TR/xslt.html. Only the XSLT <stylesheet> element is accepted as a child of the <transform> element. In particular, neither the XSLT synonym <transform> nor the simplified XSLT transform syntax described in Section 2.3 of the XSLT specification is supported as a child of the <transform> element.

The <stylesheet> element body can include substitution variable references if the body is still a valid XSLT without first undergoing variable substitution.

When a <stylesheet> element is used as a transformation, the input file must be written in XML. For more information, see Version 1.0 of the XSL Transformations (XSLT) specification.


Example 2–4 Using the <stylesheet> Element

This transformation changes each a to a b in the /etc/hosts file. The hosts file is overwritten with these changes.


<transform output="/etc/hosts">
    <xsl:stylesheet version="1.0"
      xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
        <xsl:template match="/">
            <xsl:for-each select="a">
                <xsl:value-of select="b"/>
            </xsl:for-each>
        </xsl:template>
    </xsl:stylesheet>
</transform>