I hope I can describe the problem in a understandable way:
I have a big XML file with more than 1000 entries which must be displayed in a HTML file. The entries (lets say employee names) are grouped in different sections (departments). In the HTML file I have to create a table for each department and list all employees with some attributes.
The XML structure is like this:
<section name="department_A">
<entry name="john doe" gender="m" age="20"></entry>
<entry name="luke smith" gender="m" age="34"></entry>
</section>
<section name="department_B">
<entry name="jane doe" gender="f" age="25"></entry>
<entry name="ben b" gender="m" age="43"></entry>
</section>
<section name="department_A and department_B">
<entry name="john doe" gender="m" age="20"></entry>
<entry name="nick fury" gender="m" age="53"></entry>
</section>
<section name="different departments">
<entry name="ben b" gender="m" age="27">
<desciption>Belongs to dep_B and dep_C</description>
</entry>
<entry name="chris h" gender="m" age="33">
<description>Belongs to dep_C and dep_F</description>
</entry>
</section>
In the HTML file, each section name is displayed as a heading, each entry is a table row and each attribute is a table column. The following xls file is used for this:
<xsl:for-each select="section">
<h1><a name="{@name}"> [<xsl:value-of select="@name"/>] </a></h1>
<table>
<tr>
<th>Name</th>
<th>Gender</th>
<th>Age</th>
</tr>
<xsl:for-each select="entry">
<tr>
<td><xsl:value-of select="@name"/></td>
<td><xsl:value-of select="@gender"/></td>
<td><xsl:value-of select="@age"/></td>
</tr>
</xsl:for-each>
Till now the XML and XSL files worked fine. However, the problem is that I have to create html tables a little more "independent" from the XML structure, since some entries must be listed in several tables.
For example, the employee "john doe" only occurs in section="department_A", but it must be displayed in the table for department_A, department_B and department_C. Is there any way to do this without copying each entry to all regarding sections?
My approach was to add another attribute to the regarding entry (like entry name="john doe" gender="m" age="20" dep="department_B,department_C"). Is it possible to create the table for a section, fill in all entries of the section (e.g. of department_B) and then browse all entries in the entire document, check if there are entries with attribute "dep" which contains the name equal to the section name and append this entry to the table?
Or is there any other way to do this (without xls)? I hope the description is sufficient. Thanks for the help!
departmentelements, instead of a single attribute with multiple substring tokens..departmentelement for each department he/she belongs to (same as in a relational DB). If you cannot change the format, then edit your question and show an example of the format that you have to work with. -- P.S. "dep_A & dep_B" are not different department elements.