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 December 19th, 2011, 05:47 PM
Registered User
 
Join Date: Dec 2011
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Passing data to a combobox with xsl

Hi a newbie to your forum and apoligise if I have post incorrectly.
As mentioned a newbie to xslt and could use some advice on how to get my xslt to work as I would like. What I am trying to schieve is this....I am using a chainedselect menu on a form with some javascript to call the required data into the comboboxs,plus also some js getting called on window.onload, this all works fine. At present I am using two xsl's one for the window.onload and one for the combobox <select>. Now what I would really prefer is just one xslt to do the job for both, as each is using the same data in both, not sure or how to achieve this or if it is possible, I have provided the js, xslt here for you to view, maybe someone with a better knowledge can point me correctly in the right direction.


Code:
<script type="text/javascript">function initAden() {initListGroup('chainedselects', document.Form1.box1, document.Form1.box2, '')} window.onload = initAden;</script>
Code:
<form name="Form1">
<select name="box1" class="box1"></select>
<select name="box2" class="box2" onchange="openLink(this.value)"></select>
</form>
Combobox xsl
Code:
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:template match='/'>
<xsl:for-each select="DATASET/ITEM">
<xsl:if test="NUMBEROFBOXES = '3'"> <!-- 3 boxes -->
        <select name="{BOX1NAME}" class="{BOX1NAME}"></select>
        <select name="{BOX2NAME}" class="{BOX2NAME}"></select>
        <select name="{BOX3NAME}" class="{BOX3NAME}" onchange="openLink(this.value)"></select>
</xsl:if>
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>
Window onload

Code:
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:template match='/'>
<xsl:for-each select="DATASET/ITEM">
<xsl:if test="NUMBEROFBOXES = '3'"> <!-- 3 boxes -->
        <xsl:value-of select="FORMNAME"></xsl:value-of>.<xsl:value-of select="BOX1NAME"></xsl:value-of>, document.<xsl:value-of select="FORMNAME"></xsl:value-of>.<xsl:value-of select="BOX2NAME"></xsl:value-of>, document.<xsl:value-of select="FORMNAME"></xsl:value-of>.<xsl:value-of select="BOX3NAME"></xsl:value-of>
</xsl:if>
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>
 
Old December 20th, 2011, 05:22 AM
mhkay's Avatar
Wrox Author
 
Join Date: Apr 2004
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
Default

Sorry, but I'm having trouble piecing together how this all works. How does the JS code relate to the XSLT code? What does the XML look like? How are you firing off the transformations using the two stylesheets?

Perhaps most of all, what are you trying to achieve?
__________________
Michael Kay
http://www.saxonica.com/
Author, XSLT 2.0 and XPath 2.0 Programmer\'s Reference





Similar Threads
Thread Thread Starter Forum Replies Last Post
Passing a hardcoded value and manipulating data before passing it to Database table Abhishek Iyer Biztalk 0 August 17th, 2010 06:45 AM
Passing parameters to XSL shahbhat XSLT 4 August 27th, 2008 11:08 AM
Help : combobox in xsl to select value by default priyatowin XSLT 8 July 3rd, 2008 09:05 AM
passing parameters from one xsl to another smys123 XSLT 4 June 21st, 2007 01:23 PM
populate combobox in xsl mausumee XSLT 2 February 23rd, 2007 06:37 PM





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