Wrox Programmer Forums
Go Back   Wrox Programmer Forums > XML > XSLT
XSLT General questions and answers about XSLT. For issues strictly specific to the book XSLT 1.1 Programmers Reference, please post to that forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the XSLT section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old March 26th, 2014, 05:03 PM
Registered User
Join Date: Mar 2014
Posts: 3
Thanks: 1
Thanked 0 Times in 0 Posts
Default <struct><cell> tagging list-elements


I have following problem:

I have a list of elements and want to get a form like that:

... and so on...

so i want always two elements staying together and then beeing apart by struct and cell from the others...

but without a for-loop that isn´t very easy ... because for-each only goes through all elements...

can anyone help me?? please?
Old March 26th, 2014, 05:14 PM
mhkay's Avatar
Wrox Author
Join Date: Apr 2004
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts

<xsl:for-each select="element[position() mod 2 = 1]">
    <xsl:copy-of select=". | following-sibling::*[1]"/>
Michael Kay
Author, XSLT 2.0 and XPath 2.0 Programmer\'s Reference
Old March 26th, 2014, 05:19 PM
Registered User
Join Date: Mar 2014
Posts: 3
Thanks: 1
Thanked 0 Times in 0 Posts

and if i want to link three or four elemnts?

just changing the modulo and in sibling::*[2] or sibling::*[3]

edit: my Problem is that i want to get the Output in a field so my previous code was like that:

PHP Code:
    <xsl:for-each select="$elements">

cell dim="1 1">
struct dim="1 1">

fld><xsl:attribute name="name"><xsl:value-of select="name"/></xsl:attribute><c><xsl:value-of select="value"/></c>



so how could i Change your tip, that it fits here...?

Last edited by Jenny91; March 27th, 2014 at 02:21 AM..

Similar Threads
Thread Thread Starter Forum Replies Last Post
Ch 8: <asp:image> inside <a> & ext.CSS (pg. 274) epc BOOK: Beginning ASP.NET 3.5 : in C# and VB BOOK ISBN: 978-0-470-18759-3 1 July 12th, 2008 04:37 AM
<style> tags in a <body> vs. <div> bcat BOOK: Beginning CSS: Cascading Style Sheets for Web Design ISBN: 978-0-7645-7642-3 1 March 27th, 2005 08:50 AM
<marquee><b>About CHAT App. in PHP4</b></marquee> Ramkrishna PHP How-To 1 September 11th, 2004 07:01 AM
<STRONG> vs <B> and <EM> vs <I> anshul HTML Code Clinic 12 September 1st, 2004 05:22 PM
a problem in book<<beginning asp.net using vb>> luoware ASP.NET 1.0 and 1.1 Basics 3 December 8th, 2003 09:32 PM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.