XPath Quick Reference
Node Types Nodes can be of the following types:
NodeType Name String Value root Concatenation of alI text nodes in the document element Element name Concatenation of alI text nodes descended from the element attribute Attribute name Attribute value text Text cornrnent Text held within the comment processing Processing Text in the processing instruction after the space after the instruction target targetname narnespace Namespace prefix Namespace URI
Object Types Values in XSLT can be one of the following five types:
Object Type Description boolean true or false number A floating-point number: a double-precision 64-bit format IEEE 754 value Table continued on following page Appendix A
Object Type Description string A sequence of XML characters node set An unordered collection of nodes result tree fragment The root node of a generated node tree
The various object types can be converted to each other by the following rules.
Object Boolean Number String boolean 1 if the boolean is , true' if the boolean is true, O if the true, 'false' if the boolean is false boolean is false number false ifthe A string version of the number is O or number with no leading or NaN, otherwise trailing zeros; 'NaN' if the true number is NaN, , Infinity' if the number is infinity, and '-Infinity' ifthe number is negative infinity string false ifthe The number held string is an empty by the string, as string, otherwise long as it is a valid true XPath number (which doesn't include exponents or grouping separators) ; otherwise NaN
node set true if the node The result of The string value of the first set holds nodes; converting the node in the node set false ifthe string value of the node set is empty first node in the node set to a number result tree true The result of The string value of the re suit fragment converting the tree fragment string value of the re suIt tree fragment to a number
Booleans, numbers, and strings cannot be converted to node sets or result tree fragments.
694 XPath Quick Reference
Paths Paths are made up of a number of steps, separated by / s. Each step is made up of an optional axis (defaults to child), a node test, and any number of predicates (held in square brackets).
Axes Axes dictate the relationship between the context node and the selected nodes. The direction of an axis determines how the posi tion () of a node is calculated - forward axes look at document order, reverse axes look at reverse document order.
Axis Direction Description self Forward Selects the context node itself ehild Forward Selects the children of the context node parent Reverse Selects the parent of the context node attribute Forward Selects the attributes of the context node deseendant Forward Selects the descendants of the context node at any level deseendant- Forward Selects the descendants of the context node, and the or-self context node itself aneestor Reverse Selects the ancestors of the context node aneestor-or-self Reverse Selects the ancestors of the context node, and the context node itself following-sibling Forward Selects the siblings of the context node that follow the context node in document order preeeding-sibling Reverse Selects the siblings of the context node that precede the context node in document order following Forward Selects the nodes (asi de from attribute and namespace nodes) that follow the context node in document order and that are not descendants of the context node preeeding Reverse Selects the nodes (asi de from attribute and namespace nodes) that precede the context node in document order and that are not ancestors of the context node namespaee Forward Selects the namespace nodes on the context node
695 Appendix A
Node Tests Node tests match different kinds of nodes as follows:
Node Test Description node() Matches nodes of all types * Matches elements with any name (or attributes if you're using the attribute axis) name Matches elements with the given name (or attribute if you're using the attribute axis) text( ) Matches text nodes comment () Matches comment nodes processing-instruction() Matches processing instruction nodes processing• Matches processing instruction nodes with the given instruction('target') target
Abbreviated Syntax You can use several abbreviations in XPath expressions, as described in the following table.
Abbreviation Full Equivalent Description self: :node() The context node parent: :node () The parent of the context node II /descendant-or• SuppIies quick access to descendants of the context self: :node () / node @ attribute: : Shortens expressions that access attributes
Operators The operators in XPath can be spIit into four groups:
o Logical operators O Comparisons O Numerical operators O N ode set operators
696 XPath Quick Reference
The precedence of the operators (from lowest to highest) is as follows:
1. or
2. and
3. =, !=
4. <=,<,>=,>
5. +, -
6. *,div,mod
7. unary - 8.
Logical Operators
Operator Description or true if either operand is true when converted to booleans; the right operand is not evaluated if the Ieft operand is true and true if both operands are true when converted to booleans; the right operand is not evaluated ifthe Ieft operand is false
Comparisons
Operator Description Equal to != Not equal to < Less than <= Less than or equal to > Greater than >= Greater than or equal to
Comparisons between node sets and values are true if the comparison is true for the string value of any node in the node set. .
697 Appendix A
The numeric comparisons «, <=, >, and >=) can only be used to do numeric comparisons - you can't use them to test whether one string is alphabetically less than another string.
Numerical Operators
Operator Description + Addition Subtraction * Multiplication div Floating-point division mod Remainder from integer division unary - Negation
Node Set Operator
Operator Description Creates a union of two node sets
Functions XPath and XSLT together define the following functions: boolean() Syntax: boolean boolean (object) See also: string (), number ()
Converts the argument to a boolean value (either true or false). Usually this is done automatically, for example in test attributes. ceiling()
Syntax: number ceiling (number) See also: floor (), round ()
Rounds the argument up to the nearest integer. For negative numbers, this means rounding nearer to 0, so ceiling (-1. 5) is -1.
698 XPath Quick Reference concat() Syntax: string concat (string, string+)
Concatenates the strings passed as arguments into a single string. contains() Syntax: boolean contains (string, string) See also: starts-with ()
Returns true if the string passed as the first argument contains the string passed as the second argument or if the second argument is an empty string, and false otherwise. count() Syntax: number count (node-set) See also: last ( ), posi tion (),
Counts the number of nodes in the node set passed as the argument. current() Syntax: node-set current ( ) See also: the path .
Returns the current node - the node that's current1y being processed within the
If the first argument is a string, returns the node found at the URL specified by that string (usualIy the root node of a document). The URL is resolved relative to the location of the file containing the first node in the node set passed as the second argument (which is usualIy used to resolve the URL relative to the source document). If the second argument is- missing, the URL is resolved relative to the stylesheet itself. If the first argument is a node set, then the result is a node set containing alI the nodes that are retrieved by calling the document () function with the string values of the nodes in the node set. element-available( ) Syntax: boolean element-available (string) See also: function-available ( ),
699 Appendix A
Returns true if the processor supports the extension element or new XSLT instruction named by the string passed as the argument. The string should be a qualified name, with a prefix.
false() Syntax: boolean false ( ) See also: true ( ), boolean ( )
Returns false.
floorO Syntax: number floor (number) See also: ceiling (), round ()
Rounds the number down to the nearest integer. If the number is negative, then it gets rounded away from zero, so floor (-1.5) returns -2. format-number( ) Syntax: string format-number (number, string, string?) See also: number (),
Returns the number passed as the first argument formatted according to the format pattern passed as the second argument. The format pattern usually contains # to mean an optional digit, O to indicate a required digit, . to indicate the decimal point, and , to indicate a grouping separator. For example, format-number (1234.5, '#, ##0.00' ) returns 1,234.50. If the third argument is specified, it gives the name of a decimal format, declared with the
Returns true if the processor supports the function named by the argument string. The string usually includes a prefix to test for the availability of extension functions. generate-id( ) Syntax: string generate-id (node-set?)
Returns an ID for the first node in the node set passed as the argument which is both unique and a valid XML ID. If no argument is given, it returns a unique ID for the context node. The unique IDs are not stable - they are different from processor to processor, and even for the same processor operating over the same stylesheet with the same source XML document.
700 XPath Quick Reference idO Syntax: node-set id (object) See also: key ( )
Retums the nodes with the XML IDs specified by the argument. If the argument is a string, then it's split up at the whitespace, and the function retums aH the nodes in the current document that have any of the IDs. If the argument is a node set, the same is done but with the string values of each of the nodes in the node set. You have to have declared an attribute as an ID function within a DTD for the id ( ) attribute to work, and the context node must be in the same document as the nodes that you want to retrieve. key(}
Syntax: node-set key(string, object) See also: id (),
Retums the nodes that are indexed by the value specified by the second argument in the key named by the first argument. If the second argument is a node set, then aH the nodes with any of the values are retumed. You have to have declared the key with an
Retums true if the language of the context node (as specified with the xml : lang attribute) matches the language specified by the argument. This test is aware of sub languages and is case-insensitive, so for example lang ( 'en ') would retum true even ifthe context node's language was specified as EN-US. lastO Syntax: number last () See also: posi tion (), count ( )
Retums the index of the last node in the list that's currently being looked at (or the number of nodes that are currently being looked at, depending on how you like to view it). local-name( }
Syntax: string local-name (node-set?) See also: name (), namespace-uri ()
Retums the local name of the first node in the node set - the part of the name after any prefix that there might be. If no argument is passed, then retums the local name of the context node.
701 Appendix A
name()
Syntax: string name (node-set?) See also: local-name (), namespace-uri ()
Returns the fuB name of the first node in the node set, including the prefix for its namespace as declared in the source document. If no argument is passed, then returns the fuB name of the context node.
namespace-uri( )
Syntax: string namespace-uri (node-set?) See also: name ( ), local-name ( )
Returns the namespace URI for the first node in the node set, or an empty string if the node is in no namespace. If no argument is passed, then returns the namespace URI of the context node. normalize-space( )
Syntax: string normalize-space (string?) See also: string (),
Returns the argument string with leading and trailing whitespace stripped, and any sequences of whitespace converted to single spaces. If no argument string is specified, then it returns the normalized string value of the context node. not()
Syntax: boolean not (boolean) See also: true ( ), false (), boolean ()
Returns false if the argument is true, and true if the argument is false. number()
Syntax: number number (object?) See also: string (), boolean (), format-number (),
Converts the argument to a number; if no argument is given, returns the numerical value of the context node. You don't usually need to use this function because values are converted to numbers automatically if they need to be numbers. position()
Syntax: number posi tion ( ) See also: last (), count (),
702 XPath Quick Reference
Returns the position of the context node amongst the list of nodes that are currentIy being looked at. Unlike the numbers generated through
roundO Syntax: number round (number) See also: floor (), cei ling ()
Rounds the argument number to the nearest integer. If the number is exacdy between two integers, then it rounds up (the same as cei ling ( )). starts-with( ) Syntax: boolean starts-with (string, string) See also: contains ( )
Returns true if the first argument string starts with the second argument string, or if the second argument string is empty, and returns false otherwise.
stringe) Syntax: string string(object?) See also: boolean ( ) , number ( )
Converts the argument to a string; if no argument is given, returns the string value of the context node. You don't normally need to use this function because values are converted to strings automatically if they need to be strings. string-Iength( ) Syntax: number string-length (string?) See also: substring ()
Returns the length of the string passed as the argument. If no argument is passed, then returns the length of the string value of the context node. substring( ) Syntax: string substring (string, number, number?) See also: substring-before (), substring-after ()
Returns a sub string of the first argument string starting from the number passed as the second argument and a number of characters long equal to the third argument number. If the third argument isn't specified, then it returns the rest of the string, to the last character. The first character in the string is numbered 1.
703 Appendix A
substring-after( ) Syntax: string substring-after (string, string) See also: substring-before (), substring ()
Retums the substring of the first argument string that occurs after the second argument string. If the second string is not contained in the first string, or if the second string is empty, then it retums an empty string.
substring-before( ) Syntax: string substring-before (string, string) See also: substring-after (), substring ()
Retums the substring of the first argument string that occurs before the second argument string. If the second string is not contained in the first string, or if the second string is empty, then it retums an empty string.
sum() Syntax: number sum(nade-set)
Retums the sum of the values of the nodes in the node set. If any of the nodes' values isn't numeric, then this function retums NaN. Ifthe node set is empty, it retums O.
system-property( ) Syntax: abject system-property (string) See also: element-available ( ), function-available ( )
Supplies information about the processor that's being used to run the stylesheet. The argument string specifies the kind of information that's retumed. There are three standard arguments:
o xsl: vers ion - the version of XSLT supported by the processor (usually 1. O in current XSLT processors)
O xsl :vendor - the name ofthe vendor ofthe XSLT processor O xsl : vendor-url - a URL for the vendor of the XSLT processor
Processors can support their own system properties. For example, MSXML supports the system property msxs 1 : ver sion which returns the version of MSXML that' s being used. translate( ) Syntax: string translate (string, string, string)
Returns the first argument string with all occurrences of the characters in the second argument string replaced by their corresponding characters in the third string. If a character in the second string doesn't have a corresponding character in the third string, then the character is deleted from the first string.
704 XPath Quick Reference true() Syntax: boolean true ( ) See also: false ( ), boolean ( )
Retums true. unparsed-entity-uri( )
Syntax: string unparsed-enti ty-uri (string)
Retums the URI of the unparsed entity whose name is passed as the argument. Unparsed entities are declared within DTDs as a way of pointing to non-XML files, but they aren't very common nowadays.
705
XSLT Quick Reference
XSLT Elements This section describes each of the XSLT 1.0 elements in alphabetical order. The syntax for each element is shown, followed by a description. Within the syntax descriptions, attributes that are attribute value templates are indicated by curly braces ( { } ) within the attribute value. Required attributes and default values are shown in bold. xsl:apply-imports Syntax:
See also:
The
The
xsl :apply-templates Syntax:
See also:
The
The nodes are processed in the order determined by the
The only templates that can match the nodes to which the processor applies templates are those whose mode attribute has the same value as the value of the mode attribute on the
The templates that are used are passed the parameters specified by the
xsl:attribute Syntax:
See also:
The
708 XSLT Quick Reference
The name of the attribute that's created is determined by its name and namespace attributes. The name attribute gives the qualified name for the attribute and the namespace attribute gives the namespace for the attribute. If the name held in the name attribute doesn't include a prefix and the namespace attribute has a value, then the generated attribute will be given a prefix generated by the XSLT processor.
If the namespace attribute is missing, then the qualified name specified by the name attribute is used to identify the namespace for the attribute - the namespace associated with the qualified name's prefix. If the qualified name doesn't have a prefix, then the attribute is in no namespace.
Both the name and namespace attributes are attribute value templates, so their values can be calculated on the fiy.
The value of the created attribute is the re suIt of processing the content of the
See also:
The
The name attribute holds the qualified name of the attribute set, by which it can be referred to later ono The
See also:
709 Appendix 8
The
xsl:choose Syntax:
See also:
The
See also:
The
See also:
The
710 XSLT Quick Reference
If the current node is an element or root node, the children of the copy are the results of processing the contents of the See also: The See also: format-number () When you use the format-number () function, the XSLT processor identifies a decimal format to use to interpret the pattern that you specify as the second argument. Ifthe format-number () function is passed three arguments, the third argument is taken as the name of a decimal format, and that decimal format is used. If the format-number () function is passed two arguments, then the default decimal format is used; if you haven't specified a default decimal format, then the XSLT processor uses one with alI attributes set to their default values. 711 Appendix B When the XSLT processor formats the number, it looks first to see if it is infinity or not a number. If it is infinity, then the XSLT processor returns the string held in the inf ini ty attribute. If it is not a number, then the XSLT processor returns the string held in the NaN attribute. If the number is a number, and not infinity, the XSLT processor has to format it according to the pattern string passed as the second argument of format-number () and the decimal format that is identified. The processor splits the pattern into a positive pattern and a negative pattern at the character held by the pattern-separator attribute, which defaults to the semicolon character (;). The minus sign is indicated by the character held by the minus-sign attribute, which defaults to the hyphen character (-), within the negative pattern. If there's no negative pattern, then it defaults to the same as the positive pattern, prefixed by the character held in the minus-sign attribute ofthe decima! format. If the pattern contains the character held by the percent attribute (which defaults to the percent character, %), then the number being formatted is multiplied by 100 prior to formatting, and that character is included as specified by the pattern. If the pattern contains the character held by the per• mille attribute (which defaults to the per-mille character, 80 or 030;), then the number being formatted is multiplied by 1000 prior to formatting, and that character is included as specified by the pattern. The remaining pattern string is interpreted to indicate how many digits should occur before and after the decimal point and if the digits should be grouped, and if so what by. Within the pattern, essential digits are indicated by the character held in the zero-digit attribute (which defaults to the zero character, O), and optional digits are indicated by the character held in the digit attribute (which defaults to the hash character, #). The decimal point is the character held in the decimal-point attribute of the decimal format (which defaults to the period character, .). Groups of digits are separated by the character held in the grouping-separator attribute (which defaults to the comma character, ,). xsl :element Syntax: See also: The Ifthe use-attribute-sets attribute is present, then the attributes held in the attribute sets named within this attribute are added to the created element. Other attributes and the content of the element are generated as the result of processing the content of the 712 XSL T Quick Reference xsl:fallback Syntax: The See also: The See also: The 713 Appendix B See also: The xsl:include Syntax: See also: The xsl:key Syntax: See also: key ( ) The The value by which each node is indexed is specified through the use attribute. The expression held in the use attribute is evaluated for each matched node. If it results in a string, number, or boolean, then that value is used to index the node. If the expression evaluates as a node set, then there are multiple entries for the matched node, one for each of the selected nodes, using the string value of each of those nodes. This enables you to access a node through multiple values using the key () function. The 714 XSL T Quick Reference xsl:message Syntax: The The The stylesheet-prefix attribute holds the prefix associated with the alias namespace within the stylesheet. The resul t-prefix attribute holds the prefix associated with the namespace that should be used instead, in the result (which is usually xsl when generating XSLT). The keyword #defaul t can be used to indicate the default (unprefixed) namespace in either attribute. xsl:number Syntax: See also: format-number (), posi tion () 715 Appendix B The By default, If you already know the number that you want, you can use the val ue attribute to specify the number directly, rather than using the number-generating aspect of The number is formatted according to the format pattern held in the format attribute. This works in a different way from the format pattern used by the format-number () function, because it's used to number integers rather than decimal numbers. The format pattern can hold any punctuation characters and placeholders that indicate where the number should be included and in what format. There are five standard placeholders: 1 for decimal numbers, a for lowercase alphabetical numbers, A for uppercase alphabetical numbers, i for lowercase Roman numbers, and I for uppercase Roman numbers. Processors can support other numbering schemas as well. The lang and letter-value attributes help the processor decide which alphabet and numbering scheme to use. If the number is large, then the digits may be grouped into groups of the size specified by the grouping• size attribute and separated by the character specified by the grouping-separator attribute. xsl :otherwise Syntax: See also: The 716 XSL T Quick Reference xsl:output Syntax: The The encoding attribute determines the character encoding used during serialization, and defaults to UTF-8 or UTF-16. The indent attrihute determines whether whitespace-only text nodes are added to the result tree in order to make it easier to read; this is yes hy default for HTML and no hy default for XML. The doctype-public and doctype-system attrihutes hold the puhlic and system identifiers for the result, which are included in a DOCTYPE declaration at the top of the generated file. When generating XML, a processor wiH add an XML declaration at the start of the output, unless the omi t-xml-declaration attrihute is present with the value yes. Even if this attrihute is present, the XML declaration wiH stiH be added if the encoding is something other than UTF-8 or UTF-16, or if the standalone attribute is present (in which case the XML declaration contains a standalone pseudo• attribute with the specified value). The cdata-section-elements attribute lists the names of elements in the result whose text content should he wrapped within CDATA sections. The 717 Appendix B See also: The See also: The See also: The 718 XSLT Quick Reference See also: The The data-type attribute determines whether the nodes are sorted by their sort key in alphabetical order (text), in numeric order (number), or in some other order supported by the implementation. The order attribute determines whether the nodes are sorted in ascending order or descending order. The lang and case-order attributes are used ifit's an alphabetical sort; the default language is determined from the system environment, while the case ordering (whether uppercase letters are sorted before lowercase letters or vice versa) is based on the language being used. If there are multiple See also: The See also: The The The extension-element-prefixes attribute lists the prefixes ofnamespaces that are used for extension elements. The exclude-result-prefixes attribute lists the prefixes ofnamespaces that shouldn't be included in the result document, which are usually those namespaces that are used in the source XML document. xsl:template Syntax: See also: The When templates are applied to a node set using Whether templates are applied or called, they can be passed parameters through the 720 XSL T Quick Reference The Ifthe disable-output-escaping attribute is specified with the value yes then the content ofthe See also: The See also: The Ifthe disable-output-escaping attribute is specified with the value yes then the value is output without special characters such as < and & being escaped with &1 t; or &. 721 Appendix B xsl:variable Syntax: See also: The The name attribute specifies the name of the variable. After declaration, the variable can be referred to within XPath expressions using this name, prefixed with the $ character. The value of the variable is determined either by the select attribute or by the contents of the See also: The See also: The The value of the parameter is determined either by the select attribute or by the contents of the XSLT Attributes There are four attributes from the XSLT namespace that can be added to any literal result element. xsl :extension-element-prefixes Syntax: See also: The xs 1 : extension -elemen t -pref ixes attribute lists the prefixes of namespaces that are being used for extension elements. This works exact1y like the extension-element-prefixes attribute on See also: The xsl : exclude-resul t-prefixes attribute lists the prefixes of namespaces that should not be included within the result tree. This works exact1y like the exclude-result-prefixes attribute on 723 Appendix B xsl:use-attribute-sets Syntax: See also: The xsl : use-attribute-sets attribute lists the names of attribute sets that contain attributes that should be added to the literal result element, in exactly the same way as the use-attribute-sets attribute works with xsl :version Syntax: See also: The xsl : vers ion attribute specifies the version of XSLT that is being used within its content (which is currently always 1. O). This attribute is required on the document element of simplified stylesheets, which have a literal result element as their document element. 724 XSlT Quick Reference 725 10015 XSLT Processors Saxon http://saxon.sou rceforge. net! o Java (and "instant" version) O 6.5.1 supports XSLT 1.0/1.1 O 7.0 has limited support for XSLT 2.0 O lots of extension elements and functions O supports user-defined extension functions in XSLT andJava O supports TrAX GAXP 1.1 conformant) Xalan-J http://xml.apache.org/xalan-j/ O Java O current version 2.3.1 O several extension elements and functions O supports user-defined extension functions through Bean Scripting Framework O supports TrAX GAXP 1.1 conformant) Appendix C MSXML http://msdn.microsoft.com/xml o C++ o MSXML3 supports XSLT 1.0 (and WD-xsl) O MSXML4 supports XSLT 1.0 and XML Schema (adds some extensions) O supports user-defined extension functions inJScript,JavaScript, VBScript O some extension elements and functions Other XSLT Processors O 4XSLT (Python) - http://4suite.org/ O DGXT (Java) - http://www.datapower.com/products.shtml#dgxt O EZ/X - http://www.activated.com/products/products.html O FastXML (C++) - http://www.geocities.com/fastxml/ O jd.xslt (Java) - http://www.aztecrider.com/xsltl O libxslt (C++) - http://xmlsoft.org/XSLT O Napa - http://homepage.ntlworld.com/kjjones/ O MDC-XSL (C++) - http://mdc-xsl.sourceforge.netl O OracleXSLT (Java, C, C++) - http://technet.oracle.com/tech/xml/ O Sablotron (C++) - http://www.gingerall.com/charlie/ga/xml/p_sab.xml O TransforMiiX (C++) - http://www.mozilla.org/projects/xsltl O Unicorn XSLT Processor (C++) - http://www.unicorn-enterprises.com/products_uxt.html O Xalan-C (C++) - http://xml.apache.org/xalan-c/ O xesalt (C++) - http://www.inlogix.de/products.html O XMLPartner (C++) - http://www.turbopower.com/products/xmlpartner/ O XML::XSLT (Perl) - http://xmlxslt.sourceforge.netl O XSLJIT (Java)· - http://www.xsljit.com/ O XSLTC (Java)· - http://xml.apache.org/xalan-j/xsltc_usage.html O xt (Java) - http://www.jclark.com/xml/xt.html • XSLJIT and XSLTC are both compilers rather than interpreters like the rest of the XSLT processors. They compile the XSLT stylesheet intoJava byte code, and you then run thoseJava programs over your XML documents to do the transformation. 728 Tool5 XSLT Editors Extensions to Other Editors Vis ual XSLT http://www.activestate.com/ProductsNisua.-X5LT / o plug-in for Visual Studio .NET O syntax highlighting O auto-completion O preview of the re suit of running the stylesheet (with either the System.xsl .NET component or Xalan) O browsers for navigating through the stylesheet O breakpoints in the source document or the stylesheet O te sting XPath expressions XSLAtHome http://www.vbxml.com/xslathome/ o plug-in for Macromedia's HomeSite web development tool O syntax highlighting O auto-completion O reformatting O running XSLT processors O testing XPath expressions XSlide http://www.menteith.com/xslide/ o major mode for emacs O syntax highlighting O auto-completion O processing XML files with xt and Saxon 729 Appendix C XSLT-Process http://xslt-process.sourceforge.netlindex.php o minor mode for emacs o process XML files with Saxon, Xalan, and otherJava-based XSLT processors O view the results within emacs, within a web browser, or as PDF via FOP O set breakpoints in the source or the stylesheet O watch local and global variables Mapping Tools CapeStudio http://capeclear.com/products/capestudio/ O supports mapping from value to value with tables O includes XPath editor for more complicated mappings Whitehlll O visual editor for XML to HTML transformations XMapper http://www.nalasottware.com/DOCS/Xmapper/overview.cfm O web-based mapping tool XSLWiz http://www.induslogic.com/products/products2.html O graphical "funclets" to merge or split information O supports grouping in mappings XSLerator http://www.alphaworks.ibm.com/tech/xslerator O written inJava 730 Tools Basic Editors XFlnlty Deslgner http://www.b-bop.com/products_xfinity_designer.htm o automatic generation of XPaths O integrated HTML viewer for result XL-5tyler http://www.seeburger.de/xml/ O syntax highlighting O auto-eompletion O integrated HTML viewer for result XTrans http://www.simx.com/pub/XTrans/ O syntax highlighting O built-in XPath evaluator O integrated HTML viewer for re suIt Integrated Development Environments Cooktop http://xmleverywhere.com/cooktop/ o supports transformations with a whole range of XSLT proeessors O syntax highlighting O some debugging support O ehat with other Cooktop users over the Internet Komodo http://aspn.activestate.com/ASPN/Downloads/Komodo/ O supportsJavaSeript, Perl, Python, and other languages as well as XSLT O syntax highlighting O auto-eompletion 731 Appendix C o set breakpoints in the source and stylesheet O view or change global or local variables and parameters MarrowSoft Xse/erator http://www.vbxml.com/xselerator/default. asp O syntax highlighting O auto-completion O set breakpoints in the source or stylesheet O step through XSLT instructions O view the values of variables and parameters Stylus Studio http://www.stylusstudio.com/ O syntax highlighting O auto-completion O construct simple stylesheets based on mappings O set breakpoints O step through, into, and over instructions O view the values of parameters and variables XMLOr/g/n http://www.xmlorigin.com/ O syntax highlighting O auto-completion O set breakpoints O supports processing with Xalan, MSXML 3, MSXML 4, and Napa O step through, into, and over instructions O view the values of parameters and variables O watch the results of XPath expressions 732 Tool5 XMLSpy http://www.xmlspy.com/ Q syntax highlighting Q auto-completion Q XSLT Designer (bought separately) gives a drag-and-drop interface for construction of HTML pages from an XML document XSLT Support Tool5 XPath Constructors XPath 1.0: Interactive Expression Builder http://staff.develop.com/aarons/bits/xpath-builder/ Q web or offline as a browser-based tool Q dynamically highlights the selected nodes in a source view of an XML document XPath Tester http://www.fivesight.com/downloads/xpathtester.asp Q Java-based tool (uses Xalan:J) Q displays selected nodes within an XML document displayed as a tree structure XPath Visuailzer http://www.vbxml.com/xpathvisualizer/ Q browser-based tool O evaluate any XPath expres sion (not only location paths) Q highlights the relevant nodes in a source document Q set up keys and variables XSL T Debuggers XSLDebugger http://www.vbxml.com/xsldebugger/ 733 Appendix C o integrated with XPath Visualizer o step through stylesheet, source, and result in parallel O view the values of parameters and variables XSL Trace http://www.alphaworks.ibm.com/tech/xsltrace O Java-based XSL debugger (uses Xalan:J) O step through stylesheets while viewing the source and result O set breakpoints on the source or stylesheet Zvon XSL Tracer http://www.zvon.org/xxl/XSLTracer/Output!introduction.html O Perl-based tool (uses Saxon) O step through a transformation with the stylesheet alongside either the source or the result XSL T Profilers CatchXSL http://www.xslprofiler.org/ o provides detailed profile of stylesheet performance O uses Saxon or Xalan XSL Unt http://www.nwalsh.com/xsl/xslint/ o checks stylesheets for basic omissions XSLT Test Tool http://www.netcrucible.com/xslt/xslt-tool.htm o runs stylesheets with multiple XSLT processors XSLTMark http://www.datapower.com/XSLTMark/ o provides benchmarking for XSLT processors 734 Tool5 XSLTUnit http://xsltunit.org/ Q provides unit-testing environment for XSLT Documentation Generation XSLDoc http://www.xsldoc.org/ Q generatesJavadoc-style documentation for stylesheets XSLTDoc http://grillade.griotte.com/xml/xsltdoc/xsltdoc.html Q generates an HTML page summarizing the stylesheet XSLTDoc http://www.jenitennison.com/xsltlutilities o displays explanation of stylesheet, including automatically-generated descriptions of XPaths XSLT-Enabled Browsers Antenna House XSL Formatter http://www.antennahouse.com/ O uses MSXML3 O expects transformation result to be XSL-FO Internet Explorer http://www.microsoft.com/ie o uses MSXML3.0 (lE 6.0, or lE 5.0+ if MSXML3 installed in replace mode) O expects transformation result to be HTML 735 Appendix C Mozilla http://www.mozilla.org o uses TransforMiix o expects transformation result to be HTML Netscape http://browsers. netscape .com/ o uses TransforMiix o expects transformation re suit to be HTML XSmiies http://www.xsmiles.org/ o usesJAXP-compatible processor (default Xalan) o expects transformation result to be XHTML, XSL-FO, SMIL, SVG, or XForms Server Side Support AxKit http://www.axkit.org/ o Apache module O uses Sablotron or libxslt Cocoon http://xml.apache.org/cocoon o Java servlet O usesJAXP-compatible processor (default Xalan) 736 Tools UWOBO http://www.cs.unibo.itlhelm/uwobo/ o Java servlet O uses Xalan XSQL http://otn.oracle.com/tech/xml/xdk-.Java O Java servlet over SQL database O uses Oracle's XSLT processor 737 Index A Guide to the Index The index is arranged hierarchically, in alphabetical order, with symbols preceding the letter A. Most second-Ievel entries and many third-Ievel entries also occur as first-Ievel entries. This is to ensure that users will find the information they require however they choose to search for it. accesslng start t!me example Symbols following-sibling:: axis, 282 . operator, 222 parent:: axis, 282 ! = operator, 169 selecting nodes, 281 & attrlbute value templates (contlnued) sending XML to Internet Explorer, 550 generating attribute values, 97 buUt-ln moded templates example,97 processing same node differently in different select attribute, 97 contexts, 146 generating processing instructions, 314 example of using, 146 generating XML from XHTML, 296 buUt-ln templates limitations, 97 built-in moded templates, 146 attrlbute:: axls example of using, 146 location paths, 272, 274 conditional processing, 156 step patterns, 260 matching templates to nodes, 118 attrlbutes, 723 example of using, 119 attributes using XPath, 191 select attribute, 191 test attribute, 191 changing attributes to elements, 26 c choosing between elements and attributes 52 calculatlng numeric recursive templates, 414 designing markup languages, 52 ' compared to extension functions, 416 extension attributes, 496 infinite recursion, avoiding, 414 extensions to attribute values, 491 parameters and, 414 generating attribute values, 96 cl ..s attrlbute comment() node test HTML elements, 12 testing type of node, 244 separating content and presentation, 12 using XPath to validate XML, 639 client-si de transformatlons comments advantages and disadvantages, 534 XML , 41 Antenna House Formatter, 534 comparlson operators, 697 compared to server-side transformations, 535 concat() functlon, 699 DOM,560 generating complex identifiers, 654 checking for parse errors, 562 generating XML from XHTML, 296 creating Document objects, 560 indexing using keys and XPath, 375 creating Processor objects, 567 multHevel grouping, 388 creating Template objects, 566 parsing dates and times example, 216 flags, 561 parsing durations and calculating end times example, 224 loading XML document, 562 string expressions, XPath, 215 dynamic XSLT transformations, 532, 533 concepts hand ling output, 571 compared to properties, 52 continuing processing, 571 replacing part of page, 571 condltlonal processlng, XSL T, 153 Internet Explorer, 534 ancestor nodes, using in processing, 155 Mozilla, 534 attributes, testing for, 165 MSXML, 73, 559 example, 166 location paths, 165 Netscape, 534 built-in templates, using in processing, 156 script for transformations, 534 MSXML, 560 elements, testing for location paths, 161 using parameters in stylesheets, 572 example, 573 introduction, 153 xml-stylesheet processing instruction and, 534 moded templates, using in processing, 156 MSXML,559 example, 158 transforming XML by Internet Explorer, 552 optional elements, processing, 154 XSmiles, 534 example, 157 closepath command, SVG, 595 values, comparing, 168 combining functions and operators, 178 Cocoon comparing node sets and values, 170 configuring, 541 example, 171, 174, 177, 179 creating sul>-sitemap, 545 testing string contents, 176 defining components, 542 testing strings and numbers, 173 defining pipelines, 543 XPath functions, 172 content type Informatlon, declarlng MSXML,518 742 dynamic XSLT transformations default declmal format, 227 relative URLs, resolving, 473, 474 default namespace returns root nodes, 455 literal result elements, 298 transforming RSS into XML, 687, 689 matching elements in namespaces, 269 document, numberlng across, 355 example, 269 footnotes, 355 namespace declarations, 82, 247 document-orlented XML stroke attribute, 593 E stroke-width attribute, 593 Elllpticai arcs element nodes, 108 font-style attrlbute namespace-uri() function, 247, 642, 702