|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: Newbie question: Incrementing the position in the
At 2004-04-12 13:41 -0600, Durston, Andrew (AGRE) wrote:
I have a set of XML outputs from a database which splits a table into individual cells - By jumping periodically through the cells and then only looking at the immediately-surrounding area. I hope the example below helps to give you an idea of what to do in your situation; I've generalized it for a period of "n" entries. ........................ Ken
<xsl:output indent="yes"/> <xsl:variable name="n" select="4"/> <xsl:template match="object">
<xsl:for-each select="cell[position() mod $n = 1]">
<group>
<xsl:for-each select=". | following-sibling::cell[position()<$n]">
<xsl:copy-of select="."/>
</xsl:for-each>
</group>
</xsl:for-each>
</xsl:template></xsl:stylesheet> T:\ftemp>saxon durston.xml durston.xsl <?xml version="1.0" encoding="utf-8"?> <group> <cell>1</cell> <cell>2</cell> <cell>3</cell> <cell>4</cell> </group> <group> <cell>5</cell> <cell>6</cell> <cell>7</cell> <cell>8</cell> </group> <group> <cell>9</cell> <cell>10</cell> <cell>11</cell> <cell>12</cell> </group> <group> <cell>13</cell> <cell>14</cell> <cell>15</cell> <cell>16</cell> </group> <group> <cell>17</cell> <cell>18</cell> <cell>19</cell> <cell>20</cell> </group> <group> <cell>21</cell> <cell>22</cell> </group> -- Public courses: Spring 2004 world tour of hands-on XSL instruction Each week: Monday-Wednesday: XSLT/XPath; Thursday-Friday: XSL-FO Hong Kong May 17-21; Bremen Germany May 24-28; Helsinki June 14-18 World-wide on-site corporate, govt. & user group XML/XSL training. G. Ken Holman mailto:gkholman@xxxxxxxxxxxxxxxxxxxx Crane Softwrights Ltd. http://www.CraneSoftwrights.com/s/ Box 266, Kars, Ontario CANADA K0A-2E0 +1(613)489-0999 (F:-0995) Male Breast Cancer Awareness http://www.CraneSoftwrights.com/s/bc
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|

Cart








