Subject: [xsl] wanting to clarify some string functions and string value From: "Robert P. J. Day" <rpjday@xxxxxxxxxxxxxx> Date: Tue, 27 May 2003 08:46:49 -0400 (EDT) |
a fairly simple question, but i offered to give a short tutorial on XSL to a local group (the blind leading the blind, as it were), so i just wanted to clarify one issue. in many of the XSL books/tutorials i've seen, there are numerous examples of string functions that involve the current node, as in //element[contains(., "fred")] or //element[starts-with(., "abc")] in examples like this, i'm assuming that "." can be rewritten in the long form, with either of: self::node() self::* although i suspect the former is used more widely. in addition, using the current node reference in a string function context is implying that the string() function is being used so, once again, i could rewrite this even more verbosely with any of: //element[contains(string(.), "fred")] //element[contains(string(self::node()), "fred")] and so on. yes, i realize it's painful, but i just wanted to verify that it was equivalent. the last point is one that seems to be glossed over a lot, and that is that the string value of a node is defined as the concatenation of all text nodes within the scope of the element's start and end tags. all the examples i've seen invariably show a really simple example involving a node with no child elements, so the string value is obvious. but the authors rarely seem to warn about cases where the self node() might contain multiple descendant text nodes, which will all contribute to the eventual string value of the current node, right? so just writing //element[contains(., "fred")] has to take into account any descendant text nodes as well, yes? rday XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] ampersand fun, David Carlisle | Thread | RE: [xsl] wanting to clarify some s, Jarno . Elovirta |
[xsl] ampersand fun, Martin Lampen | Date | Re: [xsl] Background color in table, G. Ken Holman |
Month |