place data from xslt transform into a form created by another transform

tietlegop

New Member
I have an xml file that contains names and values that need to be placed into a form via xslt.The form is the result of another xslt transform. It's responsible for creating the submit buttons on the jsp. I'm having trouble merging them so that the name/value pairs are inside the form.personal_info.xsl is:\[code\]<?xml version="1.0"?><xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:eek:utput method="html" indent="yes" /><xsl:template match="form-div/record"> <xsl:apply-templates select="person" /> <xsl:apply-templates select="address" /></xsl:template> <xsl:template match="person">First:<input type="text" name="First" value="http://stackoverflow.com/questions/15886300/{First}" class="required" />Last:<input type="text" name="Last" value="http://stackoverflow.com/questions/15886300/{Last}" class="required" /><br/>Phone:<input type="text" name="Phone" value="http://stackoverflow.com/questions/15886300/{Phone}" class="required phoneUS" />Email:<input type="text" name="Email" value="http://stackoverflow.com/questions/15886300/{Email}" class="required email" /><br/> </xsl:template> <xsl:template match="address"> <p/> Street:<input type="text" name="Street" value="http://stackoverflow.com/questions/15886300/{Street}" class="required" /><br/> City:<input type="text" name="City" value="http://stackoverflow.com/questions/15886300/{City}" class="required" /> State:<input type="text" name="State" value="http://stackoverflow.com/questions/15886300/{State}" class="required" /> Zip Code:<input type="text" name="ZipCode" value="http://stackoverflow.com/questions/15886300/{ZipCode}" class="required" /><p/> </xsl:template></xsl:stylesheet>\[/code\]state.xsl is:\[code\]<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"><xsl:template match="doc"> <center> <xsl:apply-templates select="errors" /> <div id="title"> <xsl:value-of select="title" /> </div> <div id="info"> <h3><xsl:value-of select="description" /></h3> </div> <div id="time-div"> +<xsl:value-of select="expected-service-time" />s </div> <div id="oid"> <xsl:value-of select="oid" /> </div> <xsl:apply-templates select="outcomes"/> </center><STYLE><!-- .note { margin-left: 5em; margin-right: 5em } .hilite {color: red; font-weight: bold; font-size: 10 }--></STYLE></xsl:template><xsl:template match="errors"> <xsl:for-each select="error"> <xsl:value-of select="type" /><xsl:value-of select="parameter"/> </xsl:for-each></xsl:template><xsl:template match="outcomes"> <form id="data_form" > <div id="form-div"> <h2>Data could not be read. Contact support.</h2> </div> <div id="buttons"> <table id="button-table"> <tr> <xsl:for-each select="outcome"> <td id="{name}"><input type="button" value="http://stackoverflow.com/questions/15886300/{name}" /></td> </xsl:for-each> </tr> </table> </div> </form></xsl:template></xsl:stylesheet>\[/code\]The page "state.jsp" is:\[code\]<div id="content"> <div id="activity"> <c:import url="_xsl/state.xsl" var="xslt" /> <x:transform doc = "<%=result1%>" xslt = "${xslt}"> </x:transform> </div> <% if( _data1 != null ) { %> <div id="form-div"> <c:import url="_forms/personal_info.xsl" var="stylesheet" /> <x:transform doc = "<%=_data1%>" xslt = "${stylesheet}" > </x:transform> </div> <% } %></div>\[/code\]result1 is:\[code\]<doc> <title>Create Person</title> <description>This state will collect the information required to create a new person. It will compare the uniqueID against a list of all ids to verify not adding same person. It is used as a sub-process by the Schedule Review process and transitioned to by a 'Add Employee'.</description> <oid>1365443908378</oid> <outcomes><outcome><name>Create User</name></outcome><outcome><name>Quit</name></outcome> </outcomes></doc>\[/code\]_data1 is:\[code\]<form-div> <record> <person> <First>Ralph</First> <Last>Hodges</Last> <Phone>(865) 555-1212</Phone> <Email>[email protected]</Email> </person> <address> <Street>1515 N. E. West Street</Street> <City>Hick Ridge</City> <State>AR</State> <ZipCode>99903</ZipCode> </address> </record></form-div>\[/code\]Expected outcome is\[code\] <h1>title</h1> <description>description</description> <form id='data-form'> First Name: <input type="text" name="First" value="http://stackoverflow.com/questions/15886300/Ralph"> .... <div id="buttons"> <table id="button-table"> <tr> <xsl:for-each select="outcome"> <td id="{name}"><input type="button" value="http://stackoverflow.com/questions/15886300/{name}" /></td> </xsl:for-each> </tr> </table></div> </form>Obviously, the idea is to put the formatted fields into the form so that the submitwill happen and put the data into the request.\[/code\]
 
Top