[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

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


Subject: RE: [xsl] how to show one number of input text fields. help please
From: "Jason" <estudio@xxxxxxxxx>
Date: Thu, 12 Jun 2003 16:15:50 +0800

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="{@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@GRT

-----Original Message-----
From: owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx
[mailto:owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx] On Behalf Of Dionisio
Ruiz de Zarate
Sent: 2003年6月12日 15:39
To: XSL-List@xxxxxxxxxxxxxxxxxxxxxx
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



Current Thread
Keywords
xml