Note that there are some explanatory texts on larger screens.

plurals
  1. POgroup subversion xml log entries by jira number using xslt
    primarykey
    data
    text
    <p>Having XML Subversion commits log:</p> <pre><code>&lt;?xml version="1.0"?&gt; &lt;log&gt; &lt;logentry revision="1236"&gt; &lt;author&gt;me&lt;/author&gt; &lt;date&gt;2011-11-25T08:28:57.024571Z&lt;/date&gt; &lt;msg&gt;JIRA-5678: commit message&lt;/msg&gt; &lt;/logentry&gt; &lt;logentry revision="1235"&gt; &lt;author&gt;me&lt;/author&gt; &lt;date&gt;2011-11-25T08:28:47.024571Z&lt;/date&gt; &lt;msg&gt;JIRA-5678 - commit2 message&lt;/msg&gt; &lt;/logentry&gt; &lt;logentry revision="1234"&gt; &lt;author&gt;me&lt;/author&gt; &lt;date&gt;2011-11-25T08:28:37.024571Z&lt;/date&gt; &lt;msg&gt;JIRA-5678 commit3 message&lt;/msg&gt; &lt;/logentry&gt; &lt;/log&gt; </code></pre> <p>I want to generate a report grouped by JIRA number, similar to this one:</p> <pre><code>&lt;table&gt; &lt;tr&gt;&lt;th&gt;revision&lt;/th&gt;&lt;th&gt;comment&lt;/th&gt;&lt;/tr&gt; &lt;tr&gt;&lt;td colspan=2&gt;JIRA-5678&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt;&lt;td&gt;r1236&lt;/td&gt;&lt;td&gt;JIRA-5678: commit message&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt;&lt;td&gt;r1235&lt;/td&gt;&lt;td&gt;JIRA-5678 - commit2 message&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt;&lt;td&gt;r1234&lt;/td&gt;&lt;td&gt;JIRA-5678 commit3 message&lt;/td&gt;&lt;/tr&gt; &lt;/table&gt; </code></pre> <p>A transform that extracts a JIRA number and outputs it to a separate column:</p> <pre><code>&lt;xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:fn="http://www.w3.org/2005/xpath-functions"&gt; &lt;xsl:template match="/"&gt; &lt;table summary="JIRAs"&gt; &lt;tr&gt; &lt;th&gt;JIRA#&lt;/th&gt; &lt;th&gt;revision&lt;/th&gt; &lt;th&gt;message&lt;/th&gt; &lt;/tr&gt; &lt;xsl:for-each select="log/logentry[starts-with(msg,'JIRA-')]"&gt; &lt;tr&gt; &lt;td&gt;&lt;xsl:value-of select="fn:replace(msg,'^(JIRA-\d+).*$', '$1')" /&gt;&lt;/td&gt; &lt;td&gt;&lt;xsl:value-of select="@revision" /&gt;&lt;/td&gt; &lt;td&gt;&lt;xsl:value-of select="msg" /&gt;&lt;/td&gt; &lt;/tr&gt; &lt;/xsl:for-each&gt; &lt;/table&gt; &lt;/xsl:template&gt; &lt;/xsl:stylesheet&gt; </code></pre> <p>What would be the XSLT code to do this sort of grouping?</p> <p>Update: I ended up writing a python script on the top of XML DOM. Leave a comment if you need it.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload