Strings

Previous Next

USoft Blend  >  Expressions  >  XPath  >  Strings

 

String, in the simplest sense of a string of Unicode characters, is one of the (4) primitive data types that an XPath expression can evaluate to. It is the only string data type that XPath has.

Explicit string typing

In contexts where an XPath expression is expected, you can surround an XPath expression by quotes to express that you mean a string and not a node set expression (ie., not a node test). The following yields the string 'xy' independently of context:

<pc:value-of select="'xy'" />

Accordingly, you must quote literal string input parameters that you pass to XPath functions and Blend functions, since these function calls are just another type of XPath expression:

<pc:assign-nodeset mynodeset="{files:XmlFile('config.xml')}" />

Regular XML attribute values

Do not confuse XPath string expressions with regular XML attribute values that are string literals. The latter are XML names. In this example, the 'ADMIN' string is a regular XML attribute value, and therefore is not quoted:

<pc:assign-string user="ADMIN" />

In this example, the SQL statement is a regular XML attribute, and therefore is not quoted. As a consequence, the quotes inside the SQL do not need to be escaped:

<pc:XmlExport sql="SELECT destination, tour_type FROM tour WHERE destination LIKE 'AUS%'" />

In this example, the file path is a regular XML attribute, and therefore is not quoted:

<pc:WriteFile filepath="c:\temp\HelloWorld.txt">Hello world</pc:WriteFile>

 

See also

Guide to expressions and data types

          Literal expressions

                 Dates

                 string literals

          Path expressions

          XML expressions

          XPath expressions

                 Node set expressions

                 Booleans

                 Strings

                 Numbers

                 Function calls

                 Variable references

                 Implicit XPath data type conversion

                 Evaluated expressions vs. literals

          SQL expressions