xsl transform and stackoverflow

A

Analizer1

Is there a real time debugger , out here for xsl transform
when i run the xsl transform with a xml file (that represents 2000 or more
rows from a sql 2005 tables)

I get a Statckoverflow exception .

Im No Pro at Xsl, there are some running totals in the xsl file, and one
xsl:for loop for each item in the file

any help is welcome
thanks
 
M

Marc Gravell

Also - note that VS2008 supports xslt debugging:

http://www.code-magazine.com/article.aspx?quickid=990712162&page=2

And also the xslt profiler addin is now available (requires team
system), but I'm not sure if that will work if the xslt explodes - it
might, though, and would quicky highligh 2000 calls to the same
template ;-p
there are some running totals in the xsl file
On thought, though; presumably this is using a script variable? Note
that xslt is designed to be side-effect free; this approach is akin to
using a cursor to step over a table in SQL doing the sum per row;
there are rowset ways of doing this in xslt using sum() etc, which I
would expect to be more efficient.

Final though: you could probably do your aggregation inside the
database and both a: minimise the network traffic and b: exploit the
SQL indexing.

Marc
 
A

Analizer1

I Ran MSXSL Utility against My XSL and XML File
the output was perfect....No Probles

so i Wrote a Console App to run the xsl and xml Files

It bombed with Stackoverflow Exception

sample code for xsltransformation below

using System;
using System.Collections.Generic;
using System.Text;
using System.Xml.Xsl;
using System.Threading;

namespace TransformXsl
{
class Program
{
static void Main(string[] args)
{


string InputXsl;
string InputXml;
string OutputFile;
InputXsl = args[0];
InputXml = args[1];
OutputFile = args[2];
XsltSettings Settings = new XsltSettings();
Settings.EnableScript = false;
XslCompiledTransform Xslt = new XslCompiledTransform();
Xslt.Load(InputXsl); // load the xsl

Xslt.Transform(InputXml,
OutputFile); // load the outpu
}
}
}
 
A

Analizer1

heres the xsl file im using.....below
this creates a summary report based on xml inputfile

msxml utility works fine, net 20 c# xsltransform crashes with stackoverflow
exception


<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:blush:utput method="text"/>
<xsl:template match="/">
<xsl:apply-templates/>
</xsl:template>
<xsl:template match="CLAIMS">
<xsl:variable name="headerDescription">Dear: <xsl:value-of
select="CLAIM[1]/@user"/>

=======================================================================================================================================================================================================
Your File has been processed by Office Ally. The status of the claims
contained in the file are as
detailed below. If there are any failures please correct the problem and
resubmit the claim. To
assist you in correcting your claims they will be available in the ClaimFix
section within 24 hours.
=======================================================================================================================================================================================================

Summary report for: <xsl:value-of select="CLAIM[1]/OAFILENAME"/>
Uploaded on : <xsl:value-of select="CLAIM[1]/@DATERECEIVED"/>
Processed on: <xsl:value-of select="CLAIM[1]/@DATEPROCESSED"/>

