traversing through a loop in xsl
Take this XSL:
<xsl:variable name="rowcount" select="count(../DBE:Object[@Class='A']/DBE:Attribute [@name='B']/DBE:Table/DBE:TableRow)"/>
No. of Rows: - <xsl:value-of select="$rowcount"/>
I get the output as
No. of Rows: - 10
Now how to write a loop in xsl to traverse each row till the 10th row?
I want to display all the rows of a table till the end of table is encountered.
So, in a way need to traverse through the loop and display first row and then automatically position() or counter should be incremented and then display the second row in the second line and so on....
Suppose no. of rows in a table = 10 Header --> A B C row1 --> 10 abc 20 row2 --> 20 def 10 .... .... row10 --> 30 xyz 40
P开发者_StackOverflowlease let me know how to achieve the above output?
You use a selector over the rows and a foreach: http://www.w3schools.com/Xsl/xsl_for_each.asp. You can keep it under the 10th row by using a qualifier like [position() < 10].
Use this XPath expression: .../DBE:TableRow[position()<10]
精彩评论