Here is a XSLT 1.0 template to find the sum of a set of multiplication results from a node set. In my case, price and quantity are the available nodes in XML. 'orderTotal' (name of the template below) needs to multiply price by quantity for all nodes in a nodeset and total the derived values to find the grand total.
i.e.: orderTotal= sum(//*/price X //*/quantity)
Template
<xsl:template name="orderTotal">
<xsl:param name="nodes"/>
<xsl:param name="total" select="0"/>
<xsl:if test="$nodes[1]">
<xsl:call-template name="orderTotal">
<xsl:with-param name="nodes" select="$nodes[position() > 1]"/>
<xsl:with-param name="total" select="$total + $nodes[1]/k:price * $nodes[1]/k:quantity"/>
</xsl:call-template>
</xsl:if>
<xsl:if test="not($nodes[1])">
<xsl:value-of select="$total"/>
</xsl:if>
</xsl:template>
Tuesday, April 10, 2012
Tuesday, December 13, 2011
ADF - Display timeline indicator on DVT graph
Here is how you do it. Use dvt:timeSelector and set explicitStart and explicitEnd to the same value on Y axis.
This is a good technique to display current position on a timeline chart.
In the example below, i am making use of a getNow method in my backing bean to get start and end values as the same date.
Code:
Result:
This is a good technique to display current position on a timeline chart.
In the example below, i am making use of a getNow method in my backing bean to get start and end values as the same date.
Code:
<dvt:lineGraph id="lineGraph1" value="#{bindings.MyDS.graphModel}" subType="LINE_VERT_ABS" emptyText="No data"
seriesRolloverBehavior="RB_HIGHLIGHT">
<dvt:background>
<dvt:specialEffects/>
</dvt:background>
<dvt:graphPlotArea/>
<dvt:seriesSet>
<dvt:series/>
</dvt:seriesSet>
<dvt:o1Axis/>
<dvt:y1Axis/>
<dvt:timeSelector explicitStart="#{myBean.now}" explicitEnd="#{myBean.now}" mode="EXPLICIT"/>
<dvt:legendArea automaticPlacement="AP_NEVER"/>
</dvt:lineGraph>
Result:
Subscribe to:
Posts (Atom)
