Re: [xsl] are all strings in a sequence valid potential QNames

Subject: Re: [xsl] are all strings in a sequence valid potential QNames
From: "G. Ken Holman" <gkholman@xxxxxxxxxxxxxxxxxxxx>
Date: Thu, 04 Feb 2010 10:37:20 +0100
At 2010-02-04 09:29 +0000, Andrew Welch wrote:
>> Could you do a  fn:prefix-from-QName($x) = fn:in-scope-prefixes(.)
>> check before doing the castable as check?
> Nope:
>  "[if] the input argument of the expression is of type xs:string but it is
>   not a literal string, the result of the castable expression is false."

To help me understand that :-)

Not a problem, Andrew ... I get asked about this terminology in the classroom.

can you provide an example of a user
constructed string that is not a string literal?

For example, tokenizing a string into a sequence of strings... they
are all string literals aren't they?

Nope ... a string literal is "literally a string in the stylesheet" written with string delimiters. The term "literal" here is in reference to the XPath written syntax.

A sequence of strings is just that: a sequence of string values in memory.

A literal string in the stylesheet is just that: a string value literally delimited in the stylesheet. See production 74 of the XPath syntax:

The difference is a syntax issue: a string literal is a type of primary expression (production 41) written in the stylesheet syntax and it is the way to represent a string value in the XPath syntax different from the representations of other literal values.

I hope that clarifies the distinction.

. . . . . . . . . . Ken

-- XSLT/XQuery/XPath training after 2010-03-15/19 XSLT/XQuery/XPath training: San Carlos, California 2010-04-26/30 Vote for your XML training: Crane Softwrights Ltd. Training tools: Comprehensive interactive XSLT/XPath 1.0/2.0 video Video lesson: Video overview: G. Ken Holman mailto:gkholman@xxxxxxxxxxxxxxxxxxxx Male Cancer Awareness Nov'07 Legal business disclaimers:

Current Thread