Wrox Programmer Forums
Go Back   Wrox Programmer Forums > XML > XSLT
|
XSLT General questions and answers about XSLT. For issues strictly specific to the book XSLT 1.1 Programmers Reference, please post to that forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the XSLT section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old February 23rd, 2007, 03:44 AM
Registered User
 
Join Date: Feb 2007
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default populate combobox in xsl

hi
i have xls file as follows.
i have a jsp search page in which i have used pagination.
in each row ,last 3 columns i want to use combo boxes.
i am new to xml.

pls help me how to insert combo box dynamically in xsl.


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

<xsl:output method="html" indent="yes"/>

<xsl:template name="recorddata">
 <tr CLASS="tabrowback">



    <td WIDTH="18%" CLASS="engTablbl"><input class="engtbnoborderleftalign" type="text" size="12" name="dtDue" value='{DTDUE}' readonly="true"/></td>
    <td WIDTH="11%" CLASS="engTablbl"><input class="engtbnoborderleftalign" type="text" size="10" name="strRefNbr" value='{STRREFNBR}' readonly="true"/></td>
    <td WIDTH="13%" CLASS="engTablbl"><input class="engtbnoborderleftalign" type="text" size="10" name="nTransType" value='{NTRANSTYPE}' readonly="true"/></td>
    <td WIDTH="10%" CLASS="engTablbl"><input class="engtbnoborderleftalign" type="text" size="12" name="dLocalCurrAmnt" value='{DLOCALCURRAMNT}' readonly="true"/></td>
    <td WIDTH="17%" CLASS="engTablbl"><input class="engtbnoborderleftalign" type="text" size="10" name="dLocalAmntPaid" value='{DLOCALAMNTPAID}' readonly="true"/></td>
    <td WIDTH="7%" CLASS="engTablbl"><input class="engtbnoborderleftalign" type="text" size="10" name="dBalAmnt" value='{DLOCALCURRAMNT}' readonly="true"/></td>
    <td WIDTH="7%" CLASS="engTablbl"><input class="engtbnoborderleftalign" type="text" size="10" name="nWithHold" value='{DAMNTHOLD}' readonly="true"/></td>




    <td WIDTH="7%" CLASS="engTablbl"><input class="engtbnoborderleftalign" type="text" size="12" name="strReasHold" value='{STRREASHOLD}' readonly="true"/></td>
    <td WIDTH="7%" CLASS="engTablbl"><input class="engtbnoborderleftalign" type="text" size="12" name="strReasRel" value='{STRREASREL}' readonly="true"/></td>
</tr>

</xsl:template>

<xsl:template match="LIST">

<xsl:call-template name="divtableheader">
    <xsl:with-param name="count" select="1"/>
</xsl:call-template>

<xsl:variable name="rowsperpage" select="/LIST/ROWSPERPAGE"/>

<xsl:for-each select="RECORD">
    <xsl:variable name="relpos" select="position()-1"/>

    <xsl:if test="$relpos > 0 and $relpos mod $rowsperpage = 0" >
        <xsl:variable name="idcount" select="($relpos div $rowsperpage)+1"/>
        <xsl:call-template name="divtableheader">
            <xsl:with-param name="count" select="$idcount"/>
        </xsl:call-template>
    </xsl:if>

    <xsl:call-template name="recorddata"/>

</xsl:for-each>

<xsl:call-template name="divtableheader">
    <xsl:with-param name="count" select="99"/>
</xsl:call-template>

</xsl:template>

<xsl:template name="divtableheader">
    <xsl:param name="count"/>
    <xsl:if test="$count != 1">
        <xsl:text disable-output-escaping="yes">
            </TABLE>
            </DIV>
        </xsl:text>
    </xsl:if>
    <xsl:if test="$count != 99">
    <xsl:text disable-output-escaping="yes"><DIV ID=DIV_</xsl:text><xsl:value-of select="$count"/>
    <xsl:text disable-output-escaping="yes"> STYLE="DISPLAY:none;VISIBILITY:hidden" >
        <TABLE ID=TAB_</xsl:text><xsl:value-of select="$count"/>
    <xsl:text disable-output-escaping="yes"> ></xsl:text>
    </xsl:if>
</xsl:template>

</xsl:stylesheet>

 
Old February 23rd, 2007, 05:19 AM
mhkay's Avatar
Wrox Author
 
Join Date: Apr 2004
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
Default

I don't know what the input to your program looks like, I don't know anything about the output that you want except that it must contain a "combobox" (but that's not a concept I recognize in HTML), and you've shown me an XSLT file without telling me what it does or whether it works. Oh, and you mumbled something about JSP without explaining its relevance. And you haven't found the shift key on your keyboard.

Sometimes I just despair of this forum.

This kind of code is really bad:

        <xsl:text disable-output-escaping="yes">
            </TABLE>
            </DIV>
        </xsl:text>

It's the way beginners typically try to do grouping when they haven't understood the concept that XSLT is generating a result tree, not a chunk of text. The right way is along these lines:

<xsl:for-each select="input-element[position() mod 5 = 1]">
  <div>
   <table>
     <xsl:apply-templates select=".|following-sibling::input-element[position() &lt; 5]"/>
   </table>
  </div>
</xsl:for-each>

Michael Kay
http://www.saxonica.com/
Author, XSLT Programmer's Reference and XPath 2.0 Programmer's Reference
 
Old February 23rd, 2007, 06:37 PM
Friend of Wrox
 
Join Date: Jul 2006
Posts: 430
Thanks: 28
Thanked 5 Times in 5 Posts
Send a message via Yahoo to bonekrusher
Default

Michael,

Dont loose hope! XML and XSLT are the future. Everyday XSLT is picking up more speed.
This forum is very helpful thanks to you and Joe F.

Bones







Similar Threads
Thread Thread Starter Forum Replies Last Post
Help : combobox in xsl to select value by default priyatowin XSLT 8 July 3rd, 2008 09:05 AM
Populate combobox from ADO recordset - RESOLVED! robzyc Access VBA 8 May 23rd, 2008 01:07 AM
Populate ListView From ComboBox Select eusanpe C# 4 August 20th, 2007 06:49 PM
populate data in a windows form combobox from a da anibiswas General .NET 0 March 4th, 2005 03:57 PM
XSL Transform with xsl string NOT xsl file skin XSLT 0 June 16th, 2003 07:30 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.