xml - How can i use XSL sheet to filter C# Application -
i apologize if not explaining right.
i need create c# application when value selected combobox, supposed filter out , transform xslt sheet. have 3 different criteria in combobox makes challenging. i'm stuck on right designing xlst, since criteria different.
here xslt sheet far, displays information.
<?xml version="1.0"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/xsl/transform" > <xsl:variable name="features" select="programming/features/feature" /> <xsl:template match="/" > <html> <head> <title>programming</title> </head> <body> <table border="1"> <tr> <th >programming</th> <th >intended use</th> <xsl:for-each select="$features"> <th><xsl:value-of select="."/></th> </xsl:for-each> <th style="text-align:left">standards</th> </tr> <xsl:for-each select="programming/languages/language"> <tr> <td><xsl:value-of select="name"/></td> <td><xsl:variable name="intendeduseid" select="purpose/intendeduse/@id" /> <xsl:for-each select="/programming/purpose/intendeduse[@id=$intendeduseid]" > <xsl:value-of select="." /> <br /> </xsl:for-each></td> <xsl:variable name="my-features" select="features/feature" /> <xsl:for-each select="$features"> <td> <xsl:if test="@id = $my-features/@id">yes</xsl:if> </td> </xsl:for-each> <td> <xsl:variable name="standardid" select="standards/standard/@id" /> <xsl:for-each select="/programming/standards/standard[@id=$standardid]" > <xsl:value-of select="." /> <br /> </xsl:for-each></td> </tr> </xsl:for-each> </table> </body> </html> </xsl:template> <xsl:template match="language"> <tr> <xsl:variable name="my-features" select="features/feature" /> <xsl:for-each select="$features"> <td> <xsl:if test="@id = $my-features/@id">yes</xsl:if> </td> </xsl:for-each> </tr> </xsl:template> </xsl:stylesheet>
xml
<programming> <languages> <language id="1"> <name>c</name> <purpose> <intendeduse id="1" /> <intendeduse id="2" /> <intendeduse id="3" /> <intendeduse id="4" /> </purpose> <features> <feature id="1" /> <feature id="4" /> </features> <standards> <standard id="1" /> <standard id="2" /> </standards> </language> <language id="2"> <name>c++</name> <purpose> <intendeduse id="1" /> <intendeduse id="2" /> </purpose> <features> <feature id="1" /> <feature id="2" /> <feature id="3" /> <feature id="4" /> <feature id="5" /> </features> <standards> <standard id="2" /> </standards> </language> <language id="3"> <name>c#</name> <purpose> <intendeduse id="1" /> <intendeduse id="5" /> <intendeduse id="6" /> <intendeduse id="7" /> <intendeduse id="3" /> <intendeduse id="8" /> <intendeduse id="9" /> </purpose> <features> <feature id="1" /> <feature id="2" /> <feature id="3" /> <feature id="4" /> <feature id="5" /> <feature id="6" /> <feature id="7" /> </features> <standards> <standard id="3" /> <standard id="2" /> </standards> </language> <language id="4"> <name>java</name> <purpose> <intendeduse id="1" /> <intendeduse id="6" /> <intendeduse id="7" /> <intendeduse id="3" /> <intendeduse id="8" /> <intendeduse id="9" /> </purpose> <features> <feature id="1" /> <feature id="2" /> <feature id="5" /> <feature id="6" /> </features> <standards> <standard id="4" /> </standards> </language> <language id="5"> <name>javascript</name> <purpose> <intendeduse id="7" /> <intendeduse id="8" /> <intendeduse id="7" /> </purpose> <features> <feature id="1" /> <feature id="2" /> <feature id="3" /> <feature id="6" /> </features> <standards> <standard id="3" /> </standards> </language> <language id="6"> <name>php</name> <purpose> <intendeduse id="8" /> <intendeduse id="9" /> </purpose> <features> <feature id="1" /> <feature id="2" /> <feature id="4" /> <feature id="6" /> </features> <standards> <standard id="5" /> </standards> </language> <language id="7"> <name>python</name> <purpose> <intendeduse id="1" /> <intendeduse id="3" /> <intendeduse id="9" /> <intendeduse id="10" /> <intendeduse id="11" /> <intendeduse id="12" /> </purpose> <features> <feature id="1" /> <feature id="2" /> <feature id="3" /> <feature id="6" /> </features> <standards> <standard id="5" /> </standards> </language> <language id="8"> <name>basic</name> <purpose> <intendeduse id="1" /> <intendeduse id="13" /> </purpose> <features> <feature id="1" /> <feature id="4" /> </features> <standards> <standard id="1" /> <standard id="2" /> </standards> </language> <language id="9"> <name>ada</name> <purpose> <intendeduse id="1" /> <intendeduse id="2" /> <intendeduse id="14" /> <intendeduse id="15" /> </purpose> <features> <feature id="1" /> <feature id="2" /> <feature id="4" /> <feature id="5" /> </features> <standards> <standard id="1" /> <standard id="2" /> <standard id="6" /> </standards> </language> <language id="10"> <name>actionscript 3.0</name> <purpose> <intendeduse id="1" /> <intendeduse id="7" /> <intendeduse id="9" /> </purpose> <features> <feature id="1" /> <feature id="2" /> <feature id="7" /> </features> <standards> <standard id="3" /> </standards> </language> </languages> <purpose> <intendeduse id="1"> application</intendeduse> <intendeduse id="2"> system </intendeduse> <intendeduse id="3"> general purpose </intendeduse> <intendeduse id="4"> low-level operations </intendeduse> <intendeduse id="5"> rad </intendeduse> <intendeduse id="6"> business </intendeduse> <intendeduse id="7"> client-side </intendeduse> <intendeduse id="8"> server-side </intendeduse> <intendeduse id="9"> web </intendeduse> <intendeduse id="10"> scripting </intendeduse> <intendeduse id="11"> ai </intendeduse> <intendeduse id="12"> scientific computing </intendeduse> <intendeduse id="13">education</intendeduse> <intendeduse id="14">embedded</intendeduse> <intendeduse id="15">realtime</intendeduse> </purpose> <features> <feature id="1">imperative </feature> <feature id="2">object-oriented</feature> <feature id="3">functional</feature> <feature id="4">procedural</feature> <feature id="5">generic</feature> <feature id="6">reflective</feature> <feature id="7">event-driven</feature> </features> <standards> <standard id="1">ansi</standard> <standard id="2">iso</standard> <standard id="3">ecma</standard> <standard id="4">de facto</standard> <standard id="5">no</standard> <standard id="6">gost</standard> </standards> </programming>
below screenshot of combobox.
basically, if select intended use, standard, should display languages associated criteria.
here code output
<html> <body> <table border="1"> <tr> <th>programming</th> <th>intended use</th> <th>imperative </th> <th>object-oriented</th> <th>functional</th> <th>procedural</th> <th>generic</th> <th>reflective</th> <th>event-driven</th> <th style="text-align:left">standards</th> </tr> <tr> <td>c</td> <td> application<br> system <br> general purpose <br> low-level operations <br></td> <td>yes</td> <td></td> <td></td> <td>yes</td> <td></td> <td></td> <td></td> <td>ansi<br>iso<br></td> </tr> <tr> <td>c++</td> <td> application<br> system <br></td> <td>yes</td> <td>yes</td> <td>yes</td> <td>yes</td> <td>yes</td> <td></td> <td></td> <td>iso<br></td> </tr> <tr> <td>c#</td> <td> application<br> general purpose <br> rad <br> business <br> client-side <br> server-side <br> web <br></td> <td>yes</td> <td>yes</td> <td>yes</td> <td>yes</td> <td>yes</td> <td>yes</td> <td>yes</td> <td>iso<br>ecma<br></td> </tr> <tr> <td>java</td> <td> application<br> general purpose <br> business <br> client-side <br> server-side <br> web <br></td> <td>yes</td> <td>yes</td> <td></td> <td></td> <td>yes</td> <td>yes</td> <td></td> <td>de facto<br></td> </tr> <tr> <td>javascript</td> <td> client-side <br> server-side <br></td> <td>yes</td> <td>yes</td> <td>yes</td> <td></td> <td></td> <td>yes</td> <td></td> <td>ecma<br></td> </tr> <tr> <td>php</td> <td> server-side <br> web <br></td> <td>yes</td> <td>yes</td> <td></td> <td>yes</td> <td></td> <td>yes</td> <td></td> <td>no<br></td> </tr> <tr> <td>python</td> <td> application<br> general purpose <br> web <br> scripting <br> ai <br> scientific computing <br></td> <td>yes</td> <td>yes</td> <td>yes</td> <td></td> <td></td> <td>yes</td> <td></td> <td>no<br></td> </tr> <tr> <td>basic</td> <td> application<br>education<br></td> <td>yes</td> <td></td> <td></td> <td>yes</td> <td></td> <td></td> <td></td> <td>ansi<br>iso<br></td> </tr> <tr> <td>ada</td> <td> application<br> system <br>embedded<br>realtime<br></td> <td>yes</td> <td>yes</td> <td></td> <td>yes</td> <td>yes</td> <td></td> <td></td> <td>ansi<br>iso<br>gost<br></td> </tr> <tr> <td>actionscript 3.0</td> <td> application<br> client-side <br> web <br></td> <td>yes</td> <td>yes</td> <td></td> <td></td> <td></td> <td></td> <td>yes</td> <td>ecma<br></td> </tr> </table> </body> </html>
Comments
Post a Comment