{"id":1174,"date":"2025-02-14T08:03:32","date_gmt":"2025-02-14T14:03:32","guid":{"rendered":"https:\/\/asberry.org\/blog_tech\/?p=1174"},"modified":"2025-02-14T08:26:05","modified_gmt":"2025-02-14T14:26:05","slug":"xsl-max-date","status":"publish","type":"post","link":"https:\/\/asberry.org\/blog_tech\/?p=1174","title":{"rendered":"XSL &#8211; Max Date"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">Was having a devil of a time figuring out how to get the max date out of a node. This post enlightened me to the usage of XSL.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">With XSLT 2.0 it is as easy as taking the min and max e.g.<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: xml; light: false; title: ; toolbar: true; notranslate\" title=\"\">\n&lt;xsl:stylesheet\nxmlns:xsl=&quot;http:\/\/www.w3.org\/1999\/XSL\/Transform&quot;\nxmlns:xsd=&quot;http:\/\/www.w3.org\/2001\/XMLSchema&quot;\nexclude-result-prefixes=&quot;xsd&quot;\nversion=&quot;2.0&quot;&gt;\n\n&lt;xsl:template match=&quot;\/&quot;&gt;\n&lt;xsl:variable name=&quot;dates&quot; as=&quot;xsd:dateTime*&quot;\nselect=&quot;dsQueryResponse\/Rows\/Row\/@StartDate\/xsd:dateTime(.)&quot;\/&gt;\n&lt;xsl:text&gt;Minimum date: &lt;\/xsl:text&gt;\n&lt;xsl:value-of select=&quot;min($dates)&quot;\/&gt;\n&lt;xsl:text&gt;; maximum date: &lt;\/xsl:text&gt;\n&lt;xsl:value-of select=&quot;max($dates)&quot;\/&gt;\n&lt;\/xsl:template&gt;\n\n&lt;\/xsl:stylesheet&gt;\n<\/pre><\/div>\n\n\n<p class=\"wp-block-paragraph\">You can run XSLT 2.0 in the COM world (e.g. JScript\/VBScript, VB(A))<br>with AltovaXML tools <a href=\"http:\/\/www.altova.com\/altovaxml.html\" target=\"_blank\" rel=\"noreferrer noopener\">http:\/\/www.altova.com\/altovaxml.html<\/a> and in the<br>.NET world with Saxon 9 (<a href=\"http:\/\/saxon.sourceforge.net\/\" target=\"_blank\" rel=\"noreferrer noopener\">http:\/\/saxon.sourceforge.net\/<\/a>).<br>Sample dataset:<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: xml; light: false; title: ; toolbar: true; notranslate\" title=\"\">\n&lt;dsQueryResponse&gt;\n&lt;Rows&gt;\n&lt;Row ProjectName=&quot;Elvis&quot; StartDate=&quot;2009-10-01T04:00:00Z&quot;\nTargetDate=&quot;2009-12-21T04:00:00Z&quot; Overall_x0020_Status=&quot;On Track&quot;\n_x0025__x0020_Complete=&quot;.8&quot; \/&gt;\n&lt;Row ProjectName=&quot;Dolly&quot; StartDate=&quot;2009-09-11T04:00:00Z&quot;\nTargetDate=&quot;2009-12-01T04:00:00Z&quot; Overall_x0020_Status=&quot;On Track&quot;\n_x0025__x0020_Complete=&quot;.66&quot; \/&gt;\n&lt;Row ProjectName=&quot;CCR&quot; StartDate=&quot;2009-09-21T04:00:00Z&quot;\nTargetDate=&quot;2009-11-21T04:00:00Z&quot; Overall_x0020_Status=&quot;Manageable\nIssues&quot; _x0025__x0020_Complete=&quot;.90&quot; \/&gt;\n&lt;Row ProjectName=&quot;Stones&quot; StartDate=&quot;2009-09-15T04:00:00Z&quot;\nTargetDate=&quot;2009-12-28T04:00:00Z&quot; Overall_x0020_Status=&quot;Project\nConcern&quot; _x0025__x0020_Complete=&quot;.50&quot; \/&gt;\n&lt;\/Rows&gt;\n&lt;\/dsQueryResponse&gt;\n<\/pre><\/div>","protected":false},"excerpt":{"rendered":"<p>Was having a devil of a time figuring out how to get the max date out of a node. This post enlightened me to the usage of XSL. With XSLT 2.0 it is as easy as taking the min and max e.g. You can run XSLT 2.0 in the COM world (e.g. JScript\/VBScript, VB(A))with AltovaXML [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_crdt_document":"","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":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[22],"tags":[],"class_list":["post-1174","post","type-post","status-publish","format-standard","hentry","category-xsl","author-aron"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_shortlink":"https:\/\/wp.me\/p4bBkH-iW","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/asberry.org\/blog_tech\/index.php?rest_route=\/wp\/v2\/posts\/1174","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/asberry.org\/blog_tech\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/asberry.org\/blog_tech\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/asberry.org\/blog_tech\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/asberry.org\/blog_tech\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1174"}],"version-history":[{"count":2,"href":"https:\/\/asberry.org\/blog_tech\/index.php?rest_route=\/wp\/v2\/posts\/1174\/revisions"}],"predecessor-version":[{"id":1176,"href":"https:\/\/asberry.org\/blog_tech\/index.php?rest_route=\/wp\/v2\/posts\/1174\/revisions\/1176"}],"wp:attachment":[{"href":"https:\/\/asberry.org\/blog_tech\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1174"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/asberry.org\/blog_tech\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1174"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/asberry.org\/blog_tech\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1174"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}