style-fil(legekontor.xsl)

<?xml version="1.0" encoding="iso-8859-1"?>

<xsl:stylesheet version="1.0" 
                xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

<xsl:template match="/">
   <html>
   <head>
     <title>Legekontor</title>
   </head>

   <body>

   <h1>Legekontor</h1>

   <table border="1" cellpadding="10" cellspacing="0">
   <tr>
      <th align="left" valign="top">Navn</th>
      <th align="left" valign="top">Adresse</th>
      <th align="left" valign="top">Telefon</th>
      <th align="left" valign="top">Fax</th>
   </tr>
       
   <xsl:for-each select="legekontor">
   <tr>
      <td valign="top"><xsl:value-of select="navn"/></td>
      <td valign="top"><xsl:value-of select="adresse"/></td>
      <td valign="top"><xsl:value-of select="tlf"/></td>
      <td valign="top"><xsl:value-of select="fax"/></td>
   </tr>
   </xsl:for-each>
   </table>

   <h2>Leger</h2>

   <table border="1" cellpadding="10" cellspacing="0">
   <tr>
      <th align="left" valign="top">Legeid</th>
      <th align="left" valign="top">Navn</th>
      <th align="left" valign="top">Telefon, intern</th>
      <th align="left" valign="top">Adresse, privat</th>
      <th align="left" valign="top">Telefon, privat</th>
   </tr>
       
   <xsl:for-each select="legekontor/lege">
   <tr>
      <td valign="top"><xsl:value-of select="id"/></td>
      <td valign="top"><xsl:value-of select="navn"/></td>
      <td valign="top"><xsl:value-of select="internTlf"/></td>
      <td valign="top"><xsl:value-of select="hjemAdresse"/></td>
      <td valign="top"><xsl:value-of select="hjemTlf"/></td>
   </tr>
   </xsl:for-each>
   </table>

   <h2>Pasienter</h2>

   <table border="1" cellpadding="10" cellspacing="0" width="100%">
   <tr>
      <th align="left" valign="top">Personnr</th>
      <th align="left" valign="top">Fastlegeid</th>
      <th align="left" valign="top">Navn</th>
      <th align="left" valign="top">Adresse</th>
      <th align="left" valign="top">Telefon</th>
      <th align="left" valign="top">Yrke</th>
      <th align="left" valign="top" width="50%">Behandling</th>
   </tr>
       
   <xsl:for-each select="legekontor/pasient">

   <tr>
      <td valign="top"><xsl:value-of select="personnr"/></td>
      <td valign="top"><xsl:value-of select="fastlegeid"/></td>
      <td valign="top"><xsl:value-of select="navn"/></td>
      <td valign="top"><xsl:value-of select="adresse"/></td>
      <td valign="top"><xsl:value-of select="tlf"/></td>
      <td valign="top"><xsl:value-of select="yrke"/></td>
      <td valign="top">
         <table border="1" cellpadding="10" cellspacing="0" width="100%">
         <tr>
            <th align="left" valign="top" width="10%">Legeid</th>
            <th align="left" valign="top" width="25%">Dato</th>
            <th align="left" valign="top">Journal</th>
         </tr>
         <xsl:for-each select="legebesok">
         <tr>
            <td valign="top"><xsl:value-of select="legeid"/></td>
            <td valign="top">
              <xsl:variable name="origDate">
                <xsl:value-of select="dato"/>
              </xsl:variable>

              <xsl:variable name="aar">
                <xsl:value-of select="substring-before($origDate, '-')"/>
              </xsl:variable>

              <xsl:variable name="mndDagTid">
                <xsl:value-of select="substring-after($origDate, '-')"/>
              </xsl:variable>

              <xsl:variable name="mnd">
                <xsl:value-of select="substring-before($mndDagTid, '-')"/>
              </xsl:variable>
              
              <xsl:variable name="dagTid">
                <xsl:value-of select="substring-after($mndDagTid, '-')"/>
              </xsl:variable>

              <xsl:variable name="dag">
                <xsl:value-of select="substring-before($dagTid, 'T')"/>
              </xsl:variable>

              <xsl:variable name="tid">
                <xsl:value-of select="substring-after($dagTid, 'T')"/>
              </xsl:variable>

              <xsl:value-of select="concat($dag, '/', $mnd, '-', $aar, ' kl.', $tid)"/>

            </td>
            <td valign="top"><xsl:value-of select="journal"/></td>
         </tr>
         </xsl:for-each>
         </table>
      </td>
   </tr>
   </xsl:for-each>
   </table>
        
   </body>
   </html>
</xsl:template>

</xsl:stylesheet>