Skip to main content
1-Visitor
March 20, 2012
Question

String functions in savetext or usetext?

  • March 20, 2012
  • 3 replies
  • 1235 views

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

    1-Visitor
    March 20, 2012
    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!"


    1-Visitor
    March 20, 2012
    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!
    >
    >
    > ----------
    cleccese1-VisitorAuthor
    1-Visitor
    March 20, 2012

    Thank you, Suzanne and Brandon!