Commit scripts and automation scripts are written in the Extensible Stylesheet Language Transformations (XSLT), which is a standard for processing Extensible Markup Language (XML) data developed by the World Wide Web Consortium (W3C). The XSLT specification is on the W3C Web site at http://www.w3c.org/TR/xslt.
XSLT is a natural match for the JUNOS software, with its native XML capabilities. XSLT performs XML-to-XML transformations, turning one XML hierarchy into another. XSLT offers a great degree of freedom and power in the way in which it transforms the input XML, allowing everything from making minor changes to the existing hierarchy (such as pruning or adding) to building a completely new document hierarchy.
Because XSLT was created to allow generic XML-to-XML transformations, it is a natural choice for both inspecting configuration syntax (which the JUNOS software can easily express in XML) and for generating errors and warnings (which the JUNOS software communicates internally as XML). XSLT includes powerful mechanisms for finding configuration statements that match specific criteria. XSLT can then generate appropriate XML from these configuration statements to instruct the JUNOS user-interface (UI) components to perform the desired behavior. The JUNOScript application programming interface (API) defines XML elements for error, warning, and system log (syslog) messages.
Although XSLT provides a powerful scripting ability, its focus is specific and limited. It does not make the JUNOS software vulnerable to arbitrary or malicious programmers. XSLT restricts programmers from performing haphazard operations, such as opening random Transmission Control Protocol (TCP) ports, forking numerous processes, or sending e-mail. The only action available in XSLT is to generate XML, and the XML is interpreted by the UI according to fixed semantics. An XSLT script can output only XML data, which is directly processed by the UI infrastructure to allow only the specific abilities listed above—generating error, warning, and system log messages, and persistent and transient configuration changes. This means that the impact of commit scripts and automation scripts on the routing platform is well-defined and can be viewed inside the command-line interface (CLI), using commands added for that purpose.
This chapter contains some overview material, intended as a brief introduction to XSLT. This chapter is not a comprehensive user guide for XSLT or XML Path Language (XPath). If you are already knowledgeable about XSLT, you can skip this chapter.
XSLT is a language for transforming one XML document into another XML document. The basic model is that an XSLT engine (or processor) reads a script (or style sheet) and an XML document. The XSLT engine uses the instructions in the script to process the XML document by traversing the document’s hierarchy. The script indicates what portion of the tree should be traversed, how it should be inspected, and what XML should be generated at each point. For commit scripts and automation scripts, the XSLT engine is a function of the JUNOS management process (mgd).
Figure 1 shows the flow of an XSLT script through the XSLT engine.
Figure 1: Flow of XSLT Script Through the XSLT Engine

XSLT has seven basic concepts, summarized in Table 7.
Table 7: XSLT Concepts
This chapter discusses the following topics: