XML Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming Languages - MoreXML Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old January 10th, 2004, 06:43 PM
dadelcas dadelcas is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2003
Location: Venezuela
Posts: 95 dadelcas User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 5 m 28 sec
Reputation Power: 6
XSL and HTML forms

Hello all...

I'm new using XML and XSL to generate HTML content. I'm getting problems with the value for the inputs. The XML file looks like this

<?xml version='1.0'?>
<GET>
<NAME>
<INDEX>x</INDEX>
<DATE>yyyy</DATE>
</NAME>
...
<NAME>
<INDEX>x</INDEX>
<DATE>yyyy</DATE>
</NAME>
</GET>

and the XSL file is

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">

<xsl:template match="GET">
<TABLE>
<xsl:apply-templates/>
</TABLE>
</xsl:template>

<xsl:template match="NAME">
<TR>
<xsl:variable name="Index">
<xsl:value-of select="INDEX" />
</xsl:variable>
<FORM NAME="Name{//Index}" METHOD="POST" ACTION="viewname.php">
<TD>
<INPUT TYPE="HIDDEN" NAME="Index" VALUE="{//Index}" />
<A HREF="javascript:document.Name{//Index}.submit();"><xsl:value-of select="DATE" /></A>
</TD>
</FORM>
</TR>
</xsl:template>

</xsl:stylesheet>

The varible 'Index' has not been replaced on transformation. What is wrong? I need to put a value in the VALUE attribute of an input.

Thanks in advance..
__________________
-DdC

Reply With Quote
  #2  
Old January 10th, 2004, 07:17 PM
dadelcas dadelcas is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2003
Location: Venezuela
Posts: 95 dadelcas User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 5 m 28 sec
Reputation Power: 6
I reply to myself.... The wrong thing is that I'm using {//variable_name} instead of {$variable_name}. The right version is:

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">

<xsl:template match="GET">
<TABLE>
<xsl:apply-templates/>
</TABLE>
</xsl:template>

<xsl:template match="NAME">
<TR>
<xsl:variable name="Index">
<xsl:value-of select="INDEX" />
</xsl:variable>
<FORM NAME="Name{$Index}" METHOD="POST" ACTION="viewname.php">
<TD>
<INPUT TYPE="HIDDEN" NAME="Index" VALUE="{$Index}" />
<A HREF="javascript:document.Name{$Index}.submit();"><xsl:value-of select="DATE" /></A>
</TD>
</FORM>
</TR>
</xsl:template>

</xsl:stylesheet>

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreXML Programming > XSL and HTML forms


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 2 hosted by Hostway