cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

String functions in savetext or usetext?

cleccese
5-Regular Member

String functions in savetext or usetext?

I want to check the first character of a #CONTENT savetext for a parenthesis "(" and if it exists, strip it out.


an xpath condition test starts-with(self::text(), '(') didn't work.


And these didn't work in a conrule:


substring(#CONTENT,2) or substr(#CONTENT,2)


Can you put an XPATH expression in a conrule?


(Styler 5.3)


Thanks!

3 REPLIES 3

Hi Caroline,

You can put XPath expressions in a savetext conrule or usetext source, as described in the attached xpath.pdf.

You can call ACL functions using SYSTEM-FUNC, as described in the attached system-func.pdf. In addition to the substr function, I think you'll need the match function.

Hope this helps!

Good luck!
Suzanne Napolon
www.FOSIexpert.com
"WYSIWYG is last-century technology!"


Regarding the first part of your question, try "starts-with(., '(')",
instead.  The "self::text()" expression would only work if you were
evaluating the XPath in the context of a text node in your document,
which would never be the case in a FOSI, since an e-i-c can only match
elements or PIs.

-Brandon 🙂


On Mon, Mar 19, 2012 at 11:42 PM, Caroline Leccese
<caroline@thecodesource.net> wrote:
> I want to check the first character of a #CONTENT savetext for a parenthesis
> "(" and if it exists, strip it out.
>
> an xpath condition test starts-with(self::text(), '(') didn't work.
>
> And these didn't work in a conrule:
>
> substring(#CONTENT,2) or substr(#CONTENT,2)
>
> Can you put an XPATH expression in a conrule?
>
> (Styler 5.3)
>
> Thanks!
>
>
> ----------

Thank you, Suzanne and Brandon!

Announcements