jQuery-like selectors for PHP DOMDocument

I’m working with a DOMDocument, and I’m wondering if there exists some way of using CSS-like selectors to select nodes like we would in jQuery.

Example situation: I’m parsing an XML file, one snippet of which looks like this:

<gesmes:Envelope>
    <gesmes:subject>Reference rates</gesmes:subject>
    <gesmes:Sender>
        <gesmes:name>European Central Bank</gesmes:name>
    </gesmes:Sender>
    <Cube>
        <Cube time="2009-07-13">
            <Cube currency="USD" rate="1.3975"/>
            <Cube currency="JPY" rate="129.03"/>
            <Cube currency="BGN" rate="1.9558"/>
            <Cube currency="CZK" rate="26.028"/>
        </Cube>
    </Cube>
</gesmes:Envelope>

Accessing this structure with jQuery-like selectors would be dead simple. For example, I could use

$("Cube[currency]")

to retrieve all the Cube elements with the ‘currency’ attribute.

But how can I do the same thing with PHP’s DOMDocument? I’d like to select elements which have an attribute, or have a particular attribute value.

jQuery-like selectors for PHP DOMDocument