The fileid assigned to this upload is: <xsl:value-of
select="CLAIM[1]/@PARENTFILEID"/>, all accepted claims from this upload were
delivered to the following payers.</xsl:variable>
<xsl:variable name="totalBilled">
<xsl:call-template name="sumCharges">
<xsl:with-param name="index" select="'1'"/>
<xsl:with-param name="items" select="CLAIM"/>
<xsl:with-param name="runningTotal" select="'0'"/>
</xsl:call-template>
</xsl:variable>
<xsl:variable name="totalPassed">
<xsl:call-template name="sumCharges">
<xsl:with-param name="index" select="'1'"/>
<xsl:with-param name="items" select="CLAIM[@STATUSID=110]"/>
<xsl:with-param name="runningTotal" select="'0'"/>
</xsl:call-template>
</xsl:variable>
<xsl:variable name="totalPend">
<xsl:call-template name="sumCharges">
<xsl:with-param name="index" select="'1'"/>
<xsl:with-param name="items" select="CLAIM[@STATUSID=104]"/>
<xsl:with-param name="runningTotal" select="'0'"/>
</xsl:call-template>
</xsl:variable>
<xsl:variable name="totalDupe">
<xsl:call-template name="sumCharges">
<xsl:with-param name="index" select="'1'"/>
<xsl:with-param name="items" select="CLAIM[@STATUSID=105]"/>
<xsl:with-param name="runningTotal" select="'0'"/>
</xsl:call-template>
</xsl:variable>
<xsl:variable name="totalFailed">
<xsl:call-template name="sumCharges">
<xsl:with-param name="index" select="'1'"/>
<xsl:with-param name="items"
select="CLAIM[@STATUSID!=110][@STATUSID!=104][@STATUSID!=105]"/>
<xsl:with-param name="runningTotal" select="'0'"/>
</xsl:call-template>
</xsl:variable>
<xsl:variable name="distinctMembers">
<xsl:call-template name="gatherMembers">
<xsl:with-param name="index" select="'1'"/>
<xsl:with-param name="claim" select="CLAIM"/>
<xsl:with-param name="runningList" select="''"/>
</xsl:call-template>
</xsl:variable>
<xsl:variable name="allErrors">
<xsl:call-template name="describeErrors">
<xsl:with-param name="index" select="'1'"/>
<xsl:with-param name="claim" select="CLAIM/ERROR"/>
<xsl:with-param name="runningList" select="''"/>
</xsl:call-template>
</xsl:variable>
<xsl:value-of select="$headerDescription"/>
=======================================================================================================================================================================================================
<xsl:value-of select="$distinctMembers"/>:
=======================================================================================================================================================================================================
Total Amount Billed :<xsl:call-template
name="positionElementsRight">
<xsl:with-param name="fieldlength" select="18"/>
<xsl:with-param name="value"
select="format-number($totalBilled,'$###,###,##0.00')"/>
</xsl:call-template>
Total Amount Passed (ACK) :<xsl:call-template
name="positionElementsRight">
<xsl:with-param name="fieldlength" select="18"/>
<xsl:with-param name="value"
select="format-number($totalPassed,'$###,###,##0.00')"/>
</xsl:call-template>
Total Amount Pended (PND) :<xsl:call-template
name="positionElementsRight">
<xsl:with-param name="fieldlength" select="18"/>
<xsl:with-param name="value"
select="format-number($totalPend,'$###,###,##0.00')"/>
</xsl:call-template>
Total Amount Failed (REJ) :<xsl:call-template
name="positionElementsRight">
<xsl:with-param name="fieldlength" select="18"/>
<xsl:with-param name="value"
select="format-number($totalFailed,'$###,###,##0.00')"/>
</xsl:call-template>
Total Amount Duplicate (DUP) :<xsl:call-template
name="positionElementsRight">
<xsl:with-param name="fieldlength" select="18"/>
<xsl:with-param name="value"
select="format-number($totalDupe,'$###,###,##0.00')"/>
</xsl:call-template>
<xsl:if test="count(CLAIM/ERROR) &gt; 0">
=======================================================================================================================================================================================================
Error Code Legend:
--------- -------- ------------------
<xsl:call-template name="positionElementsRight">
<xsl:with-param name="fieldlength" select="9"/>
<xsl:with-param name="value" select="'Count'"/>
</xsl:call-template>
<xsl:call-template name="positionElements">
<xsl:with-param name="fieldlength" select="8"/>
<xsl:with-param name="value" select="'Code'"/>
</xsl:call-template>
<xsl:call-template name="positionElements">
<xsl:with-param name="fieldlength" select="167"/>
<xsl:with-param name="value" select="'Error Description'"/>
</xsl:call-template>
--------- -------- ------------------
<xsl:value-of select="$allErrors"/>
</xsl:if>
=======================================================================================================================================================================================================
<!--Display the headers -->
<xsl:call-template name="positionElementsRight">
<xsl:with-param name="fieldlength" select="6"/>
<xsl:with-param name="value" select="' '"/>
</xsl:call-template>
<xsl:call-template name="positionElements">
<xsl:with-param name="fieldlength" select="8"/>
<xsl:with-param name="value" select="'STATUS'"/>
</xsl:call-template>
<xsl:call-template name="positionElements">
<xsl:with-param name="fieldlength" select="10"/>
<xsl:with-param name="value" select="'CLAIM ID'"/>
</xsl:call-template>
<xsl:call-template name="positionElements">
<xsl:with-param name="fieldlength" select="20"/>
<xsl:with-param name="value" select="'PATIENT ACCT'"/>
</xsl:call-template>
<xsl:call-template name="positionElements">
<xsl:with-param name="fieldlength" select="20"/>
<xsl:with-param name="value" select="'PATIENT (L, F)'"/>
</xsl:call-template>
<xsl:call-template name="positionElements">
<xsl:with-param name="fieldlength" select="12"/>
<xsl:with-param name="value" select="'DOB'"/>
</xsl:call-template>
<xsl:call-template name="positionElementsRight">
<xsl:with-param name="fieldlength" select="15"/>
<xsl:with-param name="value" select="'TOTAL CHARGE'"/>
</xsl:call-template>
<xsl:call-template name="positionElements">
<xsl:with-param name="fieldlength" select="12"/>
<xsl:with-param name="value" select="'DOS'"/>
</xsl:call-template>
<xsl:call-template name="positionElements">
<xsl:with-param name="fieldlength" select="10"/>
<xsl:with-param name="value" select="'PROCEDURE'"/>
</xsl:call-template>
<xsl:call-template name="positionElements">
<xsl:with-param name="fieldlength" select="12"/>
<xsl:with-param name="value" select="'BILL TAXID'"/>
</xsl:call-template>
<xsl:call-template name="positionElements">
<xsl:with-param name="fieldlength" select="14"/>
<xsl:with-param name="value" select="'BILLING ID #2'"/>
</xsl:call-template>
<xsl:call-template name="positionElements">
<xsl:with-param name="fieldlength" select="8"/>
<xsl:with-param name="value" select="'PAYER'"/>
</xsl:call-template>
<xsl:call-template name="positionElements">
<xsl:with-param name="fieldlength" select="43"/>
<xsl:with-param name="value" select="'ERROR CODES'"/>
</xsl:call-template> :
=======================================================================================================================================================================================================
<!-- FOR EACH OF THE CLAIMS IN THE FILE, DISPLAY THEIR INFORMATION -->
<xsl:for-each select="CLAIM">
<xsl:variable name="claimnumber">
<xsl:call-template name="positionElementsRight">
<xsl:with-param name="fieldlength" select="7"/>
<xsl:with-param name="value" select="concat(position(),') ')"/>
</xsl:call-template>
</xsl:variable>
<xsl:variable name="formattedStatus">
<xsl:call-template name="positionElements">
<xsl:with-param name="fieldlength" select="7"/>
<xsl:with-param name="value" select="CLAIMSTATUS"/>
</xsl:call-template>
</xsl:variable>
<xsl:variable name="formattedClaimID">
<xsl:call-template name="positionElements">
<xsl:with-param name="fieldlength" select="10"/>
<xsl:with-param name="value" select="@CLAIMID"/>
</xsl:call-template>
</xsl:variable>
<xsl:variable name="formattedPCN">
<xsl:call-template name="positionElements">
<xsl:with-param name="fieldlength" select="20"/>
<xsl:with-param name="value" select="PATIENTACCOUNTNO"/>
</xsl:call-template>
</xsl:variable>
<xsl:variable name="formattedPATIENT">
<xsl:call-template name="positionElements">
<xsl:with-param name="fieldlength" select="20"/>
<xsl:with-param name="value" select="concat(concat(PATLASTNAME,',
'),PATFIRSTNAME)"/>
</xsl:call-template>
</xsl:variable>
<xsl:variable name="formattedDOB">
<xsl:call-template name="positionElements">
<xsl:with-param name="fieldlength" select="12"/>
<xsl:with-param name="value" select="PATIENTDOB"/>
</xsl:call-template>
</xsl:variable>
<xsl:variable name="formattedCHARGE">
<xsl:call-template name="positionElementsRight">
<xsl:with-param name="fieldlength" select="15"/>
<xsl:with-param name="value"
select="format-number(TOTALCHARGE,'$###,##0.00')"/>
</xsl:call-template>
</xsl:variable>
<xsl:variable name="formattedDOS">
<xsl:call-template name="positionElements">
<xsl:with-param name="fieldlength" select="12"/>
<xsl:with-param name="value" select="DATEOFSERVICE"/>
</xsl:call-template>
</xsl:variable>
<xsl:variable name="formattedCPT">
<xsl:call-template name="positionElements">
<xsl:with-param name="fieldlength" select="10"/>
<xsl:with-param name="value" select="PROCEDURECODE"/>
</xsl:call-template>
</xsl:variable>
<xsl:variable name="formattedBillTaxID">
<xsl:call-template name="positionElements">
<xsl:with-param name="fieldlength" select="12"/>
<xsl:with-param name="value" select="BILLINGTAXID"/>
</xsl:call-template>
</xsl:variable>
<xsl:variable name="formattedBillID">
<xsl:call-template name="positionElements">
<xsl:with-param name="fieldlength" select="12"/>
<xsl:with-param name="value" select="BILLINGID"/>
</xsl:call-template>
</xsl:variable>
<xsl:variable name="formattedAcronym">
<xsl:call-template name="positionElements">
<xsl:with-param name="fieldlength" select="8"/>
<xsl:with-param name="value" select="ACRONYM"/>
</xsl:call-template>
</xsl:variable>
<xsl:variable name="errorList">
<xsl:call-template name="gatherErrors">
<xsl:with-param name="index" select="'1'"/>
<xsl:with-param name="error" select="ERROR"/>
<xsl:with-param name="runningList" select="''"/>
</xsl:call-template>
</xsl:variable>
<xsl:variable name="formattedErrorList">
<xsl:call-template name="positionElements">
<xsl:with-param name="fieldlength" select="43"/>
<xsl:with-param name="value" select="$errorList"/>
</xsl:call-template>
</xsl:variable>
<xsl:value-of select="$claimnumber"/>
<xsl:value-of select="$formattedStatus"/>
<xsl:value-of select="$formattedClaimID"/>
<xsl:value-of select="$formattedPCN"/>
<xsl:value-of select="$formattedPATIENT"/>
<xsl:value-of select="$formattedDOB"/>
<xsl:value-of select="$formattedCHARGE"/>
<xsl:value-of select="$formattedDOS"/>
<xsl:value-of select="$formattedCPT"/>
<xsl:value-of select="$formattedBillTaxID"/>
<xsl:value-of select="$formattedBillID"/>
<xsl:value-of select="$formattedAcronym"/>
<xsl:value-of select="$formattedErrorList"/> :
<xsl:if test="contains($formattedStatus,'DUP')">
<xsl:variable name="formattedDupeFileID">
<xsl:call-template name="positionElements">
<xsl:with-param name="fieldlength" select="10"/>
<xsl:with-param name="value" select="DUPEFILEID"/>
</xsl:call-template>
</xsl:variable>
<xsl:variable name="formattedDupeClaimID">
<xsl:call-template name="positionElements">
<xsl:with-param name="fieldlength" select="15"/>
<xsl:with-param name="value" select="DUPEOF"/>
</xsl:call-template>
</xsl:variable>
<xsl:variable name="formattedDupeDate">
<xsl:call-template name="positionElements">
<xsl:with-param name="fieldlength" select="15"/>
<xsl:with-param name="value" select="DUPEDATERECEIVED"/>
</xsl:call-template>
</xsl:variable>
<xsl:variable name="formattedDupeControlNum">
<xsl:call-template name="positionElements">
<xsl:with-param name="fieldlength" select="50"/>
<xsl:with-param name="value" select="DUPECONTROLNUMBER"/>
</xsl:call-template>
</xsl:variable>The above claim is a duplicate of: <xsl:value-of
select="$formattedDupeClaimID"/> From file: <xsl:value-of
select="$formattedDupeFileID"/> Processed on: <xsl:value-of
select="$formattedDupeDate"/>:
</xsl:if>
</xsl:for-each>
=======================================================================================================================================================================================================</xsl:template>
<xsl:template name="gatherMembers">
<xsl:param name="index" select="'1'"/>
<xsl:param name="claim"/>
<xsl:param name="runningList" select="''"/>
<xsl:variable name="seper">
<xsl:text>:
</xsl:text>
</xsl:variable>
<xsl:if test="count($claim) &gt; 0">
<xsl:variable name="currentItem">
<xsl:value-of select="$claim[$index]/MEMBERNAME"/>
</xsl:variable>
<xsl:variable name="currentMemID">
<xsl:value-of select="$claim[$index]/@SPLITTER"/>
</xsl:variable>
<xsl:variable name="remainingItems">
<xsl:choose>
<xsl:when test="$index &gt; count($claim)">
<xsl:text/>
</xsl:when>
<xsl:blush:therwise>
<xsl:call-template name="gatherMembers">
<xsl:with-param name="index" select="$index+1"/>
<xsl:with-param name="claim" select="$claim"/>
<xsl:with-param name="runningList"
select="concat(concat($runningList,','),$currentItem)"/>
</xsl:call-template>
</xsl:blush:therwise>
</xsl:choose>
</xsl:variable>
<xsl:choose>
<xsl:when test="string-length($remainingItems) &gt; 0">
<xsl:choose>
<xsl:when test="contains($remainingItems,$currentItem)">
<xsl:value-of select="$remainingItems"/>
</xsl:when>
<xsl:blush:therwise>
<xsl:variable name="thisMember">
<xsl:call-template name="memStats">
<xsl:with-param name="memid" select="$currentMemID"/>
<xsl:with-param name="file" select="$claim"/>
<xsl:with-param name="claim" select="$claim[$index]"/>
</xsl:call-template>
</xsl:variable>
<xsl:value-of select="concat(concat($thisMember,$seper),
$remainingItems)"/>
</xsl:blush:therwise>
</xsl:choose>
</xsl:when>
<xsl:when test="string-length($currentItem) &gt; 0">
<xsl:call-template name="memStats">
<xsl:with-param name="memid" select="$currentMemID"/>
<xsl:with-param name="file" select="$claim"/>
<xsl:with-param name="claim" select="$claim[$index]"/>
</xsl:call-template>
<!--<xsl:value-of select="$currentItem"/>-->
</xsl:when>
<xsl:blush:therwise>
<xsl:text/>
</xsl:blush:therwise>
</xsl:choose>
</xsl:if>
<xsl:if test="count($claim) = 0">
<xsl:text/>
</xsl:if>
</xsl:template>
<xsl:template name="memStats">
<xsl:param name="memid"/>
<xsl:param name="file"/>
<xsl:param name="claim"/>
<xsl:variable name="memAcronym">
<xsl:call-template name="positionElements">
<xsl:with-param name="fieldlength" select="10"/>
<xsl:with-param name="value" select="concat(concat('(
',$claim/ACRONYM),' ) ')"/>
</xsl:call-template>
</xsl:variable>
<xsl:variable name="memCount">
<xsl:call-template name="positionElementsRight">
<xsl:with-param name="fieldlength" select="8"/>
<xsl:with-param name="value" select="count($file[@SPLITTER=$memid])"/>
</xsl:call-template>
</xsl:variable>
<xsl:variable name="memName">
<xsl:call-template name="positionElements">
<xsl:with-param name="fieldlength" select="50"/>
<xsl:with-param name="value" select="$claim/MEMBERNAME"/>
</xsl:call-template>
</xsl:variable>
<xsl:variable name="memChargesTmp">0
<!--<xsl:call-template name="sumCharges">
<xsl:with-param name="index" select="'1'"/>
<xsl:with-param name="items" select="$file[@SPLITTER=$memid]"/>
<xsl:with-param name="runningTotal" select="'0'"/>
</xsl:call-template>-->
</xsl:variable>
<xsl:variable name="memCharges">
<xsl:call-template name="positionElementsRight">
<xsl:with-param name="fieldlength" select="18"/>
<xsl:with-param name="value"
select="format-number($memChargesTmp,'$###,###,##0.00')"/>
</xsl:call-template>
</xsl:variable>
<xsl:variable name="thisFileid">
<xsl:call-template name="positionElements">
<xsl:with-param name="fieldlength" select="10"/>
<xsl:with-param name="value" select="$claim/@FILEID"/>
</xsl:call-template>
</xsl:variable>
<xsl:value-of
select="concat($thisFileid,concat(concat(concat($memAcronym,$memName),$memCount),$memCharges))"/>
</xsl:template>
<xsl:template name="gatherErrors">
<xsl:param name="index" select="'1'"/>
<xsl:param name="error"/>
<xsl:param name="runningList" select="''"/>
<xsl:if test="count($error) &gt; 0">
<xsl:variable name="currentItem">
<xsl:value-of select="$error[$index]/CODE"/>
</xsl:variable>
<xsl:variable name="remainingItems">
<xsl:choose>
<xsl:when test="$index=count($error)">
<xsl:text/>
</xsl:when>
<xsl:blush:therwise>
<xsl:call-template name="gatherErrors">
<xsl:with-param name="index" select="$index+1"/>
<xsl:with-param name="error" select="$error"/>
<xsl:with-param name="runningList"
select="concat(concat($runningList,', '), $currentItem)"/>
</xsl:call-template>
</xsl:blush:therwise>
</xsl:choose>
</xsl:variable>
<xsl:choose>
<xsl:when test="string-length($remainingItems) &gt; 0">
<xsl:value-of select="concat(concat($currentItem,',
'),$remainingItems)"/>
</xsl:when>
<xsl:when test="string-length($currentItem) &gt; 0">
<xsl:value-of select="$currentItem"/>
</xsl:when>
<xsl:blush:therwise>
<xsl:text/>
</xsl:blush:therwise>
</xsl:choose>
</xsl:if>
<xsl:if test="count($error) = 0">
<xsl:text/>
</xsl:if>
</xsl:template>
<xsl:template name="describeErrors">
<xsl:param name="index" select="'1'"/>
<xsl:param name="claim"/>
<xsl:param name="runningList" select="''"/>
<xsl:variable name="seper">
<xsl:text>:
</xsl:text>
</xsl:variable>
<xsl:if test="count($claim) &gt; 0">
<xsl:variable name="currentItem">
<xsl:value-of select="$claim[$index]/CODE"/>
</xsl:variable>
<xsl:variable name="currentErrorID">
<xsl:value-of select="$claim[$index]/@ID"/>
</xsl:variable>
<xsl:variable name="remainingItems">
<xsl:choose>
<xsl:when test="$index=count($claim)">
<xsl:text/>
</xsl:when>
<xsl:blush:therwise>
<xsl:call-template name="describeErrors">
<xsl:with-param name="index" select="$index+1"/>
<xsl:with-param name="claim" select="$claim"/>
<xsl:with-param name="runningList"
select="concat(concat($runningList,', '), $currentItem)"/>
</xsl:call-template>
</xsl:blush:therwise>
</xsl:choose>
</xsl:variable>
<xsl:choose>
<xsl:when test="string-length($remainingItems) &gt; 0">
<xsl:choose>
<xsl:when test="contains($remainingItems,$currentItem)">
<xsl:value-of select="$remainingItems"/>
</xsl:when>
<xsl:blush:therwise>
<xsl:variable name="thisError">
<xsl:call-template name="errorStats">
<xsl:with-param name="errorID" select="$currentErrorID"/>
<xsl:with-param name="errors" select="$claim"/>
</xsl:call-template>
</xsl:variable>
<xsl:value-of select="concat(concat($thisError,$seper),
$remainingItems)"/>
</xsl:blush:therwise>
</xsl:choose>
</xsl:when>
<xsl:when test="string-length($currentItem) &gt; 0">
<xsl:call-template name="errorStats">
<xsl:with-param name="errorID" select="$currentErrorID"/>
<xsl:with-param name="errors" select="$claim"/>
</xsl:call-template>
</xsl:when>
<xsl:blush:therwise>
<xsl:text>interesting...</xsl:text>
</xsl:blush:therwise>
</xsl:choose>
</xsl:if>
<xsl:if test="count($claim) = 0">
<xsl:text>no errors</xsl:text>
</xsl:if>
</xsl:template>
<xsl:template name="errorStats">
<xsl:param name="errorID"/>
<xsl:param name="errors"/>
<xsl:variable name="errorCount">
<xsl:call-template name="positionElementsRight">
<xsl:with-param name="fieldlength" select="9"/>
<xsl:with-param name="value"
select="format-number(count($errors[@ID=$errorID]),'###,###,##0')"/>
</xsl:call-template>
</xsl:variable>
<xsl:variable name="errorCode">
<xsl:call-template name="positionElements">
<xsl:with-param name="fieldlength" select="8"/>
<xsl:with-param name="value" select="$errors[@ID=$errorID]/CODE"/>
</xsl:call-template>
</xsl:variable>
<xsl:variable name="errorDescription">
<xsl:call-template name="positionElements">
<xsl:with-param name="fieldlength" select="168"/>
<xsl:with-param name="value"
select="$errors[@ID=$errorID]/DESCRIPTION"/>
</xsl:call-template>
</xsl:variable>
<xsl:value-of
select="concat(concat($errorCount,$errorCode),$errorDescription)"/>
</xsl:template>
<xsl:template name="sumCharges">
<xsl:param name="index" select="'1'"/>
<xsl:param name="items"/>
<xsl:param name="runningTotal" select="'0'"/>
<xsl:variable name="currentItem">
<xsl:value-of select="$items[$index]/TOTALCHARGE"/>
</xsl:variable>
<xsl:if test="count($items) &gt; 0">
<xsl:variable name="remainingItems">
<xsl:choose>
<xsl:when test="$index=count($items)">
<xsl:text>0</xsl:text>
</xsl:when>
<xsl:blush:therwise>
<xsl:call-template name="sumCharges">
<xsl:with-param name="index" select="$index+1"/>
<xsl:with-param name="items" select="$items"/>
<xsl:with-param name="runningTotal"
select="$runningTotal+$currentItem"/>
</xsl:call-template>
</xsl:blush:therwise>
</xsl:choose>
</xsl:variable>
<xsl:value-of select="$currentItem+$remainingItems"/>
</xsl:if>
<xsl:if test="count($items) = 0">
<xsl:text>0</xsl:text>
</xsl:if>
</xsl:template>
<xsl:template name="positionElements">
<xsl:param name="fieldlength"/>
<xsl:param name="value"/>
<xsl:variable name="filler" select="'
'"/>
<xsl:choose>
<xsl:when test="string-length($value) &lt; $fieldlength">
<xsl:value-of select="concat($value,substring($filler, 1,($fieldlength -
string-length($value))))"/>
</xsl:when>
<xsl:blush:therwise>
<xsl:value-of select="concat(substring($value, 1,$fieldlength - 1),'
')"/>
</xsl:blush:therwise>
</xsl:choose>
</xsl:template>
<xsl:template name="positionElementsRight">
<xsl:param name="fieldlength"/>
<xsl:param name="value"/>
<xsl:variable name="filler" select="'
'"/>
<xsl:choose>
<xsl:when test="string-length($value) &lt; $fieldlength">
<xsl:value-of select="concat(concat(substring($filler, 1,($fieldlength -
string-length($value))),$value),' ')"/>
</xsl:when>
<xsl:blush:therwise>
<xsl:value-of select="concat(substring($value, 1,$fieldlength - 1),'
')"/>
</xsl:blush:therwise>
</xsl:choose>
</xsl:template>
<xsl:template name="incrementCount">
<xsl:param name="value"/>
<xsl:choose>
<xsl:when test="$value=0">1</xsl:when>
<xsl:blush:therwise>
<xsl:value-of select="$value+1"/>
</xsl:blush:therwise>
</xsl:choose>
</xsl:template>
</xsl:stylesheet>
 
A

Analizer1

the Call to DistinctMembers is the Problem causing the Stackoverflow....but
since im just learning xsl for the most part...not sure of a better way to
group the members

for instance each line item has a associated member(customer) id
the distinctmembers is suppose to group them into there own list and totals

thanks
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top