{"id":402,"date":"2008-12-09T13:29:03","date_gmt":"2008-12-09T20:29:03","guid":{"rendered":"https:\/\/dubinko.info\/blog\/?p=402"},"modified":"2008-12-09T14:59:32","modified_gmt":"2008-12-09T21:59:32","slug":"xml-2008-liveblog-automating-content-analysis-with-trang-and-simple-xslt-scripts","status":"publish","type":"post","link":"https:\/\/dubinko.info\/blog\/2008\/12\/xml-2008-liveblog-automating-content-analysis-with-trang-and-simple-xslt-scripts\/","title":{"rendered":"XML 2008 liveblog: Automating Content Analysis with Trang and Simple XSLT Scripts"},"content":{"rendered":"<p>Bob DuCharme, Innodata Isogen<\/p>\n<p>Content analysis: why? You&#8217;ve &#8220;inherited&#8221; content. Need to save time or effort.<\/p>\n<p>Handy tool 1: &#8220;sort&#8221;. As in the Unix command line tool. (Even Windows)<\/p>\n<p>Handy tool 2: &#8220;uniq -c&#8221;\u00c2\u00a0 (flag -c means include counts)<\/p>\n<p>Elsevier contest: interface for reading journals. Download a bunch of articles, and see what&#8217;s all in there.<\/p>\n<p>Handy tool 3: <a href=\"http:\/\/www.thaiopensource.com\/relaxng\/trang.html\">Trang<\/a>. Schema language converter. But can infer a schema from one or more input documents. Concat all sample documents under one root, and infer&#8211;this gives a list of all doctypes in use.<\/p>\n<p><code>trang article.dtd article.rng<\/code><br \/>\n<code>trang issueContents.xml issueContents.rng<\/code><br \/>\n<code>saxon article.rng compareElsRNG.xsl | sort &gt; compareElsRNG.out<\/code><\/p>\n<p>compareElsRNG.xsl has text mode output, ignores input text nodes, and checks whether the RNG has references to each element, outputing &#8220;Yes: elementname&#8221; or &#8220;No: elemenname&#8221;. (which gets sorted in step 3)<\/p>\n<p>Helps ferret out places where the schema says 40 different child elements are possible but in practice only 4 are used.<\/p>\n<p>Handy tool 4: James Clark&#8217;s sx, converts SGML to XML.<\/p>\n<p>Another stylesheet counts elements producing a histogram. [Ed. I would do this in XQuery in <a href=\"http:\/\/xqzone.marklogic.com\/svn\/cq\/releases\/\">CQ<\/a>.] Again, can help prioritize parts of the XML to use first. Similar logic for parent\/child counts; where @id gets used; find all values for a particular attribute.<\/p>\n<p>Another stylesheet goes through multiple converted-to-rng schemas, looking for common substructure. Lists generated this way can be pulled into a stylesheet.<\/p>\n<p>Analyze a SGML DTD? dtd2html -&gt; tidy -&gt; XSLT. Clients like reports (especially spreadsheets). The is more like lego bricks.<\/p>\n<p>-m<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Bob DuCharme, Innodata Isogen Content analysis: why? You&#8217;ve &#8220;inherited&#8221; content. Need to save time or effort. Handy tool 1: &#8220;sort&#8221;. As in the Unix command line tool. (Even Windows) Handy tool 2: &#8220;uniq -c&#8221;\u00c2\u00a0 (flag -c means include counts) Elsevier contest: interface for reading journals. Download a bunch of articles, and see what&#8217;s all in&#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":[28,3,9,4],"tags":[555,541,556,558,557,534],"class_list":["post-402","post","type-post","status-publish","format-standard","hentry","category-everythingismiscellaneous","category-patternalia","category-standards","category-xml","tag-analysis","tag-content","tag-sort","tag-trang","tag-uniq","tag-xml2008"],"aioseo_notices":[],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p8eo8l-6u","_links":{"self":[{"href":"https:\/\/dubinko.info\/blog\/wp-json\/wp\/v2\/posts\/402","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=402"}],"version-history":[{"count":0,"href":"https:\/\/dubinko.info\/blog\/wp-json\/wp\/v2\/posts\/402\/revisions"}],"wp:attachment":[{"href":"https:\/\/dubinko.info\/blog\/wp-json\/wp\/v2\/media?parent=402"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/dubinko.info\/blog\/wp-json\/wp\/v2\/categories?post=402"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/dubinko.info\/blog\/wp-json\/wp\/v2\/tags?post=402"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}