Subject: Re: [xsl] Re: Re: Creating an array From: "G. Ken Holman" <gkholman@xxxxxxxxxxxxxxxxxxxx> Date: Tue, 27 May 2003 19:44:03 -0400 |
The solution I need is a way to have random numbers but not duplicated numbers (the randomly generated number is associated with a link - which can't be duplicated or content on the web site will be redundant.
So I'm back at the original question - how do I track what random numbers I've already generated so I can compare them using contains() or some string function.
t:\ftemp>type master.xml <number>123</number>
t:\ftemp>type alan.xml <?xml version="1.0" encoding="iso-8859-1"?> <test> <thing/> <thing/> <thing/> <thing/> <thing/> </test> t:\ftemp>type alan.xsl <?xml version="1.0" encoding="iso-8859-1"?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:saxon="http://icl.com/saxon" extension-element-prefixes="saxon" exclude-result-prefixes="saxon" version="1.0">
<xsl:template match="/"> <xsl:variable name="start" select="number(document('master.xml')/number)"/>
<result> <xsl:for-each select="/test/thing"> <Hello/> </xsl:for-each> </result>
<saxon:output href="master.xml"> <number><xsl:value-of select="$start+count(/test/thing)"/></number> </saxon:output> </xsl:template>
t:\ftemp>type master.xml <?xml version="1.0" encoding="utf-8"?><number>128</number> t:\ftemp>saxon -o alan.out alan.xml alan.xsl
t:\ftemp>type master.xml <?xml version="1.0" encoding="utf-8"?><number>133</number> t:\ftemp>
-- Upcoming hands-on courses: (registration still open!) - (XSLT/XPath and/or XSL-FO) North America: June 16-20, 2003
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) ISBN 0-13-065196-6 Definitive XSLT and XPath ISBN 0-13-140374-5 Definitive XSL-FO ISBN 1-894049-08-X Practical Transformation Using XSLT and XPath ISBN 1-894049-11-X Practical Formatting Using XSL-FO Member of the XML Guild of Practitioners: http://XMLGuild.info Male Breast Cancer Awareness http://www.CraneSoftwrights.com/s/bc
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] Re: Re: Creating an array, Alan Gardner | Thread | [xsl] Re: Re: Re: Creating an array, Dimitre Novatchev |
Re: [xsl] Re: Re: Creating an array, Alan Gardner | Date | [xsl] Re: Re: Re: Creating an array, Dimitre Novatchev |
Month |