I have xml file with software categories in them like web and coding. what I'm trying to do is write a xslt that when radio button is clicked it shows the data from the xml just in that category. For example if you clicked the radio button for Web just the applications for the Web cat. shows in the table. If anyone could help with this it would be awesome. I have been searching the web for hours and have not come up with anything. Thanks you in advance!
XSLT
<?xml version="1.0" encoding="utf-8"?>` <xsl:stylesheet version="1.0"xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:msxsl="urn:schemas-microsoft-com:xslt" exclude-result-prefixes="msxsl" > <xsl:output method="html" indent="yes"/> <xsl:template match="/"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/> <title>Software Request Form</title> <link rel="stylesheet" type="text/css" href="view.css" media="all"/> <script type="text/javascript" src="view.js"></script> <script type="text/javascript" src="calendar.js"></script> </head> <body id="main_body" > <div id="form_container"> <h1> <a>Software Request Form</a> </h1> <form id="form_1095396" class="appnitro" method="post" action=""> <div class="form_description"> <h2>Software Request Form</h2> <p>If you need software please do it using this form</p> </div> <ul > <li id="li_1" > <label class="description" for="element_1">Name </label> <span> <input id="element_1_1" name= "element_1_1" class="element text" maxlength="255" size="8" value=""/> <label>First</label> </span> <span> <input id="element_1_2" name= "element_1_2" class="element text" maxlength="255" size="14" value=""/> <label>Last</label> </span> </li> <li id="li_2" > <label class="description" for="element_2">Date </label> <span> <input id="element_2_1" name="element_2_1" class="element text" size="2" maxlength="2" value="" type="text"/> <label for="element_2_1">MM</label> </span> <span> <input id="element_2_2" name="element_2_2" class="element text" size="2" maxlength="2" value="" type="text"/> <label for="element_2_2">DD</label> </span> <span> <input id="element_2_3" name="element_2_3" class="element text" size="4" maxlength="4" value="" type="text"/> <label for="element_2_3">YYYY</label> </span> <span id="calendar_2"> <img id="cal_img_2" class="datepicker" src="calendar.gif" alt="Pick a date."/> </span> <script type="text/javascript"> Calendar.setup({ inputField : "element_2_3", baseField : "element_2", displayArea : "calendar_2", button : "cal_img_2", ifFormat : "%B %e, %Y", onSelect : selectDate }); </script> </li> <li id="li_3" > <label class="description" for="element_3">Email </label> <div> <input id="element_3" name="element_3" class="element text medium" type="text" maxlength="255" value=""/> </div> </li> <li id="li_4" > <label class="description" for="element_4">Department </label> <div> <input id="element_4" name="element_4" class="element text medium" type="text" maxlength="255" value=""/> </div> </li> <li id="li_4.1" > <label class="description" for="element_4.1">Software Catagory</label> <span> <input id="element_4_1" name="element_4" class="element radio" type="radio" value="1" onclick="Web"/> <label class="choice" for="element_4_1">Web</label> <input id="element_4_2" name="element_4" class="element radio" type="radio" value="2" /> <label class="choice" for="element_4_2">Graphic</label> <input id="element_4_3" name="element_4" class="element radio" type="radio" value="3" /> <label class="choice" for="element_4_3">Productive</label> <input id="element_4_3" name="element_4" class="element radio" type="radio" value="4" /> <label class="choice" for="element_4_4">Audio</label> <input id="element_4_3" name="element_4" class="element radio" type="radio" value="5" /> <label class="choice" for="element_4_5">Design</label> <input id="element_4_3" name="element_4" class="element radio" type="radio" value="6" /> <label class="choice" for="element_4_6">Coding</label> </span> </li> <li id="li_5" > <label class="description" for="element_5">Software Requested </label> <div> <table Border="2"> <tr> <th>Vedor</th> <th>Software Name</th> </tr> <xsl:for-each select="Software/Company/App/AppItem"> <tr> <td> <xsl:value-of select="../../@Name"/> </td> <td> <xsl:value-of select="."/> </td> </tr> </xsl:for-each> </table> </div> </li> <li class="buttons"> <input type="hidden" name="form_id" value="1095396" /> <input id="saveForm" class="button_text" type="submit" name="submit" value="Submit" /> </li> </ul> </form> <div id="footer"> </div> </div> </body> </html> </xsl:template>
XML
<?xml version="1.0" encoding="utf-8"?> <!--Chris Martin--> <Software> <Company Name="Microsoft"> <App> <AppItem Price="$79.99" Version="2016" MultiOs="true" QualityRating="3" PriceRating="2" Cat="Productivity">Office Word</AppItem> <AppItem Price="$109.99" Version="2016" MultiOs="true" QualityRating="3" PriceRating="2" Cat="Productivity">Office PowerPoint</AppItem> <AppItem Price="$458.93" Version="2015" MultiOs="false" QualityRating="3" PriceRating="2" Cat="Coding">Visual Studio</AppItem> <AppItem Price="$149.99" Version="4" MultiOs="false" QualityRating="3" PriceRating="2" Cat="Web">Expression Web</AppItem> <AppItem Price="$109.99" Version="2016" MultiOs="true" QualityRating="3" PriceRating="2" Cat="Productivity">Office Excel</AppItem> </App> </Company> <Company Name="Adobe"> <App> <AppItem Price="$19.99/mo" Version="CC" MultiOs="true" QualityRating="3" PriceRating="2" Cat="Graphic">Photoshop</AppItem> <AppItem Price="$19.99/mo" Version="CC" MultiOs="true" QualityRating="3" PriceRating="2" Cat="Web">Dreamweaver</AppItem> <AppItem Price="$19.99/mo" Version="CC" MultiOs="true" QualityRating="3" PriceRating="2" Cat="Video">Premiere Pro</AppItem> <AppItem Price="$19.99/mo" Version="CC" MultiOs="true" QualityRating="3" PriceRating="2" Cat="Video">After Affects</AppItem> <AppItem Price="$19.99/mo" Version="CC" MultiOs="true" QualityRating="3" PriceRating="2" Cat="Design">InDesign</AppItem> </App> </Company> <Company Name="Apple"> <App> <AppItem Price="$299.99" Version="10.2.2" MultiOs="false" QualityRating="3" PriceRating="3" Cat="Video">Final Cut Pro</AppItem> <AppItem Price="$199.99" Version="10.2" MultiOs="false" QualityRating="3" PriceRating="3" Cat="Audio">Logic Pro X</AppItem> </App> </Company> <Company Name="Mars"> <App> <AppItem Price="Free" Version="4.5.1" MultiOs="true" QualityRating="3" PriceRating="5" Cat="Coding">Eclipse</AppItem> </App> </Company> <Company Name="JetBrains"> <App> <AppItem Price="$199.99" Version="15.0.2" MultiOs="true" QualityRating="3" PriceRating="3" Cat="Coding">IntelliJ IDEA</AppItem> </App> </Company> <Company Name="Broderbund"> <App> <AppItem Price="$99.99" Version="4.0" MultiOs="false" QualityRating="3" PriceRating="3" Cat="Design">Print Shop Pro 4</AppItem> </App> </Company>
No comments:
Post a Comment