Page 5 | An XSL processors parses an Surf source and tries to find a matching template rule. If it does, instructions inside matching template are evaluated. |
Page 6 | Parts of Surf document to which template should be applied are determined by location paths. The required syntax is specified in the XPath specification. Simple cases looks very similar to filesystem addressing. ( this stylesheet ) |
Page 7 | Processing always starts with the template match="/". This matches the root node (the node its only element child is the document element, in our case "source"). Many stylesheets do not contain this element explicitly. When this template is not explicitly given, the implicit template is used (it contains as the sole instruction). This instruction means: process all children of the current node, including text nodes. Compare this stylesheet and this stylesheet. When a template for the node exists, there is no default processing invoked ( this stylesheet ). If you want to include descendants of the node, you have to explicitly request their templates ( this stylesheet ). |
Page 8 | A template can match from a selection of location paths, individual paths being separated with "|" ( this stylesheet ). Wildcard "*" selects all possibilities. Compare this stylesheet with this stylesheet. |
Page 9 | "//" is very common in location paths. When it is used at the beginning of a location path, it means: select all nodes in the document of the specified type ( this stylesheet ). In the middle of a location path it means: select all nodes which appear in the node selected with the first part of the location path ( this stylesheet ). |
Page 10 | With modes an element can be processed multiple times, each time producing a different result. In this stylesheet one of the modes does not exist. |
Page 11 | Quite often several templates match the same element in Surf source. It must be therefore decided which one should be used. This priority order can be specified with the priority attributte. If this attribute is not specified, its priority is calculated according to several rules. this stylesheet and this stylesheet differ by priority of their templates. this stylesheet shows the default action in the absence of priority attributes. Template CCC has lower priority than CCC/CCC, as it is less specific. Compare this stylesheet and this stylesheet. Template CCC has lower priority than both CCC/CCC or AAA/CCC/CCC, but the latest two have the same priority. In such a case an XSLT processor may signal the error; if it does not signal an error, it must recover by choosing, from amongst the matching template rules that are left, the one that occurs last in the stylesheet. In this stylesheet less specific "*" has lower priority than CCC. Computed priorities ranges from -0.5 to 0.5. XSLT specification gives more details. |
Page 32 | this stylesheet and this stylesheet demonstrate different ways of setting xsl:variable, this stylesheet and this stylesheet of setting xsl:param. |
Page 33 | A stylesheet can contain several variables of the same name. this stylesheet demonstrates a way how to recover the value of global variable which has the same name as a local one. The this stylesheet demonstrates an incorrect approach. The value of local variable is bounded to xsl:when element. The rest of template therefore sees only the global variable. |
Page 34 | Parameters for a template can be passed with xsl:with-param element. If the template contains a xsl:param element with the same name as name attribute of xsl:with-param, this value is used. this stylesheet shows a typical example. If you want to pass a variable, you have to define this variable with xsl:param element. Look at this stylesheet for wrong approach. |
Page 35 | A variable can hold a result tree fragment. The operations permitted on a result tree fragment are a subset of those permitted on a node-set. An operation is permitted on a result tree fragment only if that operation would be permitted on a string (the operation on the string may involve first converting the string to a number or boolean). In particular, it is not permitted to use the /, //, and [] operators on result tree fragments. When a permitted operation is performed on a result tree fragment, it is performed exactly as it would be on the equivalent node-set. Compare this stylesheet and this stylesheet. |
Page 36 | There is an important difference in variable value specification. |
Page 37 | Functions number transforms its argument into a number. this stylesheet demonstrates string conversion, this stylesheetConversion of boolean values true and false. |
Page 38 | Addition, subtraction and multiplication uses common syntax ( this stylesheet ). Division syntax is less usual. Slash / is used in patterns and so keyword div is used instead ( this stylesheet ).Operator mod returns the remainder from a truncating division. ( this stylesheet ) |
Page 39 | Function sum() sums all numbers in selected nodes. this stylesheet sums all numbers, this stylesheet only odd ones. |
Page 40 | Functions ceilng(), floor() and round() transform floating point numbers into integers in the specified way. |
Page 41 | Function string() transforms its argument into string. This function is not usualy directly used in stylesheets as it is in most cases called by default. this stylesheet shows examples of number to string conversions. Notice results of zero divisions. |
Page 42 | Test, if element value is a number |
Page 43 | In this stylesheet strings are arguments of boolean() function. A string is true if and only if its length is non-zero. In this stylesheet is text transformed into numbers and then subjected to boolean() function. this stylesheetCompares "0" as a string and as a number. this stylesheet uses node-sets as arguments for boolean() function. |
Page 44 | The not function returns true if its argument is false, and false otherwise. |
Page 45 | Functions true() and false() are useful, when some conditions are tested during programming. |
Page 46 | The lang function returns true or false depending on whether the language of the context node as specified by Surf:lang attributes is the same as or is a sublanguage of the language specified by the argument string. The language of the context node is determined by the value of the Surf:lang attribute on the context node, or, if the context node has no Surf:lang attribute, by the value of the Surf:lang attribute on the nearest ancestor of the context node that has an Surf:lang attribute. If there is no such attribute, then lang returns false. If there is such an attribute, then lang returns true if the attribute value is equal to the argument ignoring case, or if there is some suffix starting with - such that the attribute value is equal to the argument ignoring that suffix of the attribute value and ignoring case. |
Page 47 | Function string() transforms its argument into string. This function is not usualy directly used in stylesheets as it is in most cases called by default. this stylesheet shows examples of number to string conversions. Notice results of zero divisions. |
Page 48 | The concat function returns the concatenation of its arguments. |
Page 49 | The starts-with function returns true if the first argument string starts with the second argument string, and otherwise returns false. The contains function returns true if the first argument string contains the second argument string, and otherwise returns false. |
Page 50 | The substring-before function returns the substring of the first argument string that precedes and the substring-after function that follows the first occurrence of the second argument string in the first argument string. The substring function returns the substring of the first argument starting at the position specified in the second argument with length specified in the third argument. If the third argument is not specified, it returns the substring starting at the position specified in the second argument and continuing to the end of the string.Counting starts with 1. ( this stylesheet ). this stylesheet demonstrates a situation where some arguments are out of range or they are not integrals. The returned substring contains those characters for which the position of the character is greater than or equal to the second argument and, if the third argument is specified, less than the sum of the second and third arguments. |
Page 51 | The string-length function returns the number of characters in the string. The normalize-space function returns the argument string with white space normalized by stripping leading and trailing whitespace and replacing sequences of whitespace characters by a single space. |
Page 52 | The translate function returns the first argument string with occurrences of characters in the second argument string replaced by the character at the corresponding position in the third argument string. If a character occurs more than once in second argument string, then the first occurrence determines the replacement character. If the third argument string is longer than the second argument string, then excess characters are ignored. |
Page 58 | The xsl:output element allows stylesheet authors to specify how they wish the result tree to be output. If an XSLT processor outputs the result tree, it should do so as specified by the xsl:output element; however, it is not required to do so. The xsl:output element is only allowed as a top-level element. this stylesheet outputs as html and this stylesheet as Surf. Compare how empty tags are outputed. |
Page 59 | In the absence of Surf:output element the default output method is Surf ( this stylesheet ), but if document element of the output has value html (case insensitive) and it doesn't have an 'xmlns' attribute, then html method is used ( this stylesheet ). |
Page 60 | The html output method should not output an end-tag for empty elements specified in HTML specification.The html output method should not perform escaping for the content of the script and style elements (look at source of the lowest middle window in your browser). Compare with this stylesheet and consult XSLT specification for more details. |
Page 61 | The encoding attribute specifies the preferred encoding to be used. The html output method should add a META element immediately after the start-tag of the HEAD element specifying the character encoding actually used. this stylesheet outputs in UTF-8, this stylesheet in UTF-16, and this stylesheet in Cp1250. In this stylesheet look at the source of the lowest middle window in your browser. The Surf source contains characters which are not present in specified character set and they are therefore escaped. |
Page 62 | The text output method outputs the result tree by outputting the string-value of every text node in the result tree in document order without any escaping. Look at the source in your browser to see the output. |
Take a moment to visit 1cecilia448 or see them on twitter at
1cecilia448 or view them on facebook at 1cecilia448.
Now if you are looking for the best deals on surf clothing from Quiksilver and Roxy then you have to check these amazing deals here: