Hi All,

I have an xml

<?xml version="1.0" encoding="UTF-8"?>
<columns>
	<column>
		<name></name>
		<displayname></displayname>
		<attributes>
			<attribute>
				<name>width</name>
				<value>100</value>
			</attribute>
			<attribute>
				<name>text-align</name>
				<value>left</value>
			</attribute>
		</attributes>
	</column>
	<column>
		<name>VersionCode</name>
		<displayname>Version Code</displayname>
		<attributes>
			<attribute>
				<name>width</name>
				<value>200</value>
			</attribute>
			<attribute>
				<name>text-align</name>
				<value>right</value>
			</attribute>
		</attributes>
	</column>
	<column>
		<name>MaterialType</name>
		<displayname>Material Type</displayname>
		<attributes>
			<attribute>
				<name>width</name>
				<value>100</value>
			</attribute>
			<attribute>
				<name>text-align</name>
				<value>left</value>
			</attribute>
		</attributes>
	</column>
	<column>
		<name>LotNumber</name>
		<displayname>Lot Number</displayname>
		<attributes>
			<attribute>
				<name>width</name>
				<value>60</value>
			</attribute>
			<attribute>
				<name>text-align</name>
				<value>center</value>
			</attribute>
		</attributes>
	</column>
	<column>
		<name>RRComplete</name>
		<displayname>RR Complete</displayname>
		<attributes>
			<attribute>
				<name>width</name>
				<value>90</value>
			</attribute>
			<attribute>
				<name>text-align</name>
				<value>center</value>
			</attribute>			
		</attributes>
	</column>
	<column>
		<name>ReviewerName</name>
		<displayname>Reviewer Name</displayname>
		<attributes>
			<attribute>
				<name>width</name>
				<value>80</value>
			</attribute>
			<attribute>
				<name>text-align</name>
				<value>center</value>
			</attribute>
		</attributes>
	</column>
	<column>
		<name>ReviewStartDate</name>
		<displayname>Review StartDate</displayname>
		<attributes>
			<attribute>
				<name>width</name>
				<value>100</value>
			</attribute>
			<attribute>
				<name>text-align</name>
				<value>center</value>
			</attribute>
		</attributes>
	</column>
	<column>
		<name>BatchNumber1</name>
		<displayname>Batch Number</displayname>
		<attributes>
			<attribute>
				<name>width</name>
				<value>100</value>
			</attribute>
			<attribute>
				<name>text-align</name>
				<value>left</value>
			</attribute>
		</attributes>
	</column>
	<column>
		<name>VersionCode1</name>
		<displayname>Version Code</displayname>
		<attributes>
			<attribute>
				<name>width</name>
				<value>40</value>
			</attribute>
			<attribute>
				<name>text-align</name>
				<value>right</value>
			</attribute>
		</attributes>
	</column>
	<column>
		<name>MaterialType1</name>
		<displayname>Material Type</displayname>
		<attributes>
			<attribute>
				<name>width</name>
				<value>10</value>
			</attribute>
			<attribute>
				<name>text-align</name>
				<value>left</value>
			</attribute>
		</attributes>
	</column>
	<column>
		<name>LotNumber1</name>
		<displayname>Lot Number</displayname>
		<attributes>
			<attribute>
				<name>width</name>
				<value>60</value>
			</attribute>
			<attribute>
				<name>text-align</name>
				<value>center</value>
			</attribute>
		</attributes>
	</column>
	<column>
		<name>RRComplete1</name>
		<displayname>RR Complete</displayname>
		<attributes>
			<attribute>
				<name>width</name>
				<value>90</value>
			</attribute>
			<attribute>
				<name>text-align</name>
				<value>center</value>
			</attribute>			
		</attributes>
	</column>
	<column>
		<name>ReviewerName1</name>
		<displayname>Reviewer Name</displayname>
		<attributes>
			<attribute>
				<name>width</name>
				<value>80</value>
			</attribute>
			<attribute>
				<name>text-align</name>
				<value>center</value>
			</attribute>
		</attributes>
	</column>
	<column>
		<name>ReviewStartDate1</name>
		<displayname>Review StartDate</displayname>
		<attributes>
			<attribute>
				<name>width</name>
				<value>20</value>
			</attribute>
			<attribute>
				<name>text-align</name>
				<value>center</value>
			</attribute>
		</attributes>
	</column>
	<column>
		<name>BatchNumber2</name>
		<displayname>Batch Number</displayname>
		<attributes>
			<attribute>
				<name>width</name>
				<value>100</value>
			</attribute>
			<attribute>
				<name>text-align</name>
				<value>left</value>
			</attribute>
		</attributes>
	</column>
	<column>
		<name>VersionCode2</name>
		<displayname>Version Code</displayname>
		<attributes>
			<attribute>
				<name>width</name>
				<value>40</value>
			</attribute>
			<attribute>
				<name>text-align</name>
				<value>right</value>
			</attribute>
		</attributes>
	</column>
	<column>
		<name>MaterialType2</name>
		<displayname>Material Type</displayname>
		<attributes>
			<attribute>
				<name>width</name>
				<value>10</value>
			</attribute>
			<attribute>
				<name>text-align</name>
				<value>left</value>
			</attribute>
		</attributes>
	</column>
	<column>
		<name>LotNumber2</name>
		<displayname>Lot Number</displayname>
		<attributes>
			<attribute>
				<name>width</name>
				<value>60</value>
			</attribute>
			<attribute>
				<name>text-align</name>
				<value>center</value>
			</attribute>
		</attributes>
	</column>
	<column>
		<name>RRComplete2</name>
		<displayname>RR Complete</displayname>
		<attributes>
			<attribute>
				<name>width</name>
				<value>90</value>
			</attribute>
			<attribute>
				<name>text-align</name>
				<value>center</value>
			</attribute>			
		</attributes>
	</column>
	<column>
		<name>ReviewerName2</name>
		<displayname>Reviewer Name</displayname>
		<attributes>
			<attribute>
				<name>width</name>
				<value>80</value>
			</attribute>
			<attribute>
				<name>text-align</name>
				<value>center</value>
			</attribute>
		</attributes>
	</column>
	<column>
		<name>ReviewStartDate2</name>
		<displayname>Review StartDate</displayname>
		<attributes>
			<attribute>
				<name>width</name>
				<value>20</value>
			</attribute>
			<attribute>
				<name>text-align</name>
				<value>center</value>
			</attribute>
		</attributes>
	</column>
	
