W3cubDocs

/XSLT & XPath

Index

XSLT/XPath Reference: XSLT elements, EXSLT functions, XPath functions, XPath axes

Found 54 pages:

# Page Tags and summary
1 XSLT: Extensible Stylesheet Language Transformations Landing, Web, XSLT
Extensible Stylesheet Language Transformations (XSLT) is an XML-based language used, in conjunction with specialized processing software, for the transformation of XML documents.
2 Common XSLT Errors XSLT
Your server needs to send both the source and the stylesheet with a XML mime type, text/xml or application/xml. To find out the current type, load the file in Mozilla and look at the page info. Or use a download tool, those usually tell the mime type.
3 Index Index, Reference, XSLT
Found 54 pages:
4 PI Parameters XSLT
No summary!
5 The XSLT/JavaScript Interface in Gecko XSLT
No summary!
6 Advanced Example XSLT
This advanced example sorts several divs based on their content. The example allows sorting the content multiple times, alternating between ascending and descending order. The JavaScript loads the .xsl file only on the first sort and sets the xslloaded variable to true once it has finished loading the file. Using the XSLTProcessor.getParameter() method, the code can figure whether to sort in ascending or descending order. It defaults to ascending if the parameter is empty (the first time the sorting happens, as there is no value for it in the XSLT file). The sorting value is set using XSLTProcessor.setParameter().
7 Basic Example XSLT
The basic example will load an XML file and apply a XSL transformation on it. These are the same files used in the Generating HTML example in the XSLT in Netscape Gecko article. The XML file describes an article and the XSL file formats the information for display.
8 Interface List NeedsContent, Reference
See XSLTProcessor in the Web API documentation section.
9 Introduction Gecko, Intro, JavaScript, XSLT
With modern browsers supporting XSLT, developers can now use JavaScript to access the power that XSLT provides. JavaScript can enable a web application to load XML data, process it via XSLT into a presentable form and then add it into an existing document. Since the XML data loaded only contains the raw information without any presentation data, it can load quickly even on dialup.
10 JavaScript/XSLT Bindings DOM, JavaScript, XML, XSLT
JavaScript can run XSLT transformations through the XSLTProcessor object. Once instantiated, an XSLTProcessor has an XSLTProcessor.importStylesheet() method that takes as an argument the XSLT stylesheet to be used in the transformation. The stylesheet has to be passed in as an XML document, which means that the .xsl file has to be loaded by the page before calling XSLTProcessor.importStylesheet(). This can be done via XMLHttpRequest or XMLDocument.load().
11 Resources XSLT
No summary!
12 Setting Parameters XSLT
While running transformations using precoded .xsl and .xml files is quite useful, configuring the .xsl file from JavaScript may be even more useful. For example, JavaScript and XSLT could be used to sort XML data and then display it. The sorting would have to alternate between ascending and descending sorting.
13 Transforming XML with XSLT NeedsMigration, Transforming_XML_with_XSLT, XML, XSLT
The separation of content and presentation is a key design feature of XML. The structure of an XML document is designed to reflect and clarify important relationships among the individual aspects of the content itself, unhindered by a need to provide any indication about how this data should eventually be presented. This intelligent structuring is particularly important as more and more data transfers are automated and take place between highly heterogeneous machines linked by a network.
14 An Overview NeedsHelp, NeedsMarkupWork, Transforming_XML_with_XSLT, XML, XSLT
The eXtensible Stylesheet Language/Transform is a very powerful language, and a complete discussion of it is well beyond the scope of this article, but a brief discussion of some basic concepts will be helpful in understanding the description of Netscape's capabilities that follows.
15 For Further Reading NeedsContent, NeedsHelp, Transforming_XML_with_XSLT, XML, XSLT
http://www.amazon.com/XSLT-Programme.../dp/0764543814
16 Resources Extensions, NeedsContent, NeedsExample, NeedsLiveSample, XML, xsl
No summary!
17 The Netscape XSLT/XPath Reference Netscape, Reference, XSLT, axes
No summary!
18 Using the Mozilla JavaScript interface to XSL Transformations XSLT
This document describes the JavaScript interface in Mozilla 1.2 and up to the XSLT Processing Engine (TransforMiiX).
19 XSLT elements reference Element, Overview, Reference, XSLT
There are two types of elements discussed here: top-level elements and instructions. A top-level element must appear as the child of either <xsl:stylesheet> or <xsl:transform>. An instruction, on the other hand, is associated with a template. A stylesheet may include several templates. A third type of element, not discussed here, is the literal result element (LRE). An LRE also appears in a template. It consists of any non-instruction element that should be copied as-is to the result document, for example, an <hr> element in an HTML conversion stylesheet.
20 <xsl:apply-imports> Element, Reference, XSLT, apply-imports
The <xsl:apply-imports> element is fairly arcane, used mostly in complex stylesheets. Import precedence requires that template rules in main stylesheets have higher precedence than template rules in imported stylesheets. Sometimes, however, it is useful to be able to force the processor to use a template rule from the (lower precedence) imported stylesheet rather than an equivalent rule in the main stylesheet.
21 <xsl:apply-templates> Element, Reference, XSLT, apply-templates
The <xsl:apply-templates> element selects a set of nodes in the input tree and instructs the processor to apply the proper templates to them.
22 <xsl:attribute-set> Element, Reference, XSLT, attribute-set
The <xsl:attribute-set> element creates a named set of attributes, which can then be applied as whole to the output document, in a manner similar to named styles in CSS.
23 <xsl:attribute> Attribute, Element, Reference, XSLT
The <xsl:attribute> element creates an attribute in the output document, using any values that can be accessed from the stylesheet. The element must be defined before any other output document element inside the output document element for which it establishes attribute values. But it may be after or inside elements that won't be part of the output (like <xsl:choose> or <xsl:apply-templates> etc.).
24 <xsl:call-template> Element, Reference, XSLT, call-template
The <xsl:call-template> element invokes a named template.
25 <xsl:choose> Element, Reference, XSLT, choose
The <xsl:choose> element defines a choice among a number of alternatives. It behaves like a switch statement in procedural languages.
26 <xsl:comment> Comment, Element, Reference, XSLT
The <xsl:comment> element writes a comment to the output document. It must include only text.
27 <xsl:copy-of> Element, Reference, XSLT, copy-of
The <xsl:copy-of> element makes a deep copy (including descendant nodes) of whatever the select attribute specifies to the output document.
28 <xsl:copy> Element, Reference, XSLT, copy
The <xsl:copy> element transfers a shallow copy (the node and any associated namespace node) of the current node to the output document. It does not copy any children or attributes of the current node.
29 <xsl:decimal-format> Element, Reference, XSLT, decimal-format
The <xsl:decimal-format> element defines the characters and symbols that are to be used in converting numbers into strings using theformat-number( ) function.
30 <xsl:element> Element, Reference, XSLT
The <xsl:element> element creates an element in the output document.
31 <xsl:fallback> Element, Reference, XSLT, fallback
The <xsl:fallback> element specifies what template to use if a given extension (or, eventually, newer version) element is not supported.
32 <xsl:for-each> Element, Reference, XSLT, for, for-each
The <xsl:for-each> element selects a set of nodes and processes each of them in the same way. It is often used to iterate through a set of nodes or to change the current node. If one or more <xsl:sort> elements appear as the children of this element, sorting occurs before processing. Otherwise, nodes are processed in document order.
33 <xsl:if> Element, Reference, XSLT, if
The <xsl:if> element contains a test attribute and a template. If the test evaluates to true, the template is processed. In this it is similar to an if statement in other languages. To achieve the functionality of an if-then-else statement, however, use the <xsl:choose> element with one <xsl:when> and one <xsl:otherwise> children.
34 <xsl:import> Element, Reference, XSLT, import
The <xsl:import> element is a top-level element that serves to import the contents of one stylesheet into another stylesheet. Generally speaking, the contents of the imported stylesheet have a lower import precedence than that of the importing stylesheet. This is in contrast to <xsl:include> where the contents of the included stylesheet have exactly the same precedence as the contents of the including stylesheet.
35 <xsl:include> Element, Reference, XSLT, include
The <xsl:include> element merges the contents of one stylesheet with another. Unlike the case of <xsl:import>, the contents of an included stylesheet have exactly the same precedence as the contents of the including stylesheet.
36 <xsl:key> Element, Key, Reference, XSLT
The <xsl:key> element declares a named key which can be used elsewhere in the stylesheet with the key( ) function.
37 <xsl:message> Element, Reference, XSLT, message
The <xsl:message> element outputs a message (to the JavaScript Console in NS) and optionally terminates execution of the stylesheet. It can be useful for debugging.
38 <xsl:namespace-alias> Element, Reference, XSLT, namespace-alias
The <xsl:namespace-alias> element is a rarely used device that maps a namespace in the stylesheet to a different namespace in the output tree. The most common use for this element is in generating a stylesheet from another stylesheet. To prevent a normally xsl:-prefixed literal result element (which should simply be copied as-is to the result tree) from being misunderstood by the processor, it is assigned a temporary namespace which is appropriately re-converted back to the XSLT namespace in the output tree.
39 <xsl:number> Element, Number, Reference, XSLT
The <xsl:number> element counts things sequentially. It can also be used to quickly format a number.
40 <xsl:otherwise> Element, Reference, XSLT, otherwise
The <xsl:otherwise> element is used to define the action that should be taken when none of the <xsl:when> conditions apply. It is similar to the else or default case in other programing languages.
41 <xsl:output> Element, Reference, XSLT, output
The <xsl:output> element controls the characteristics of the output document. To function correctly in Netscape, this element, with the method attribute, must be used. As of 7.0, method="text" works as expected.
42 <xsl:param> Element, Reference, XSLT, param
The <xsl:param> element establishes a parameter by name and, optionally, a default value for that parameter. When used as a top-level element, the parameter is global . When used inside an <xsl:template> element, the parameter is local to that template. In this case it must be the first child element of the template.
43 <xsl:preserve-space> Element, Reference, XSLT, preserve-space
The <xsl:preserve-space> element defines the elements in the source document for which whitespace should be preserved. If there is more than one element, separate the names with a whitespace character. Preserving whitespace is the default setting, so this element only needs to be used to counteract an <xsl:strip-space> element.
44 <xsl:processing-instruction> Element, Reference, XSLT, processing-instruction
The <xsl:processing-instruction> element writes a processing instruction to the output document.
45 <xsl:sort> Element, Reference, XSLT, sort
The <xsl:sort> element defines a sort key for nodes selected by <xsl:apply-templates> or <xsl:for-each> and determines the order in which they are processed.
46 <xsl:strip-space> Element, Reference, XSLT, strip-space
The <xsl:strip-space> element defines the elements in the source document for which whitespace should be removed.
47 <xsl:stylesheet> Element, Reference, StyleSheet, XSLT
The <xsl:stylesheet> element (or the equivalent <xsl:transform> element) is the outermost element of a stylesheet.
48 <xsl:template> Element, Reference, Template, XSLT
The <xsl:template> element defines an output producing template. This element must have either the match attribute or the name attribute set.
49 <xsl:text> Element, Reference, Text, XSLT
The <xsl:text> element writes literal text to the output tree. It may contain #PCDATA, literal text, and entity references.
50 <xsl:transform> Element, Reference, XSLT, transform
The <xsl:transform> element is exactly equivalent to the <xsl:stylesheet> element.
51 <xsl:value-of> Element, Reference, XSLT, value-of
The <xsl:value-of> element evaluates an XPath expression, converts it to a string, and writes that string to the result tree.
52 <xsl:variable> Element, Reference, XSLT, variable
The <xsl:variable> element declares a global or local variable in a stylesheet and gives it a value. Because XSLT permits no side-effects, once the value of the variable has been established, it remains the same until the variable goes out of scope
53 <xsl:when> Element, Reference, XSLT, when
The <xsl:when> element always appears within an <xsl:choose> element, acting like a case statement.
54 <xsl:with-param> Element, Reference, XSLT, with-param
The <xsl:with-param> element sets the value of a parameter to be passed into a template.

© 2005–2020 Mozilla and individual contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/XSLT/Index