{"id":220,"date":"2007-12-31T00:39:43","date_gmt":"2007-12-31T07:39:43","guid":{"rendered":"https:\/\/dubinko.info\/blog\/2007\/12\/31\/xpath-puzzler-solution\/"},"modified":"2007-12-31T00:39:43","modified_gmt":"2007-12-31T07:39:43","slug":"xpath-puzzler-solution","status":"publish","type":"post","link":"https:\/\/dubinko.info\/blog\/2007\/12\/xpath-puzzler-solution\/","title":{"rendered":"XPath puzzler: solution"},"content":{"rendered":"<p>Thanks to all the folks who showed interest in this little <a href=\"https:\/\/dubinko.info\/blog\/2007\/12\/15\/xpath-puzzler\/\" title=\"XPath puzzler\">XPath puzzler<\/a> published here a few weeks ago. Some asked to see the dataset, but I&#8217;m not able to release it at this time (but ask me again in 3 months).<\/p>\n<p>Turns out it was a combination of two bugs, one mine, one somebody else&#8217;s. Careful observers noted that I wasn&#8217;t using any namespace prefixes in the XPath, and since I did specify that it was XPath 1.0, that technically rules out XHTML as the source language. Like nearly all XML I work with these days, the first thing I do is strip off the namespaces to make it easier to work with. Bug #1 was that in a few cases, the namespaces didn&#8217;t get stripped.<\/p>\n<p>Bug #2 was in the XPath engine itself. Which one? Uh, whatever one ships with the &#8220;XPath&#8221; plugin for JEdit. It&#8217;s hard to tell directly, but I think it might be an older version of Xalan-J. In the case of the expression <code>\/\/meta<\/code>, it properly located only those elements part of no namespace. But in the case of <code>\/\/meta\/@property<\/code>, it was including all the nodes that would have been selected by <code>\/\/*[local-name(.)='meta']\/@property<\/code>. Hence, a larger number of returned nodes.<\/p>\n<p>Confusing? You bet!\u00c2\u00a0 -m<\/p>\n<p>P.S. WebPath would not have this problem, since in the default mode it matches local-names only to begin with.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Thanks to all the folks who showed interest in this little XPath puzzler published here a few weeks ago. Some asked to see the dataset, but I&#8217;m not able to release it at this time (but ask me again in 3 months). Turns out it was a combination of two bugs, one mine, one somebody&#8230;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[33,4,32,15],"tags":[],"class_list":["post-220","post","type-post","status-publish","format-standard","hentry","category-annoyance","category-xml","category-xpath","category-yahoo"],"aioseo_notices":[],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p8eo8l-3y","_links":{"self":[{"href":"https:\/\/dubinko.info\/blog\/wp-json\/wp\/v2\/posts\/220","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/dubinko.info\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/dubinko.info\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/dubinko.info\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/dubinko.info\/blog\/wp-json\/wp\/v2\/comments?post=220"}],"version-history":[{"count":0,"href":"https:\/\/dubinko.info\/blog\/wp-json\/wp\/v2\/posts\/220\/revisions"}],"wp:attachment":[{"href":"https:\/\/dubinko.info\/blog\/wp-json\/wp\/v2\/media?parent=220"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/dubinko.info\/blog\/wp-json\/wp\/v2\/categories?post=220"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/dubinko.info\/blog\/wp-json\/wp\/v2\/tags?post=220"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}