</columns>

I need to loop througth the xml and need to sum the values of nodes with width.
I need to check if the sum is greater than 600(some value) i need to apply break page style.

My doubt is now how do we achieve througth xsl ?????

You do not need a loop
You have to be sure in which node you are
and then use sum
or use variable

<?xml version="1.0"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

	<xsl:template match="/">

		<xsl:variable name="sumall" select="sum(columns//column/attributes/attribute[name='width']/value)"/>
		<result>
			<item>
				<xsl:apply-templates select="columns"/>
			</item>
			<item>
				<xsl:value-of select="$sumall"/>
			</item>
		</result>
	</xsl:template>
	<xsl:template match="columns">
		<xsl:value-of select="sum(//column/attributes/attribute[name='width']/value)"/>
	</xsl:template>
</xsl:stylesheet>

result

<?xml version='1.0' ?>
<result><item>1530</item><item>1530</item></result>

Hi XML Looser,

The xpath is for giving the total sum, but my need is like if

sum:<xsl:value-of select="sum($ConfigXML/columns/column[position()&lt;2 /attributes/attribute[name='width']/value)"/>

i defined the xpath like this when the sum exceeds 600 i need to apply a page break

now i need to vary the position variable an d nned to check each time whether the valyue is greater than 600 if so i need to apply the pahe break.


please let me know hiow to do this.

is this what you wanted
border 200

<?xml version='1.0' ?>
<result sideborder="200">
  <test>0  data found0</test>
  <test>1  data found100</test>
  <pagenumber>1</pagenumber>
  <test>2  data found300</test>
  <pagenumber>2</pagenumber>
  <test>2  data found400</test>
  <test>2  data found460</test>
  <test>3  data found550</test>
  <pagenumber>3</pagenumber>
  <test>3  data found630</test>
  <test>4  data found730</test>
  <pagenumber>4</pagenumber>
  <test>4  data found830</test>
  <test>4  data found870</test>
  <test>4  data found880</test>
  <test>5  data found940</test>
  <pagenumber>5</pagenumber>
  <test>5  data found1030</test>
  <test>5  data found1110</test>
  <test>6  data found1130</test>
  <pagenumber>6</pagenumber>
  <test>6  data found1230</test>
  <test>6  data found1270</test>
  <test>6  data found1280</test>
  <test>7  data found1340</test>
  <pagenumber>7</pagenumber>
  <test>7  data found1430</test>
  <test>7  data found1510</test>
  <pagenumber>8</pagenumber>
</result>

border 600

<?xml version='1.0' ?>
<result sideborder="600">
  <test>0  data found0</test>
  <test>0  data found100</test>
  <test>0  data found300</test>
  <test>0  data found400</test>
  <test>0  data found460</test>
  <test>1  data found550</test>
  <pagenumber>1</pagenumber>
  <test>1  data found630</test>
  <test>1  data found730</test>
  <test>1  data found830</test>
  <test>1  data found870</test>
  <test>1  data found880</test>
  <test>1  data found940</test>
  <test>1  data found1030</test>
  <test>1  data found1110</test>
  <test>2  data found1130</test>
  <pagenumber>2</pagenumber>
  <test>2  data found1230</test>
  <test>2  data found1270</test>
  <test>2  data found1280</test>
  <test>2  data found1340</test>
  <test>2  data found1430</test>
  <test>2  data found1510</test>
  <pagenumber>3</pagenumber>
</result>

Hi,
Thanks for your reply.
sorry , i dint get u what you explained.
could please explain me in elobarate.

I ll explain in detail what i need to do,


i have an xml

