escaping a single quote in a predicate expression
  • I am filtering shop items by their option 'size' value, and this is working great except when size = Women's

    The single quote breaks everything. I have been Googling for XPATH single quote escape, but haven't come up with much. The only thing that seems to work is using the concat() function which isn't available in Vae.

    Has anyone come across this issue before?

    This works fine:

    <v:collection path="products[options/size='Women's']>

    But then I would need to manually escape the single quote in the backend, which you just can't expect a client to do.

    Any help would be much appreciated. Thanks!

  • 1 Answer sorted by
  • The ' is the right way to do it. How are these values getting in there? PHP? If PHP, you can just do a htmlspecialchars() call and I believe that will add the ' properly. If it's a variable, it should be automatically added.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Sign In Apply for Membership

In this Discussion