saxon-xslt
saxon-xslt copied to clipboard
Implement convenient API for reading contents, attrs out of Saxon nodes.
Currently, the only part of Nokogiri's actual "interact with the processed XML" that is supported is XPath. Everything else is still raw Saxon. I was thinking that it would be nice to support, say:
node = my_doc.xpath('//something/that/pulls/at/least/one/node').first
node['my_attr'] # attr value as string
node.content # text content of el and subels
node.xml # string rep of fragment consisting of nodes.
I'm not sure of the right way to go about it - easiest way (at least for attrs and content on individual nodes) would be monkey-patching XdmNode, and maybe the Saxon sequence type. Since monkey-patches on Java objects don't propagate back into Java-land, and there's fairly little overlap between the Saxon API and the Noko-lite style stuff I'd want to implement, I think this might actually be reasonable?