<?xml version="1.0" encoding="UTF-8" ?> 
<?xml-stylesheet type="text/xsl" href="Temp_aj.xsl"?>
<Rowsets DateCreated="2011-02-14T12:24:00" EndDate="2011-02-14T12:24:00" StartDate="2011-02-14T11:24:00" Version="12.0.2 Build(88)">
	<Rowset>
		<Columns>
			<Column Description="BatchNumber" MaxRange="1" MinRange="0" Name="BatchNumber" SQLDataType="12" SourceColumn="BatchNumber" /> 
			<Column Description="VersionCode" MaxRange="1" MinRange="0" Name="VersionCode" SQLDataType="3" SourceColumn="VersionCode" /> 
			<Column Description="MaterialType" MaxRange="1" MinRange="0" Name="MaterialType" SQLDataType="12" SourceColumn="MaterialType" /> 
			<Column Description="LotNumber" MaxRange="1" MinRange="0" Name="LotNumber" SQLDataType="4" SourceColumn="LotNumber" /> 
			<Column Description="RRComplete" MaxRange="1" MinRange="0" Name="RRComplete" SQLDataType="-6" SourceColumn="RRComplete" /> 
			<Column Description="ReviewerName" MaxRange="1" MinRange="0" Name="ReviewerName" SQLDataType="12" SourceColumn="ReviewerName" /> 
			<Column Description="ReviewStartDate" MaxRange="1" MinRange="0" Name="ReviewStartDate" SQLDataType="93" SourceColumn="ReviewStartDate" />
			<Column Description="BatchNumber1" MaxRange="1" MinRange="0" Name="BatchNumber1" SQLDataType="12" SourceColumn="BatchNumber1" /> 
			<Column Description="VersionCode1" MaxRange="1" MinRange="0" Name="VersionCode1" SQLDataType="3" SourceColumn="VersionCode1" /> 
			<Column Description="MaterialType1" MaxRange="1" MinRange="0" Name="MaterialType" SQLDataType="12" SourceColumn="MaterialType" /> 
			<Column Description="LotNumber1" MaxRange="1" MinRange="0" Name="LotNumber1" SQLDataType="4" SourceColumn="LotNumber1" /> 
			<Column Description="RRComplete1" MaxRange="1" MinRange="0" Name="RRComplete1" SQLDataType="-6" SourceColumn="RRComplete1" /> 
			<Column Description="ReviewerName1" MaxRange="1" MinRange="0" Name="ReviewerName1" SQLDataType="12" SourceColumn="ReviewerName1" /> 
			<Column Description="ReviewStartDate1" MaxRange="1" MinRange="0" Name="ReviewStartDate1" SQLDataType="93" SourceColumn="ReviewStartDate1" />
			<Column Description="BatchNumber2" MaxRange="1" MinRange="0" Name="BatchNumber2" SQLDataType="12" SourceColumn="BatchNumber2" /> 
			<Column Description="VersionCode2" MaxRange="1" MinRange="0" Name="VersionCode2" SQLDataType="3" SourceColumn="VersionCode2" /> 
			<Column Description="MaterialType2" MaxRange="1" MinRange="0" Name="MaterialType2" SQLDataType="12" SourceColumn="MaterialType2" /> 
			<Column Description="LotNumber2" MaxRange="1" MinRange="0" Name="LotNumber2" SQLDataType="4" SourceColumn="LotNumber2" /> 
			<Column Description="RRComplete2" MaxRange="1" MinRange="0" Name="RRComplete2" SQLDataType="-6" SourceColumn="RRComplete2" /> 
			<Column Description="ReviewerName2" MaxRange="1" MinRange="0" Name="ReviewerName2" SQLDataType="12" SourceColumn="ReviewerName2" /> 
			<Column Description="ReviewStartDate2" MaxRange="1" MinRange="0" Name="ReviewStartDate2" SQLDataType="93" SourceColumn="ReviewStartDate2" />
		</Columns>
	<Row>
		<BatchNumber>A12345</BatchNumber> 
		<VersionCode>1</VersionCode> 
		<MaterialType>Raw</MaterialType> 
		<LotNumber>12345</LotNumber> 
		<RRComplete>0</RRComplete> 
		<ReviewerName>Ankit</ReviewerName> 
		<ReviewStartDate>2011-02-08T00:00:00</ReviewStartDate> 
		<BatchNumber1>A12345</BatchNumber1> 
		<VersionCode1>1</VersionCode1> 
		<MaterialType1>Raw</MaterialType1> 
		<LotNumber1>12345</LotNumber1> 
		<RRComplete1>0</RRComplete1> 
		<ReviewerName1>Ankit</ReviewerName1> 
		<ReviewStartDate1>2011-02-08T00:00:00</ReviewStartDate1> 
		<BatchNumber2>A12345</BatchNumber2> 
		<VersionCode2>1</VersionCode2> 
		<MaterialType2>Raw</MaterialType2> 
		<LotNumber2>12345</LotNumber2> 
		<RRComplete2>0</RRComplete2> 
		<ReviewerName2>Ankit</ReviewerName2> 
		<ReviewStartDate2>2011-02-08T00:00:00</ReviewStartDate2> 
	</Row>
	<Row>
		<BatchNumber>A12345</BatchNumber> 
		<VersionCode>1</VersionCode> 
		<MaterialType>Raw</MaterialType> 
		<LotNumber>12345</LotNumber> 
		<RRComplete>0</RRComplete> 
		<ReviewerName>Ankit</ReviewerName> 
		<ReviewStartDate>2011-02-08T00:00:00</ReviewStartDate> 
		<BatchNumber1>A12345</BatchNumber1> 
		<VersionCode1>1</VersionCode1> 
		<MaterialType1>Raw</MaterialType1> 
		<LotNumber1>12345</LotNumber1> 
		<RRComplete1>0</RRComplete1> 
		<ReviewerName1>Ankit</ReviewerName1> 
		<ReviewStartDate1>2011-02-08T00:00:00</ReviewStartDate1> 
		<BatchNumber2>A12345</BatchNumber2> 
		<VersionCode2>1</VersionCode2> 
		<MaterialType2>Raw</MaterialType2> 
		<LotNumber2>12345</LotNumber2> 
		<RRComplete2>0</RRComplete2> 
		<ReviewerName2>Ankit</ReviewerName2> 
		<ReviewStartDate2>2011-02-08T00:00:00</ReviewStartDate2> 
	</Row>
	<Row>
		<BatchNumber>A12345</BatchNumber> 
		<VersionCode>1</VersionCode> 
		<MaterialType>Raw</MaterialType> 
		<LotNumber>12345</LotNumber> 
		<RRComplete>0</RRComplete> 
		<ReviewerName>Ankit</ReviewerName> 
		<ReviewStartDate>2011-02-08T00:00:00</ReviewStartDate> 
		<BatchNumber1>A12345</BatchNumber1> 
		<VersionCode1>1</VersionCode1> 
		<MaterialType1>Raw</MaterialType1> 
		<LotNumber1>12345</LotNumber1> 
		<RRComplete1>0</RRComplete1> 
		<ReviewerName1>Ankit</ReviewerName1> 
		<ReviewStartDate1>2011-02-08T00:00:00</ReviewStartDate1> 
		<BatchNumber2>A12345</BatchNumber2> 
		<VersionCode2>1</VersionCode2> 
		<MaterialType2>Raw</MaterialType2> 
		<LotNumber2>12345</LotNumber2> 
		<RRComplete2>0</RRComplete2> 
		<ReviewerName2>Ankit</ReviewerName2> 
		<ReviewStartDate2>2011-02-08T00:00:00</ReviewStartDate2> 
	</Row>
	<Row>
		<BatchNumber>A12345</BatchNumber> 
		<VersionCode>1</VersionCode> 
		<MaterialType>Raw</MaterialType> 
		<LotNumber>12345</LotNumber> 
		<RRComplete>0</RRComplete> 
		<ReviewerName>Ankit</ReviewerName> 
		<ReviewStartDate>2011-02-08T00:00:00</ReviewStartDate> 
		<BatchNumber1>A12345</BatchNumber1> 
		<VersionCode1>1</VersionCode1> 
		<MaterialType1>Raw</MaterialType1> 
		<LotNumber1>12345</LotNumber1> 
		<RRComplete1>0</RRComplete1> 
		<ReviewerName1>Ankit</ReviewerName1> 
		<ReviewStartDate1>2011-02-08T00:00:00</ReviewStartDate1> 
		<BatchNumber2>A12345</BatchNumber2> 
		<VersionCode2>1</VersionCode2> 
		<MaterialType2>Raw</MaterialType2> 
		<LotNumber2>12345</LotNumber2> 
		<RRComplete2>0</RRComplete2> 
		<ReviewerName2>Ankit</ReviewerName2> 
		<ReviewStartDate2>2011-02-08T00:00:00</ReviewStartDate2> 
	</Row>
	<Row>
		<BatchNumber>A12345</BatchNumber> 
		<VersionCode>1</VersionCode> 
		<MaterialType>Raw</MaterialType> 
		<LotNumber>12345</LotNumber> 
		<RRComplete>0</RRComplete> 
		<ReviewerName>Ankit</ReviewerName> 
		<ReviewStartDate>2011-02-08T00:00:00</ReviewStartDate> 
		<BatchNumber1>A12345</BatchNumber1> 
		<VersionCode1>1</VersionCode1> 
		<MaterialType1>Raw</MaterialType1> 
		<LotNumber1>12345</LotNumber1> 
		<RRComplete1>0</RRComplete1> 
		<ReviewerName1>Ankit</ReviewerName1> 
		<ReviewStartDate1>2011-02-08T00:00:00</ReviewStartDate1> 
		<BatchNumber2>A12345</BatchNumber2> 
		<VersionCode2>1</VersionCode2> 
		<MaterialType2>Raw</MaterialType2> 
		<LotNumber2>12345</LotNumber2> 
		<RRComplete2>0</RRComplete2> 
			<ReviewerName2>Ankit</ReviewerName2>  
		<ReviewStartDate2>2011-02-08T00:00:00</ReviewStartDate2> 
	</Row>
	<Row>
		<BatchNumber>A12345</BatchNumber> 
		<VersionCode>1</VersionCode> 
		<MaterialType>Raw</MaterialType> 
		<LotNumber>12345</LotNumber> 
		<RRComplete>0</RRComplete> 
		<ReviewerName>Ankit</ReviewerName> 
		<ReviewStartDate>2011-02-08T00:00:00</ReviewStartDate> 
		<BatchNumber1>A12345</BatchNumber1> 
		<VersionCode1>1</VersionCode1> 
		<MaterialType1>Raw</MaterialType1> 
		<LotNumber1>12345</LotNumber1> 
		<RRComplete1>0</RRComplete1> 
		<ReviewerName1>Ankit</ReviewerName1> 
		<ReviewStartDate1>2011-02-08T00:00:00</ReviewStartDate1> 
		<BatchNumber2>A12345</BatchNumber2> 
		<VersionCode2>1</VersionCode2> 
		<MaterialType2>Raw</MaterialType2> 
		<LotNumber2>12345</LotNumber2> 
		<RRComplete2>0</RRComplete2> 
		<ReviewerName2>Ankit</ReviewerName2>  
		<ReviewStartDate2>2011-02-08T00:00:00</ReviewStartDate2> 
	</Row>
	<Row>
		<BatchNumber>A12345</BatchNumber> 
		<VersionCode>1</VersionCode> 
		<MaterialType>Raw</MaterialType> 
		<LotNumber>12345</LotNumber> 
		<RRComplete>0</RRComplete> 
		<ReviewerName>Ankit</ReviewerName> 
		<ReviewStartDate>2011-02-08T00:00:00</ReviewStartDate> 
		<BatchNumber1>A12345</BatchNumber1> 
		<VersionCode1>1</VersionCode1> 
		<MaterialType1>Raw</MaterialType1> 
		<LotNumber1>12345</LotNumber1> 
		<RRComplete1>0</RRComplete1> 
		<ReviewerName1>Ankit</ReviewerName1> 
		<ReviewStartDate1>2011-02-08T00:00:00</ReviewStartDate1> 
		<BatchNumber2>A12345</BatchNumber2> 
		<VersionCode2>1</VersionCode2> 
		<MaterialType2>Raw</MaterialType2> 
		<LotNumber2>12345</LotNumber2> 
		<RRComplete2>0</RRComplete2> 
			<ReviewerName2>Ankit</ReviewerName2> 
		<ReviewStartDate2>2011-02-08T00:00:00</ReviewStartDate2> 
	</Row>
	<Row>
		<BatchNumber>A12345</BatchNumber> 
		<VersionCode>1</VersionCode> 
		<MaterialType>Raw</MaterialType> 
		<LotNumber>12345</LotNumber> 
		<RRComplete>0</RRComplete> 
		<ReviewerName>Ankit</ReviewerName> 
		<ReviewStartDate>2011-02-08T00:00:00</ReviewStartDate> 
		<BatchNumber1>A12345</BatchNumber1> 
		<VersionCode1>1</VersionCode1> 
		<MaterialType1>Raw</MaterialType1> 
		<LotNumber1>12345</LotNumber1> 
		<RRComplete1>0</RRComplete1> 
		<ReviewerName1>Ankit</ReviewerName1> 
		<ReviewStartDate1>2011-02-08T00:00:00</ReviewStartDate1> 
		<BatchNumber2>A12345</BatchNumber2> 
		<VersionCode2>1</VersionCode2> 
		<MaterialType2>Raw</MaterialType2> 
		<LotNumber2>12345</LotNumber2> 
		<RRComplete2>0</RRComplete2> 
		<ReviewerName2>Ankit</ReviewerName2> 
		<ReviewStartDate2>2011-02-08T00:00:00</ReviewStartDate2> 
	</Row>
	<Row>
		<BatchNumber>A12345</BatchNumber> 
		<VersionCode>1</VersionCode> 
		<MaterialType>Raw</MaterialType> 
		<LotNumber>12345</LotNumber> 
		<RRComplete>0</RRComplete> 
		<ReviewerName>Ankit</ReviewerName> 
		<ReviewStartDate>2011-02-08T00:00:00</ReviewStartDate> 
		<BatchNumber1>A12345</BatchNumber1> 
		<VersionCode1>1</VersionCode1> 
		<MaterialType1>Raw</MaterialType1> 
		<LotNumber1>12345</LotNumber1> 
		<RRComplete1>0</RRComplete1> 
		<ReviewerName1>Ankit</ReviewerName1> 
		<ReviewStartDate1>2011-02-08T00:00:00</ReviewStartDate1> 
		<BatchNumber2>A12345</BatchNumber2> 
		<VersionCode2>1</VersionCode2> 
		<MaterialType2>Raw</MaterialType2> 
		<LotNumber2>12345</LotNumber2> 
		<RRComplete2>0</RRComplete2> 
		<ReviewerName2>Ankit</ReviewerName2> 
		<ReviewStartDate2>2011-02-08T00:00:00</ReviewStartDate2> 
	</Row>
	<Row>
		<BatchNumber>A12345</BatchNumber> 
		<VersionCode>1</VersionCode> 
		<MaterialType>Raw</MaterialType> 
		<LotNumber>12345</LotNumber> 
		<RRComplete>0</RRComplete> 
		<ReviewerName>Ankit</ReviewerName> 
		<ReviewStartDate>2011-02-08T00:00:00</ReviewStartDate> 
		<BatchNumber1>A12345</BatchNumber1> 
		<VersionCode1>1</VersionCode1> 
		<MaterialType1>Raw</MaterialType1> 
		<LotNumber1>12345</LotNumber1> 
		<RRComplete1>0</RRComplete1> 
		<ReviewerName1>Ankit</ReviewerName1> 
		<ReviewStartDate1>2011-02-08T00:00:00</ReviewStartDate1> 
		<BatchNumber2>A12345</BatchNumber2> 
		<VersionCode2>1</VersionCode2> 
		<MaterialType2>Raw</MaterialType2> 
		<LotNumber2>12345</LotNumber2> 
		<RRComplete2>0</RRComplete2> 
		<ReviewerName2>Ankit</ReviewerName2>  
		<ReviewStartDate2>2011-02-08T00:00:00</ReviewStartDate2> 
	</Row>
	<Row>
		<BatchNumber>A12345</BatchNumber> 
		<VersionCode>1</VersionCode> 
		<MaterialType>Raw</MaterialType> 
		<LotNumber>12345</LotNumber> 
		<RRComplete>0</RRComplete> 
		<ReviewerName>Ankit</ReviewerName> 
		<ReviewStartDate>2011-02-08T00:00:00</ReviewStartDate> 
		<BatchNumber1>A12345</BatchNumber1> 
		<VersionCode1>1</VersionCode1> 
		<MaterialType1>Raw</MaterialType1> 
		<LotNumber1>12345</LotNumber1> 
		<RRComplete1>0</RRComplete1> 
		<ReviewerName1>Ankit</ReviewerName1> 
		<ReviewStartDate1>2011-02-08T00:00:00</ReviewStartDate1> 
		<BatchNumber2>A12345</BatchNumber2> 
		<VersionCode2>1</VersionCode2> 
		<MaterialType2>Raw</MaterialType2> 
		<LotNumber2>12345</LotNumber2> 
		<RRComplete2>0</RRComplete2> 
		<ReviewerName2>Ankit</ReviewerName2> 
		<ReviewStartDate2>2011-02-08T00:00:00</ReviewStartDate2> 
	</Row>
	<Row>
		<BatchNumber>A12345</BatchNumber> 
		<VersionCode>1</VersionCode> 
		<MaterialType>Raw</MaterialType> 
		<LotNumber>12345</LotNumber> 
		<RRComplete>0</RRComplete> 
		<ReviewerName>Ankit</ReviewerName> 
		<ReviewStartDate>2011-02-08T00:00:00</ReviewStartDate> 
		<BatchNumber1>A12345</BatchNumber1> 
		<VersionCode1>1</VersionCode1> 
		<MaterialType1>Raw</MaterialType1> 
		<LotNumber1>12345</LotNumber1> 
		<RRComplete1>0</RRComplete1> 
		<ReviewerName1>Ankit</ReviewerName1> 
		<ReviewStartDate1>2011-02-08T00:00:00</ReviewStartDate1> 
		<BatchNumber2>A12345</BatchNumber2> 
		<VersionCode2>1</VersionCode2> 
		<MaterialType2>Raw</MaterialType2> 
		<LotNumber2>12345</LotNumber2> 
		<RRComplete2>0</RRComplete2> 
		<ReviewerName2>Ankit</ReviewerName2> 
		<ReviewStartDate2>2011-02-08T00:00:00</ReviewStartDate2> 
	</Row>
	<Row>
		<BatchNumber>A12345</BatchNumber> 
		<VersionCode>1</VersionCode> 
		<MaterialType>Raw</MaterialType> 
		<LotNumber>12345</LotNumber> 
		<RRComplete>0</RRComplete> 
		<ReviewerName>Ankit</ReviewerName> 
		<ReviewStartDate>2011-02-08T00:00:00</ReviewStartDate> 
		<BatchNumber1>A12345</BatchNumber1> 
		<VersionCode1>1</VersionCode1> 
		<MaterialType1>Raw</MaterialType1> 
		<LotNumber1>12345</LotNumber1> 
		<RRComplete1>0</RRComplete1> 
		<ReviewerName1>Ankit</ReviewerName1> 
		<ReviewStartDate1>2011-02-08T00:00:00</ReviewStartDate1> 
		<BatchNumber2>A12345</BatchNumber2> 
		<VersionCode2>1</VersionCode2> 
		<MaterialType2>Raw</MaterialType2> 
		<LotNumber2>12345</LotNumber2> 
		<RRComplete2>0</RRComplete2> 
		<ReviewerName2>Ankit</ReviewerName2> 
		<ReviewStartDate2>2011-02-08T00:00:00</ReviewStartDate2> 
	</Row>
	
	</Rowset>
