Skip to Main Content

DevOps, CI/CD and Automation

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

How to increment a counter i XSLT

235003Jan 10 2003 — edited Jan 16 2003

My Problem is:

I want to format a XML document into a txt file for a printer. This is done using XSLT

In the XSLT file i want to use a counter (noOfElements). This attribute must be incremented by 1 for every element in different "xsl:for-each". This is a need because each element must be inserted X pixels from the top using the formel: "$ofset+($space*$noOfElements)".

Is it possible to use this approach? If not is it posible to implement a other approach in XSTL.

Here is a example of the needed functionality:

<?xml version='1.0'?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="text"/>
<xsl:param name="ofset" expr="900"/>
<xsl:param name="space" expr="30"/>
<xsl:param name="noOfElements" expr="1"/>

<xsl:template match="/">
<xsl:for-each select="/GroupByRow">
^A0,23,24^FO15,<xsl:value-of select="number($ofset+$space*$noOfElements)"/>^CI4^FD<xsl:value-of select="../OrdersView/OrdersViewRow/StyleName"/></xsl:if>^FS
<%--Here the foloving functionality is nedded: $noOfElements = $noOfElements+1--%>
</xsl:for-each>

</xsl:stylesheet>

PEACE NOTE IT IS NOT POSSIBLE TO USE:

<xsl:value-of select="position()" /> in <xsl:for-each select="/GroupByRow">

DUE[i]

Long postings are being truncated to ~1 kB at this time.
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Feb 12 2003
Added on Jan 10 2003
4 comments
5,758 views