Subject: RE: how to show one number of input text fields. help please
From: "Michael Kay" <mhk@xxxxxxxxx>
Date: Thu, 12 Jun 2003 12:30:30 +0100
|
> -----Original Message-----
> From: owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> [mailto:owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx] On Behalf Of
> Dionisio Ruiz de Zarate
> Sent: 12 June 2003 08:39
> To: XSL-List@xxxxxxxxxxxxxxxxxxxxxx
> Subject: how to show one number of input text fields.
You mean, you want the output to contain 20 elements, of which the first
n are derived from the input, and the other (20-n) are invented? Then
you want:
<xsl:apply-templates select="texto"/>
<xsl:for-each select="1 to (20-count(texto))">
<dummy/>
</xsl:for-each>
The only trouble is, this is XPath 2.0 syntax. To achieve the same
effect in 1.0, either
(a) write a recursive template that takes a parameter indicating how
many elements to output; it should output one element and then (if the
count is non-zero) call itself to output the remaining n-1
(b) use the trick <xsl:for-each select="(//node())[position() <
$n]">, provided there are at least $n nodes in your input file.
Michael Kay
> help please
>
>
> HEllo i have one great problem, for me, and i am working in
> this problem during 2 weeks and i cannot solve it. the problem is:
>
> i have one xml file with, for example, three nodes:
> <texto titulo=\"uno\" url=\"\"/>
> <texto titulo=\"uno\" url=\"\"/>
> <texto titulo=\"uno\" url=\"\"/>
>
> and i want to show the titulo of the nodes (texto) into some
> text input fields (<input type="text"..). I want to show 20
> input text fields but only some of them will be with text, in
> this examplo 3. how can i make this? how can i show 20 input
> text fields if only i have text for three of them. i am
> trying with this: <xsl:for-each select="texto[position() <
> 20]"> <input type="text" name="mensaje" size="35">
> <xsl:attribute name="value"><xsl:value-of
> select="@titulo"/></xsl:attribute>
> </input>
> but only appears in this method 3 text fields.
> i want to show 20
>
> can you help me please?
> thanks
>
>
>
> XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
>
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|