Skip to content

Commit

Permalink
Update variable resolvers.md
Browse files Browse the repository at this point in the history
  • Loading branch information
JLRishe authored Jan 1, 2021
1 parent a29b9c6 commit 26411e4
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions docs/variable resolvers.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,14 @@ A plain object with variable names as the keys and variable values as the values

Example usage:

````
````javascript
var evaluator = xpath.parse('concat($character1, ", ", $character2, ", and ", $character3)');
var mainCharacters = evaluator.evaluateString({
variables: {
character1: 'Harry',
variables: {
character1: 'Harry',
character2: 'Ron',
character3: 'Hermione'
}
}
});
````

Expand All @@ -43,18 +43,18 @@ and returns a value based on the name and namespace.

Example usage:

````
````javascript
var evaluator = xpath.parse('concat($hp:character1, ", ", $hp:character2, ", and ", $hp:character3)');
var mainCharacters = evaluator.evaluateString({
variables: function (name, namespace) {
variables: function (name, namespace) {
if (namespace === 'http://sample.org/harrypotter/') {
switch (name) {
case 'character1': return 'Harry';
case 'character2': return 'Ron';
case 'character3': return 'Hermione';
}
}
},
},
namespaces: {
hp: 'http://sample.org/harrypotter/'
}
Expand All @@ -68,10 +68,10 @@ described above.

Example usage:

````
````javascript
var evaluator = xpath.parse('concat($hp:character1, ", ", $hp:character2, ", and ", $hp:character3)');
var mainCharacters = evaluator.evaluateString({
variables: {
variables: {
getVariable: function (name, namespace) {
if (namespace === 'http://sample.org/harrypotter/') {
switch (name) {
Expand All @@ -80,7 +80,7 @@ var mainCharacters = evaluator.evaluateString({
case 'character3': return 'Hermione';
}
}
}
}
},
namespaces: {
hp: 'http://sample.org/harrypotter/'
Expand Down

0 comments on commit 26411e4

Please sign in to comment.