</Rowsets>

and i have one more xml

<?xml version="1.0" encoding="UTF-8"?>
<columns>
	<column>
		<name></name>
		<displayname></displayname>
		<attributes>
			<attribute>
				<name>width</name>
				<value>100</value>
			</attribute>
			<attribute>
				<name>text-align</name>
				<value>left</value>
			</attribute>
		</attributes>
	</column>
	<column>
		<name>VersionCode</name>
		<displayname>Version Code</displayname>
		<attributes>
			<attribute>
				<name>width</name>
				<value>200</value>
			</attribute>
			<attribute>
				<name>text-align</name>
				<value>right</value>
			</attribute>
		</attributes>
	</column>
	<column>
		<name>MaterialType</name>
		<displayname>Material Type</displayname>
		<attributes>
			<attribute>
				<name>width</name>
				<value>100</value>
			</attribute>
			<attribute>
				<name>text-align</name>
				<value>left</value>
			</attribute>
		</attributes>
	</column>
	<column>
		<name>LotNumber</name>
		<displayname>Lot Number</displayname>
		<attributes>
			<attribute>
				<name>width</name>
				<value>60</value>
			</attribute>
			<attribute>
				<name>text-align</name>
				<value>center</value>
			</attribute>
		</attributes>
	</column>
	<column>
		<name>RRComplete</name>
		<displayname>RR Complete</displayname>
		<attributes>
			<attribute>
				<name>width</name>
				<value>90</value>
			</attribute>
			<attribute>
				<name>text-align</name>
				<value>center</value>
			</attribute>			
		</attributes>
	</column>
	<column>
		<name>ReviewerName</name>
		<displayname>Reviewer Name</displayname>
		<attributes>
			<attribute>
				<name>width</name>
				<value>80</value>
			</attribute>
			<attribute>
				<name>text-align</name>
				<value>center</value>
			</attribute>
		</attributes>
	</column>
	<column>
		<name>ReviewStartDate</name>
		<displayname>Review StartDate</displayname>
		<attributes>
			<attribute>
				<name>width</name>
				<value>100</value>
			</attribute>
			<attribute>
				<name>text-align</name>
				<value>center</value>
			</attribute>
		</attributes>
	</column>
	<column>
		<name>BatchNumber1</name>
		<displayname>Batch Number</displayname>
		<attributes>
			<attribute>
				<name>width</name>
				<value>100</value>
			</attribute>
			<attribute>
				<name>text-align</name>
				<value>left</value>
			</attribute>
		</attributes>
	</column>
	<column>
		<name>VersionCode1</name>
		<displayname>Version Code</displayname>
		<attributes>
			<attribute>
				<name>width</name>
				<value>40</value>
			</attribute>
			<attribute>
				<name>text-align</name>
				<value>right</value>
			</attribute>
		</attributes>
	</column>
	<column>
		<name>MaterialType1</name>
		<displayname>Material Type</displayname>
		<attributes>
			<attribute>
				<name>width</name>
				<value>10</value>
			</attribute>
			<attribute>
				<name>text-align</name>
				<value>left</value>
			</attribute>
		</attributes>
	</column>
	<column>
		<name>LotNumber1</name>
		<displayname>Lot Number</displayname>
		<attributes>
			<attribute>
				<name>width</name>
				<value>60</value>
			</attribute>
			<attribute>
				<name>text-align</name>
				<value>center</value>
			</attribute>
		</attributes>
	</column>
	<column>
		<name>RRComplete1</name>
		<displayname>RR Complete</displayname>
		<attributes>
			<attribute>
				<name>width</name>
				<value>90</value>
			</attribute>
			<attribute>
				<name>text-align</name>
				<value>center</value>
			</attribute>			
		</attributes>
	</column>
	<column>
		<name>ReviewerName1</name>
		<displayname>Reviewer Name</displayname>
		<attributes>
			<attribute>
				<name>width</name>
				<value>80</value>
			</attribute>
			<attribute>
				<name>text-align</name>
				<value>center</value>
			</attribute>
		</attributes>
	</column>
	<column>
		<name>ReviewStartDate1</name>
		<displayname>Review StartDate</displayname>
		<attributes>
			<attribute>
				<name>width</name>
				<value>20</value>
			</attribute>
			<attribute>
				<name>text-align</name>
				<value>center</value>
			</attribute>
		</attributes>
	</column>
	<column>
		<name>BatchNumber2</name>
		<displayname>Batch Number</displayname>
		<attributes>
			<attribute>
				<name>width</name>
				<value>100</value>
			</attribute>
			<attribute>
				<name>text-align</name>
				<value>left</value>
			</attribute>
		</attributes>
	</column>
	<column>
		<name>VersionCode2</name>
		<displayname>Version Code</displayname>
		<attributes>
			<attribute>
				<name>width</name>
				<value>40</value>
			</attribute>
			<attribute>
				<name>text-align</name>
				<value>right</value>
			</attribute>
		</attributes>
	</column>
	<column>
		<name>MaterialType2</name>
		<displayname>Material Type</displayname>
		<attributes>
			<attribute>
				<name>width</name>
				<value>10</value>
			</attribute>
			<attribute>
				<name>text-align</name>
				<value>left</value>
			</attribute>
		</attributes>
	</column>
	<column>
		<name>LotNumber2</name>
		<displayname>Lot Number</displayname>
		<attributes>
			<attribute>
				<name>width</name>
				<value>60</value>
			</attribute>
			<attribute>
				<name>text-align</name>
				<value>center</value>
			</attribute>
		</attributes>
	</column>
	<column>
		<name>RRComplete2</name>
		<displayname>RR Complete</displayname>
		<attributes>
			<attribute>
				<name>width</name>
				<value>90</value>
			</attribute>
			<attribute>
				<name>text-align</name>
				<value>center</value>
			</attribute>			
		</attributes>
	</column>
	<column>
		<name>ReviewerName2</name>
		<displayname>Reviewer Name</displayname>
		<attributes>
			<attribute>
				<name>width</name>
				<value>80</value>
			</attribute>
			<attribute>
				<name>text-align</name>
				<value>center</value>
			</attribute>
		</attributes>
	</column>
	<column>
		<name>ReviewStartDate2</name>
		<displayname>Review StartDate</displayname>
		<attributes>
			<attribute>
				<name>width</name>
				<value>20</value>
			</attribute>
			<attribute>
				<name>text-align</name>
				<value>center</value>
			</attribute>
		</attributes>
	</column>
	
