[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

newbie question: combining two trees

Subject: newbie question: combining two trees
From: Marko Draisma <mdraisma@xxxxxxxxxxx>
Date: Mon, 24 Jan 2000 21:5:0 +0100
combining two trees
In one xml file I have two trees: one describes the departments, the other employees. I want to generate a html-file in which both trees are combined.
I guess I have to use variables or parameters, but nothing seems to work. Help is deeply appreciated.

This is my xml-file:

<?xml version="1.0"?>
<TABLES>
<DEPTS>
<ROW_DEPT>
      <DEPTNR>10</DEPTNR>
      <NAME>BOEKHOUDING</NAME>
    </ROW_DEPT>
<ROW_DEPT>
      <DEPTNR>20</DEPTNR>
      <NAME>ONDERZOEK</NAME>
    </ROW_DEPT>
</DEPTS>
<EMPS>
<ROW_EMP>
      <NAME>SMITS</NAME>
      <DEPTNR>20</DEPTNR>
    </ROW_EMP>
<ROW_EMP>
      <NAME>HEUVEL</NAME>
      <DEPTNR>10</DEPTNR>
    </ROW_EMP>
</EMPS>
</TABLES>

And this is my attempt to combine both tables:

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
  <xsl:template match="/">
    <html>
      <head>
        <title>Employees</title>
      </head>
      <body>
        <xsl:apply-templates/>
      </body>
    </html>
  </xsl:template>
  <xsl:template match="DEPTS">
      <xsl:for-each select="ROW_DEPT">
              <xsl:value-of select="NAME"/><br/>
        <xsl:variable name="test" select="DEPTNR"/>
        <xsl:for-each select=".../EMPS/ROW_EMP[DEPTNR=$test]">
                <xsl:value-of select="NAME"/>
        </xsl:for-each>
         <br/>
      </xsl:for-each>
  </xsl:template>
</xsl:stylesheet>

Marko Draisma.
Marko Draisma
mdraisma@xxxxxxxxxxx
http://huizen.nhkanaal.nl/~huissie


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.