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 August 4th, 2013, 03:58 AM
Registered User
 
Join Date: Aug 2013
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default Help required to plot seat map using xml and xslt

I have the following xml value which gives the primary information of seat map

<row noOfRows="72">
<column ctype="ST" cname="A"/>
<column ctype="ST" cname="B"/>
<column ctype="ST" cname="C"/>
<column ctype="AL"/>
<column ctype="ST" cname="D"/>
<column ctype="ST" cname="E"/>
<column ctype="ST" cname="F"/>
<column ctype="ST" cname="G"/>
<column ctype="AL"/>
<column ctype="ST" cname="H"/>
<column ctype="ST" cname="J"/>
<column ctype="ST" cname="K"/>
</row>

the node <row noOfRows="50"> is the information to create 50 rows and each column(ex:A,B,C,etc) should have 50 columns.


ex:
A [] [] [] [] [] ...... till 50
B [] [] [] [] [] ...... till 50
C [] [] [] [] [] ...... till 50
<column ctype="AL"/>
D [] [] [] [] [] ...... till 50
E [] [] [] [] [] ...... till 50
F [] [] [] [] [] ...... till 50
G [] [] [] [] [] ...... till 50
<column ctype="AL"/>
H [] [] [] [] [] ...... till 50
J [] [] [] [] [] ...... till 50
K [] [] [] [] [] ...... till 50

please help me to plot this information using XSLT
 
Old August 4th, 2013, 08:43 AM
mhkay's Avatar
Wrox Author
 
Join Date: Apr 2004
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
Default

You haven't given enough information to provide concrete code, but in XSLT 2.0 you can do

Code:
<xsl:for-each select="1 to $N">
   ....
</xsl:for-each>
In XSLT 1.0 the usual trick for doing this is

Code:
<xsl:for-each select="(//node())[position &lt;= $N]">
  ....
</xsl:for-each>
which works so long as there are at least $N nodes in your input document.
__________________
Michael Kay
http://www.saxonica.com/
Author, XSLT 2.0 and XPath 2.0 Programmer\'s Reference





Similar Threads
Thread Thread Starter Forum Replies Last Post
Site Map XML File BILL22 Visual Studio 2005 2 September 9th, 2011 04:55 AM
XLST noob - XML -> XML transform help required Crass1968 XSLT 6 March 4th, 2010 07:32 AM
XSLT 2.0 array/map geek.shrek XSLT 5 November 2nd, 2007 10:20 AM
XSLT for complicated xml to xml transf. required doug@sirvisetti XSLT 3 June 17th, 2005 04:26 PM
AIRPLANE SEAT CHART..... PLEASE HELP Raineri33 C++ Programming 4 September 8th, 2003 11:18 PM





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