incubator-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s...@apache.org
Subject svn commit: r1387931 - in /incubator/public/trunk: build.xml current.pl current.xsl
Date Thu, 20 Sep 2012 09:25:58 GMT
Author: sebb
Date: Thu Sep 20 09:25:58 2012
New Revision: 1387931

URL: http://svn.apache.org/viewvc?rev=1387931&view=rev
Log:
Use XSLT-only solution

Removed:
    incubator/public/trunk/current.pl
Modified:
    incubator/public/trunk/build.xml
    incubator/public/trunk/current.xsl

Modified: incubator/public/trunk/build.xml
URL: http://svn.apache.org/viewvc/incubator/public/trunk/build.xml?rev=1387931&r1=1387930&r2=1387931&view=diff
==============================================================================
--- incubator/public/trunk/build.xml (original)
+++ incubator/public/trunk/build.xml Thu Sep 20 09:25:58 2012
@@ -329,18 +329,11 @@ Audit Tasks
   </target>
 
   <target name="__history_current">
-    <xslt force="true"
+    <xslt
       in="${docs.src}/podlings.xml"
-      out="${docs.dest}/history/current.tmp"
+      out="${docs.dest}/history/current.txt"
       style="current.xsl">
     </xslt>
-    <exec executable="perl" logerror="true" failonerror="true" failifexecutionfails="true">
-      <arg value="-f"/>
-      <arg value="current.pl"/>
-      <arg value="-o"/>
-      <arg value="${docs.dest}/history/current.txt"/>
-      <arg value="${docs.dest}/history/current.tmp"/>
-    </exec>
   </target>
 
   <target name="__history_entry">

Modified: incubator/public/trunk/current.xsl
URL: http://svn.apache.org/viewvc/incubator/public/trunk/current.xsl?rev=1387931&r1=1387930&r2=1387931&view=diff
==============================================================================
--- incubator/public/trunk/current.xsl (original)
+++ incubator/public/trunk/current.xsl Thu Sep 20 09:25:58 2012
@@ -68,19 +68,36 @@
     </xsl:variable>
 
     <!-- extract the sorted data -->
-    <!--
-          N.B. It's not trivial to keep a running total with only one output per date in
xslt,
-          so this is done in a separate Perl script for now.
-     -->
     <xsl:for-each select="exsl:node-set($sortedDoc)/entry">
-        <xsl:value-of select="@date"/>
-        <xsl:text>,"</xsl:text>
-        <xsl:value-of select="@name"/>
-        <xsl:text>"</xsl:text>
-        <xsl:text>,</xsl:text>
-        <xsl:value-of select="@type"/>
-        <xsl:text>
+        <!-- don't process if there is a following entry with the same date -->
+        <xsl:if test="not(following-sibling::entry/@date = @date)">
+            <xsl:value-of select="@date"/>
+            <xsl:text>,</xsl:text>
+            <!-- 
+                total active = entries - exits
+                In theory, entries and exits should be available using:
+                    xsl:number count="entry[@type = 1|2]
+                However, xsl:number does not return anything unless the preceeding entry
elements have the same type.
+                [This may be a bug?]
+                So we use the fact that entries + exits = position, i.e.
+                total = entries - (position - entries) = entries * 2 - position
+                total = (position - exits) - exits = position - exits * 2 
+            -->
+            <xsl:if test="@type = 1">
+                <xsl:variable name="entries">
+                    <xsl:number count="entry[@type = 1]"/>
+                </xsl:variable>
+                <xsl:value-of select="$entries * 2 - position()"/>
+            </xsl:if>
+            <xsl:if test="@type = 2">
+                <xsl:variable name="exits">
+                    <xsl:number count="entry[@type = 2]"/>
+                </xsl:variable>
+                <xsl:value-of select="position() - $exits * 2"/>
+            </xsl:if>
+            <xsl:text>
 </xsl:text>
+        </xsl:if>
     </xsl:for-each>
 </xsl:template>
 



---------------------------------------------------------------------
To unsubscribe, e-mail: cvs-unsubscribe@incubator.apache.org
For additional commands, e-mail: cvs-help@incubator.apache.org


Mime
View raw message