xsl-list
[Top] [All Lists]

Re: Answers to review questions in "Beginning XSLT": Chapter 6

2003-03-12 22:55:41
Lars Huttar wrote:
1. What are the four types of values that XPath expressions can evaluate to,
   and what fifth value type is used in XSLT?

Answer:
XPath expressions can evaluate to numbers, strings, boolean, and node sets.
Result tree fragments are also used in XSLT.

Not clearly expressed in XPath 1.0 is the possibility of an "external type"
being bound to a variable or returned by an extension function. How such types
are handled is processor dependent. Result tree fragments are one such type,
but the XSLT spec clarifies how they are to be handled by an XSLT processor.

3. What is the difference between <xsl:copy-of> and <xsl:value-of>?

Answer:
The difference is that the latter gives the string value of its select
expression, which in the case of a RTF or node-set would be simply the
text in the text nodes [...]

The string-value of a node-set is the string-value of only the first node in
the set.

The string-value of a node depends on what type of node it is:
  element: concatenation of text from all descendant text nodes
  attribute: attribute value
  text: the text
  comment: comment text
  processing instruction: instruction part (text after the target)
  namespace: namespace URI


Mike

-- 
  Mike J. Brown   |  http://skew.org/~mike/resume/
  Denver, CO, USA |  http://skew.org/xml/

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