xsl-list
[Top] [All Lists]

RE: how to show one number of input text fields. help please

2003-06-12 01:15:50
Pls try this:
--------------------------------------------------------------
Xml:
<?xml version="1.0" encoding="UTF-8"?>
<!-- edited with XMLSPY v5 rel. 2 U (http://www.xmlspy.com) by Jason
(GRT) -->
<Items>
        <Item titulo="001" url="url01"></Item>
        <Item titulo="002" url="url02"></Item>
        <Item titulo="003" url="url03"></Item>
</Items>
--------------------------------------------------------------
xslt:
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform";>
        <xsl:output method="html" version="1.0" encoding="UTF-8"
indent="yes"></xsl:output>
        <xsl:template match="/">
                <html>
                        <head>
                                <title></title>
                        </head>
                        <body>
                                <xsl:for-each select="//Items/Item">
                                        <input type="text"
value="{(_at_)titulo}"></input>
                                        <br></br>
                                </xsl:for-each>
                                <xsl:variable name="N"
select="20-count(//Items/Item)"></xsl:variable>
                                <xsl:call-template name="Show">
                                        <xsl:with-param name="P"
select="$N"></xsl:with-param>
                                </xsl:call-template>
                        </body>
                </html>
        </xsl:template>
        <xsl:template name="Show">
                <xsl:param name="P"></xsl:param>
                <input type="text"></input>
                <br></br>
                <xsl:choose>
                        <xsl:when test="number($P) &gt; number(1)">
                                <xsl:call-template name="Show">
                                        <xsl:with-param name="P"
select="number($P)-1"></xsl:with-param>
                                </xsl:call-template>
                        </xsl:when>
                </xsl:choose>
        </xsl:template>
</xsl:stylesheet>


Jason(_at_)GRT

-----Original Message-----
From: owner-xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
[mailto:owner-xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com] On Behalf Of 
Dionisio
Ruiz de Zarate
Sent: 2003年6月12日 15:39
To: XSL-List(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: [xsl] how to show one number of input text fields. 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() &lt; 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



<Prev in Thread] Current Thread [Next in Thread>