Sõitjate/mudelite ülevaade XSLT

From ICO wiki
Jump to navigationJump to search
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
  <xsl:output method="html" indent="yes"/>
  <xsl:template match="/">
    <html>
      <head>
        <title>Sõitjate nimekiri</title>
      </head>
      <body>
        <h1>Sõitjate nimekiri</h1>
        <ul>
          <xsl:for-each select="/EAMK/Members/Person">
            <li>
              <div>
                Nimi:
                <xsl:value-of select="./Name" />
              </div>
              <div>
                Mail:
                <xsl:value-of select="./EMail" />
              </div>
              <div>
                Isikukood:
                <xsl:value-of select="./@SocialCode" />
              </div>
              <h4>Mudelid</h4>
              <ul>
                <xsl:for-each select="./Models/Model">
                  <li>
                    <xsl:value-of select="./Category" /> -
                    <xsl:value-of select="./Name" /> -
                    <xsl:value-of select="./Producer" /> -
                    <xsl:value-of select="./Electronics" /> -
                    <!-- hoiame meeles sageduse ID -->
                    <xsl:variable name="Freq_ID" select="./@Freq_ID" />
                    <!-- Käime sagedused läbi-->
                    <xsl:for-each select="/EAMK/Freq_List/Frequencie">
                      <!-- Kui leidus see sagedus, kuva vastav nimi-->
                      <xsl:if test="@ID = $Freq_ID">
                        <xsl:value-of select="./Name" />
                      </xsl:if>
                    </xsl:for-each>
                  </li>
                </xsl:for-each>
              </ul>
            </li>
            <br />
            <br />
          </xsl:for-each>
        </ul>
      </body>
    </html>
  </xsl:template>
</xsl:stylesheet>