This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: What do we have in variable?


Roma Yankin wrote:
> I'm just trying to understand, whenever we initialize some variable for
> example in that way <xsl:variable name="somevar" select="ancestor::*"/>
> what do we have stored inside it? Is it an array or some root node?

In this case, an unordered collection of nodes (most likely, all the element
nodes that are ancestors of the current node): a "node-set".

The XPath spec explains that there are 4 basic types of objects:
  boolean, number, string, node-set.

XSLT 1.0 adds one more:
  result tree fragment.  (a special type of node-set).

When you create a variable, you are naming an object, and possibly creating
the object at the same time, if it didn't already exist. The variable isn't
really a container, it is a binding of a name to an object, and the object is
one of those 5 types listed above.

The binding of the name to the object is permanent (you can't modify the 
object or the name), but its scope is limited to only certain places in the 
stylesheet.

   - Mike
____________________________________________________________________________
  mike j. brown                   |  xml/xslt: http://skew.org/xml/
  denver/boulder, colorado, usa   |  resume: http://skew.org/~mike/resume/

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]