Advertisement
tankcr

XLS Drop-Down

Mar 19th, 2014
143
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
XML 1.60 KB | None | 0 0
  1. <!-- DWXMLSource="/Plants.xml" --><xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
  2.     <xsl:output method="html" indent="yes" encoding="UTF-8" omit-xml-declaration="yes"/>
  3.  
  4.     <xsl:template match="/">
  5.         <xsl:param name="listIdx" select="0"/>
  6.         <table>
  7.             <thead>
  8.                 <tr>
  9.                     <td>Computer Name</td>
  10.                 </tr>
  11.             </thead>
  12.             <tbody>
  13.                 <xsl:for-each select="Events/Event">
  14.                     <xsl:variable name="position" select="position()"/>
  15.                     <tr>
  16.                         <td>
  17.                             <select>
  18.                                 <xsl:for-each select="System/Computer">
  19.                                     <xsl:element name="option">
  20.                                         <xsl:attribute name="value">
  21.                                             <xsl:value-of select="@Computer"/>
  22.                                         </xsl:attribute>
  23.                                         <xsl:if test="position() = $position">
  24.                                             <xsl:attribute name="selected">selected</xsl:attribute>
  25.                                         </xsl:if>
  26.                                         <xsl:value-of select="@Computer"/>
  27.                                     </xsl:element>
  28.                                 </xsl:for-each>
  29.                             </select>
  30.                         </td>
  31.                     </tr>
  32.                 </xsl:for-each>
  33.             </tbody>
  34.         </table>
  35.     </xsl:template>
  36. </xsl:stylesheet>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement