2017 © Pedro Peláez
 

library css2xpath

PHP Library to translate CSS selectors into XPath

image

theseer/css2xpath

PHP Library to translate CSS selectors into XPath

  • Tuesday, October 31, 2017
  • by theseer
  • Repository
  • 0 Watchers
  • 1 Stars
  • 1,574 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 1 Forks
  • 0 Open issues
  • 3 Versions
  • 15 % Grown

The README.md

CSS2XPath

This is yet another library to translate various CSS selectors to their XPath equivalent., (*1)

Build Status Latest Stable Version, (*2)

Example


$translator = new TheSeer\CSS2XPath\Translator(); // Will output //*[contains(concat(" ",normalize-space(@class)," ")," note ")] echo $translator->translate('.note'); // Will output //*[@id="me"] echo $translator->translate('#me');

Installation

You can add this library as a local, per-project dependency to your project using Composer:, (*3)

composer require theseer/css2xpath

Selectors supported

The following selectors are currently covered:, (*4)

  • #id
  • tag#id
  • tag #id
  • tag
  • tag tag
  • tag > tag
  • tag + tag
  • tag ~ tag
  • tag, tag
  • .classname
  • tag.classname
  • tag .classname
  • tag.classname, tag.classname
  • tag.classname tag.classname
  • tag.classname > tag.classname
  • tag#id + tag > tag
  • tag[id]:contains(Selectors)
  • tag[attribute][attribute]
  • tag[attribute]
  • tag[attribute=example]
  • tag[attribute^=exa]
  • tag[class$=mple]
  • tag[attribute*=e]
  • tag[attribute|=dialog]
  • tag[attribute!=made_up]
  • tag[attribute!="made_up"]
  • tag[attribute~=example]
  • tag:not(.classname)
  • tag:contains(selectors)
  • tag:nth-child(n)
  • tag:nth-child(even)
  • tag:nth-child(odd)
  • tag:nth-child(3n+8)
  • tag:nth-child(2n+1)
  • tag:nth-child(3)
  • tag:nth-child(4n)
  • tag:only-child
  • tag:last-child
  • tag:first-child
  • foo|bar
  • tag[attribute^=exa][attribute$=mple]
  • tag:enabled
  • tag:checked
  • tag:disabled
  • :empty
  • :root

The Versions

31/10 2017

dev-master

9999999-dev

PHP Library to translate CSS selectors into XPath

  Sources   Download

BSD-3-Clause

The Requires

  • php ^7.0

 

by Arne Blankerts

31/10 2017

1.1.0

1.1.0.0

PHP Library to translate CSS selectors into XPath

  Sources   Download

BSD-3-Clause

The Requires

  • php ^7.0

 

by Arne Blankerts

29/10 2017

1.0.0

1.0.0.0

PHP Library to translate CSS selectors into XPath

  Sources   Download

BSD-3-Clause

The Requires

  • php ^7.0

 

by Arne Blankerts