[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

RE: [xsl] Comparing node for identity using union


Subject: RE: [xsl] Comparing node for identity using union
From: Wendell Piez <wapiez@xxxxxxxxxxxxxxxx>
Date: Wed, 19 Jan 2005 18:10:12 -0500

Jim and fellow Neos,

For XSLT 1.0, *the* place to look is at the XPath 1.0 Recommendation. (In addition to learning from the fine words on this list.) http://www.w3.org ...

A synopsis:
Five (or four and a half) data types:
  Boolean
  Number (including NaN)
  String
  Node-set
  Result tree fragment
    Result tree fragments may be generated and copied or processed as strings,
    but may not be traversed as if they were node-sets

In XPath 1.0, implicit casting rules provide for dynamic casting of these types to one another; for example, in a string processing context a number can be automatically cast ("coerced") to a string. Functions also operate on different data types, sometimes differently depending on the type provided. (For example, document($doc) when doc is a string or node set.) The rules for how this happens are documented in the Rec.

Node types:
  root
  elements
  attributes
  text nodes
  comments
  processing instructions
  namespaces

Every node in a source tree has a string value, which is often used in operations on that node when a string is called for. It is defined differently for the different types of nodes. (For example, the string value of a text node is the text as a string; the string value of an element node is the concatenation of the string values of all its text node descendants.) These rules are also not hard to learn.

For the most part, since this casting happens implicitly you only have to think about types when things get gnarly -- which they sometimes do.

Mike just told the XSLT 2.0 story....

Regards,
Wendell

At 09:03 AM 1/19/2005, you wrote:
This might be a good time for one of the gurus on this list to briefly
explain data-types in XSLT for us n00bs.

___&&__&_&___&_&__&&&__&_&__&__&&____&&_&___&__&_&&_____&__&__&&_____&_&&_
"Thus I make my own use of the telegraph, without consulting
the directors, like the sparrows, which I perceive use it
extensively for a perch." -- Thoreau



Current Thread
Keywords