1 | <?php |
||
15 | abstract class IRProcessor |
||
16 | { |
||
17 | /** |
||
18 | * XSL namespace |
||
19 | */ |
||
20 | const XMLNS_XSL = 'http://www.w3.org/1999/XSL/Transform'; |
||
21 | |||
22 | /** |
||
23 | * @var DOMXPath |
||
24 | */ |
||
25 | protected $xpath; |
||
26 | |||
27 | /** |
||
28 | * Create and append an element to given node in the IR |
||
29 | * |
||
30 | * @param DOMElement $parentNode Parent node of the element |
||
31 | * @param string $name Tag name of the element |
||
32 | * @param string $value Value of the element |
||
33 | * @return DOMElement The created element |
||
34 | */ |
||
35 | protected function appendElement(DOMElement $parentNode, $name, $value = '') |
||
39 | |||
40 | /** |
||
41 | * Create and store an instance of DOMXPath for given document |
||
42 | * |
||
43 | * @param DOMDocument $dom |
||
44 | * @return void |
||
45 | */ |
||
46 | protected function createXPath(DOMDocument $dom) |
||
50 | |||
51 | /** |
||
52 | * Evaluate an XPath expression and return its result |
||
53 | * |
||
54 | * @param string $expr XPath expression |
||
55 | * @param DOMNode $node Context node |
||
56 | * @return mixed |
||
57 | */ |
||
58 | protected function evaluate($expr, DOMNode $node = null) |
||
62 | |||
63 | /** |
||
64 | * Run an XPath query and return its result |
||
65 | * |
||
66 | * @param string $query XPath query |
||
67 | * @param DOMNode $node Context node |
||
68 | * @return \DOMNodeList |
||
69 | */ |
||
70 | protected function query($query, DOMNode $node = null) |
||
74 | } |