Using PHP, I have transformed an XML document using XSLTProcessor::transformToDoc()
into another XML document (of type DOMDocument
.)
I want to call getElementById()
on this resulting DOMDocument
, but it does not know which attribute to look at. It seems I have to tell it somehow that the "id" attribute is the one containing each element's ID.
I can't see how to do this however. I don't have a DTD so I can't call DOMDocument::validate()
, I can't set DOMDocument::validateOnParse
as the DOMDocument
instance doesn't exist until the transform has been completed and by then it's too late, and I can't call DOMElement::setIdAttribute()
because I would have to manually run through every single element to do this.
Is there any way to easily be able to call getElementById()
on the output of an XSLT transform, in PHP?