</columns>

and i have wrtten xn xslt fot his to generate a report

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:java="http://xml.apache.org/xslt/java" exclude-result-prefixes="java">

<xsl:param name="FooterText">Footer Details for Example  Phone:123456789   Fax:12345 Mail to : abc@xyz.com</xsl:param>
<xsl:param name="ReportHeaderText">BATCH DETAILS REPORT</xsl:param>
<xsl:param name="ReportTitle">In Process Batch Details</xsl:param>
<xsl:param name="NumberOfRowsInPage">15</xsl:param>
<xsl:param name="CompanyLogo">report1.bmp</xsl:param>
<xsl:param name="CompanyNameImage">ABC_Company.gif</xsl:param>
<xsl:param name="HeaderFillerCnt" select="1"/>
<xsl:param name="MiddleFillerCnt" select="1"/>
<xsl:param name="FooterFillerCnt" select="1"/>
<xsl:param name="PortraitPageWidth" select="600"/>

<xsl:variable name="ConfigXML" select="document('ConfigXML.xml')"/>


<xsl:template match="/">
    <xsl:apply-templates select="Rowsets/Rowset"/>
</xsl:template>

<xsl:template match="Rowsets/Rowset">

<html>
<head>
<title><xsl:value-of select="$ReportTitle"/></title>
<style>
*{
    font: 8pt verdana;
}
body {
	background-color:#F6F7FB;
	display: block;
	page: Report;
	counter-reset: page 1
}
<!-- Sizing the page -->
@page { size: A4 landscape; } 

