[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: are all strings in a sequence valid potential QNam
At 2010-02-04 10:24 +0000, Andrew Welch wrote:
On 4 February 2010 09:53, G. Ken Holman <gkholman@xxxxxxxxxxxxxxxxxxxx> wrote: But thinking about it, perhaps it isn't all that bizarre at all, Andrew ... consider the following: T:\ftemp>type ken2.xsl <?xml version="1.0" encoding="US-ASCII"?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xsd="http://www.w3.org/2001/XMLSchema" version="2.0"> <xsl:output method="text"/> <xsl:template match="/"> 'abcdef': <xsl:value-of select="'abcdef' castable as xsd:QName"/> 'abc:def': <xsl:value-of select="'abc:def' castable as xsd:QName"/> 'xsd:def': <xsl:value-of select="'xsd:def' castable as xsd:QName"/> </xsl:template> </xsl:stylesheet> T:\ftemp>xslt2 ken2.xsl ken2.xsl 'abcdef': true 'abc:def': false 'xsd:def': true T:\ftemp> The second string being cast above is obliged to return false() because there is no prefix binding for 'abc'. Remember that QNames have a different value space from the lexical space. The lexical space is the prefix and local name but the value space is the URI and the local name. In my illustration above, the first and third literal strings can be converted to QNames because the lack of prefix and the prefix are both acceptable in generating the URI for the value space for the casted value. But the second literal string is obliged to return false because there is no bound URI with which to satisfy the value space. Now consider a string variable: the string is in the lexical space for the QName, but without an indication of which node to base the value space evaluation for the given string, it is impossible to create a complete QName value. And there is no opportunity in the syntax of "castable as" to supply a second input operand being the context node for the evaluation of the value-space for the given lexical string. So the restriction is not in any way artificial. I hope this is considered helpful and not pedantic. . . . . . . . . . . . . . Ken -- XSLT/XQuery/XPath training after http://XMLPrague.cz 2010-03-15/19 XSLT/XQuery/XPath training: San Carlos, California 2010-04-26/30 Vote for your XML training: http://www.CraneSoftwrights.com/s/i/ Crane Softwrights Ltd. http://www.CraneSoftwrights.com/s/ Training tools: Comprehensive interactive XSLT/XPath 1.0/2.0 video Video lesson: http://www.youtube.com/watch?v=PrNjJCh7Ppg&fmt=18 Video overview: http://www.youtube.com/watch?v=VTiodiij6gE&fmt=18 G. Ken Holman mailto:gkholman@xxxxxxxxxxxxxxxxxxxx Male Cancer Awareness Nov'07 http://www.CraneSoftwrights.com/s/bc Legal business disclaimers: http://www.CraneSoftwrights.com/legal
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|