${contents()}
Reads the resource at the specified location and returns the contents as a
String.
| Name | XPath | Description | Reagent Type | Expected Type | Required |
|---|---|---|---|---|---|
| CONTEXT | @context | Optional context from which missing elements of the LOCATION will be inferred if it is relative. The default is the value of the 'Attributes.CONTEXT' request attribute (if present) or the directory from which Java is executing (otherwise). | PHRASE | java.lang.String | No |
| LOCATION | descendant-or-self::text() | Optional location of a resource; if omitted, the value of the 'Attributes.LOCATION' request attribute will be used. LOCATION may be a filesystem path or a URL, and may be absolute or relative; if a relative value is provided, it will be resolved based on the value of CONTEXT. | PHRASE | java.lang.String | No |
Reads the file 'example.txt' into a String, replaces all instances of 'foo' with 'bar' and all instances of 'abc' with 'xyz' in the text, then writes the result back to 'example.txt':