how would you determine if the string
appears within the first 100 or last
100 non tag-based characters of the
document?
In the absence of any definition of "non-tag-based characters, I assume these are any characters of the string value of the document: string(/)
.
Therefore:
contains(substring(/,1,100),'my search phrase')
returns true()
exactly when the first 100 characters of the string value of the document contain the string 'my search phrase'
.
Similarly:
contains(substring(/, string-length(/)-99),'my search phrase')
returns true()
exactly when the last 100 characters of the string value of the document contain the string 'my search phrase'
.
Therefore:
contains(substring(/,1,100),'my search phrase')
or
contains(substring(/, string-length(/)-99),'my search phrase')
returns true()
exactly when the first or last 100 characters of the string value of the document contain the string 'my search phrase'
.