[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

VB: Grouping by position (using Jeni's solution) probl

Subject: VB: Grouping by position (using Jeni's solution) problem
From: "Ulf Carlsson" <ulf.carlsson@xxxxxxxxx>
Date: Tue, 13 May 2003 20:04:20 +0200
grouping in vb
 

	Hello,
	I want to creat a table with two pictures on every row. 
	I have used Jeni's solution of do a group by position but it don't
	work on my xml because of diffrent structure. I have tried 
	to change the apply-template elements in the procstep
	template and in the grate template with row mode see
	the xsl below.
	 
	My xml looks something like this:
	<procedure>
	    <procstep>
	        <grate>
	            <graphic id="KC03489-sv-SE"/>
	        </grate>
	    </procstep>
	    <procstep>
	        <grate>
	            <graphic id="KC03512-sv-SE"/>
	        </grate>
	        <grate>
	            <graphic id="KC036sds-sv-SE"/>
	        </grate>
	    </procstep>
	    <procstep>
	        <grate>
	            <graphic id="KC0370987g-sv-SE"/>
	        </grate>
	    </procstep>
	</procedure>

	My xsl looks like this:
	<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="http://www.w3.org/1999/XSL/Format" exclude-result-prefixes="fo">
	    <xsl:template match="/procedure">
	        <table>
	            <xsl:apply-templates/>
	        </table>
	</xsl:template>

	

	<xsl:template match="procstep">
	    <xsl:apply-templates select="grate[position() mod 2 = 1]" mode="row"/>
	</xsl:template>

	

	<xsl:template match="grate" mode="row">
	    <row>
	        <xsl:apply-templates select="self::node() | following-sibling::grate[position() &lt; 2]"/>
	    </row>
	</xsl:template> 

	

	<xsl:template match="grate">
	    <entry>
	        <i2graphic>
	            <xsl:copy-of select="graphic | graphic/@*"/>
	        </i2graphic>
	    </entry>
	</xsl:template>

	</xsl:stylesheet>

	I get a table structure like this: 
	<table>
	    <row>
	        <entry>
	            <graphic id="KC03489-sv-SE"/>
	        </entry>
	    </row>
	    <row>
	        <entry>
	            <graphic id="KC03512-sv-SE"/>
	        </entry>
	        <entry>
	            <graphic id="KC036sds-sv-SE"/>
	        </entry>
	    </row>
	    <row>
	        <entry>
	            <graphic id="KC0370987g-sv-SE"/>
	        </entry>
	    </row>
	</table>
	

	
	

	I want a table structure like this:
	<table>
	    <row>
	        <entry>
	            <graphic id="KC03489-sv-SE"/>
	        </entry>
	        <entry>
	            <graphic id="KC03512-sv-SE"/>
	        </entry>
	    </row>
	    <row>
	        <entry>
	            <graphic id="KC036sds-sv-SE"/>
	        </entry>
	        <entry>
	            <graphic id="KC0370987g-sv-SE"/>
	        </entry>
	    </row>
	</table>

	 

	
	Can somebody suggest a solution?

	Thanks in advance,

	Ulf


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.