<!-- Conter to show line number while printing -->
@page main {
    @top { content: string(chapter-title) }
    @bottom {
        content: "Page " counter(page) " of " counter(pages)
    }
}
chapter title { string-set: chapter-title content() }

table { empty-cells: show; border-spacing: 0px; margin: 0px; padding: 0px;  align:center}
	.pagebreak {page-break-after: always;}
	.tableReportHeader{border-top: solid #4A6ACC 1px; border-left: solid #4A6ACC 1px; border-right: solid #4A6ACC 1px; width: 645px;}
	.tabledetails{border-left: solid #4A6ACC 1px; border-right: solid #4A6ACC 1px;  width: 645px; }
	.tableReportFooter{bottom: 2px;border-bottom: solid #4A6ACC 1px; border-left: solid #4A6ACC 1px; border-right: solid #4A6ACC 1px;  width: 645px;}
	.imglogo{border-style: none; vertical-align: top; border-color: #F6F7FB;}
	td{vertical-align: top; font-family: Arial, Helvetica, sans-serif; font-size: 9pt}
	.tdmargin{width:10px;}
	.documentheader{font-family:Arial; font-size:9pt; color:#4A6ACC; font-weight:bold;}
	th{font-family:Arial; font-size:8pt; color:white; background-color: #4A6ACC; text-align:center;border: solid 1px darkblue;}
	.tdorderHeader{border: solid 1px #4A6ACC;}
	.blueline{border-bottom: solid #4A6ACC 1px;}
	.documenttotal{font-family:Arial; font-size:9pt; color:#4A6ACC; font-weight:bold;border-bottom: solid #4A6ACC 1px;}
	.tdtotalmargin{width:450px;}
</style>

</head>

<body>
	<!--<xsl:value-of select="count($ConfigXML//name)"/>
	<xsl:for-each select="$ConfigXML//name">
		<xsl:value-of select="."/><xsl:value-of select="translate(' ', ' ', '&#160;')"/>
	</xsl:for-each>-->

	<xsl:copy-of select="$ReportHeader"/> <!-- Company Logo, Name -->

	<xsl:call-template name="Filler">
		<xsl:with-param name="fillercount" select="$HeaderFillerCnt" />
	</xsl:call-template>

	<xsl:copy-of select="$middleSection"/> <!-- Section to specify Additional Details -->

	<xsl:call-template name="Filler">
		<xsl:with-param name="fillercount" select="$MiddleFillerCnt" />
	</xsl:call-template>

	<xsl:copy-of select="$ContentRowsHeader"/>

	<xsl:for-each select="//Row">
		<table class="tabledetails" cellspacing="0" style="table-layout:fixed">
			<tr>
				<xsl:for-each select="*">
					<td width="70px" class="blueline"><xsl:value-of select="."/></td>
				</xsl:for-each>
			</tr>
		</table>
		
		<xsl:if test="(position() mod $NumberOfRowsInPage) = 0 or (not((position() mod $NumberOfRowsInPage) = 0) and position()=last())">
			<xsl:call-template name="Filler">
					<xsl:with-param name="fillercount" select="$FooterFillerCnt" />
				</xsl:call-template>

				<xsl:copy-of select="$ReportFooter" />
		</xsl:if>

		<xsl:if test="(position() mod $NumberOfRowsInPage) = 0 ">
			<br class="pagebreak" />
			
			<xsl:if test="not(position()=last())">
				<xsl:copy-of select="$ReportHeader" />

				<xsl:call-template name="Filler">
					<xsl:with-param name="fillercount" select="$HeaderFillerCnt" />
				</xsl:call-template>

				<xsl:copy-of select="$middleSection"/> <!-- Section to specify Additional Details -->

				<xsl:call-template name="Filler">
					<xsl:with-param name="fillercount" select="$MiddleFillerCnt" />
				</xsl:call-template>
				<xsl:copy-of select="$ContentRowsHeader"/>
			</xsl:if >
		</xsl:if>
	 </xsl:for-each>

</body>

</html>

</xsl:template>

<!-- ContentTableHeader -->
<xsl:variable name="ContentTableHeader">
	<table class="tabledetails" cellspacing="0" style="table-layout:fixed" border="2"><tr>
		<th colspan="2"><xsl:value-of select="$ReportTitle"/></th>		
	</tr></table>
</xsl:variable>


<!-- variable Miidle Section-->
<xsl:variable name="middleSection">
	<table class="tabledetails" cellspacing="0" style="table-layout:fixed"><tr>
		<td class="documentheader"  align="right">Batch #:</td>
		<td><xsl:value-of select="//Row/BatchNumber"/></td>
		<td class="documentheader" align="right">Reviewer Name:</td>
		<td><xsl:value-of select="//Row/ReviewerName" /></td>
	</tr></table>
</xsl:variable>


<!-- variable ReportHeader-->
<xsl:variable name="ReportHeader">
	<table class="tableReportHeader" cellspacing="0"><tr>
		<td><img class="imglogo"><xsl:attribute name="src"><xsl:value-of select="$CompanyLogo"/></xsl:attribute></img></td>
		<td><img ><xsl:attribute name="src"><xsl:value-of select="$CompanyNameImage"/></xsl:attribute></img></td>
		<td align="right"><h3 style="color:darkblue; font-family: Arial;"><xsl:value-of select="$ReportHeaderText"/></h3></td>
	</tr></table>
</xsl:variable>

<!-- Template Filler-->
<xsl:template name="Filler">
	<xsl:param name="fillercount"/>
	<xsl:if test="$fillercount > 0">
		<table class="tabledetails"><tr><td>
			<xsl:value-of select="translate(' ', ' ', '&#160;')"/>
		</td></tr></table>

		<xsl:call-template name="Filler">
			<xsl:with-param name="fillercount" select="$fillercount - 1"/>
		</xsl:call-template>
	</xsl:if>
</xsl:template>

<!-- variable ReportFooter-->
<xsl:variable name="ReportFooter">
	<table class="tableReportFooter">
		<tr><td style="width:20px;"></td>
			<td><table><tr><td style="font-size:8pt; text-align: justify;border-top: solid #4A6ACC 1px;">
				<xsl:value-of select="$FooterText"/>
			</td></tr></table></td>
		<td style="width:20px;"></td></tr>	
	</table>
</xsl:variable>

<!--variable ContentRowsHeader-->
<xsl:variable name="ContentRowsHeader">
	<table class="tabledetails" cellspacing="0" style="table-layout:fixed">
		<thead>
			<xsl:variable name="colWidthSum" select="count($ConfigXML/columns/column) div 2" />
		`	<xsl:for-each select="$ConfigXML//column">
				<!-- <xsl:variable name="sum" select="sum($ConfigXML/columns/column[position()&lt; $colWidthSum]/attributes/attribute[name='width']/value)"/>
				<xsl:if test="$sum &gt; $PortraitPageWidth and $ConfigXML/columns/column[position()=$colWidthSum]">
					<br class="pagebreak" />
				</xsl:if>-->
				<!--<xsl:call-template name="calcColWidthSum">
					<xsl:with-param name="sumValue">0</xsl:with-param>
					<xsl:with-param name="nextPosition">0</xsl:with-param>
				</xsl:call-template>-->
				<xsl:variable name="colName" select="name"/>
				<th>
					<xsl:for-each select="$ConfigXML//column[name=$colName]/attributes/attribute">
						<xsl:variable name="attrName" select="name"/>
						<xsl:attribute name="{$attrName}">
							<xsl:value-of select="value" />
						</xsl:attribute>
					</xsl:for-each>
					<xsl:choose>
						<xsl:when test="not(string(displayname)='')">
							<xsl:value-of select="displayname"/>
						</xsl:when>
						<xsl:when test="(string(displayname)='') and not(string(name)='')">
							<xsl:value-of select="name"/>
						</xsl:when>
						<xsl:otherwise>
						<!--	Not Defined -->
							
						</xsl:otherwise>
					</xsl:choose>
				</th>
			</xsl:for-each>
		</thead>
	</table>
</xsl:variable>


<!--<xsl:template name="calcColWidthSum">
	<xsl:param name="sumValue"/>
	<xsl:param name="nextPosition"/>
	
	<xsl:choose>
		<xsl:when test="$sumValue &lt;= $PortraitPageWidth">
			<xsl:variable name="nextPos" select="$nextPosition + 1"/>
			<xsl:variable name="sum" select="sum($ConfigXML/columns/column[$nextPosition]/attributes/attribute[name='width']/value)"/>
			$nextPosition = <xsl:value-of select="$nextPosition"/>
			$sumValue = <xsl:value-of select="$sumValue"/>
			<xsl:call-template name="calcColWidthSum">
				<xsl:with-param name="sumValue" select="$sum"/>
				<xsl:with-param name="nextPosition" select="$nextPos"/>
			</xsl:call-template>
		</xsl:when>
		<xsl:otherwise>			
			<xsl:variable name="pos" select="$nextPosition - 1"/>
			calcColWidhtSum = <xsl:value-of select="sum($ConfigXML/columns/column[$pos]/attributes/attribute[name='width']/value)"/>
		</xsl:otherwise>
	</xsl:choose>
</xsl:template>
-->

</xsl:stylesheet>

The first xml is the data xml and secon xml is for configration.
now when i loop throught the second xml and when the width is greter then 600 px i need to put the columns in the next page.
I know we need to do recursive call for getting sum but i am not able to do that.
If see the output there are columns which will exceed the screen width , i need to place those columns in the next page.

it hard for me to understand your xsl
I do not much there that my spelling and punctuation of my imagination

does that mean I do not understand it and I'm not wasting my free time


I have an example there are data inside the summed
and if the ceiling is constructed, a new page appears