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 April 23rd, 2006, 12:15 PM
Authorized User
 
Join Date: Apr 2006
Posts: 14
Thanks: 0
Thanked 0 Times in 0 Posts
Default XSLT: Joining params with Variables

Hi Guys, I have a problem when trying to do a recursive loop inside another. I'm trying to build a dymanic crossword. I do add a param/var to the end of an exiting varaible.

For example $allAnswer-Row1
I want to add 1 ($allAnswer-Row+1) on the 1st loop, 2 ($allAnswer-Row+2) on the second, etc.
I want to use this for line 1, 3 & 5 below, rather than making lines 10 to 16 etc.

-----------------------------
<xsl:comment>Crossword : Row 1 Output</xsl:comment>
<tr>
<xsl:call-template name="explodeString">
<xsl:with-param name="txt" select="$allAnswer-Row1"/>
<xsl:with-param name="rowNo" select="'1'"/>
</xsl:call-template>
</tr>


<xsl:comment>Crossword : Row 2 Output</xsl:comment>
<tr>
<xsl:call-template name="explodeString">
<xsl:with-param name="txt" select="$allAnswer-Row2"/>
<xsl:with-param name="rowNo" select="'2'"/>
</xsl:call-template>
</tr>
etc
etc
--------------------

Many thanks

Here is what I've done so far, using XSQL (with MySQL) & XSLT:
http://storm-cloud.cs.cse.dmu.ac.uk:...sql/index.xsql
-----------------
 
Old April 23rd, 2006, 06:01 PM
mhkay's Avatar
Wrox Author
 
Join Date: Apr 2004
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
Default

In XSLT 2.0 use

<xsl:for-each select="1 to 16">

and refer to the current value of the iterand either as "." or as "position()".

In XSLT 1.0 use

<xsl:for-each select="(//node())[position() &lt; 17]">

and refer to the iterand as "position()".

Or perhaps I've misunderstood the question - you weren't making yourself very clear.

Michael Kay
http://www.saxonica.com/
Author, XSLT Programmer's Reference and XPath 2.0 Programmer's Reference
 
Old April 24th, 2006, 07:15 AM
Authorized User
 
Join Date: Apr 2006
Posts: 14
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi, yes sorry I wasn't very clear.

I'm not using nodes, I'm using xsl variables. (Adding values to end of variables).
-----------
1, <xsl:comment>Crossword : Row 1 Output</xsl:comment>
2, <tr>
3, <xsl:call-template name="explodeString">
4, <xsl:with-param name="txt" select="$allAnswer-Row1"/>
5, <xsl:with-param name="rowNo" select="'1'"/>
6, </xsl:call-template>
7, </tr>
------------
I want this to generate the rows in the table, I need to add a '1' to the end of $allAnswer-Row[ADD 1 HERE] on line 4. Then using recursive loops, then it comes around again, add 2 to the end of that variable.

Please see here:
http://storm-cloud.cs.cse.dmu.ac.uk:...zzlechoice.xsl

Thanks






Similar Threads
Thread Thread Starter Forum Replies Last Post
Calling Stored Proc with OUT params nkrust ASP.NET 2.0 Professional 2 April 19th, 2007 12:31 AM
Joining 2 variables together for one name Lucy Classic ASP Basics 1 June 13th, 2006 10:01 AM
XSL Params inside When Test shasto100 XSLT 3 April 21st, 2006 05:45 AM
Help Understanding Event default Params nbryson VS.NET 2002/2003 1 January 9th, 2004 12:43 PM
variables in xslt will.richardson XSLT 1 September 24th, 2003 01:23 AM





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