I thought about my example and thought about what might happen if e.g.
element node will be inside some other hierarchy.
For instance - i took my doc.xml and created family.xml
I took <node> as <person>. I've created generations, mariages, singles, and
children(mariages) for new recursive generations.
Still does node has its own hierarchy inside generation hierarchy(i hope i
made myself clear ;))
I tried to branch(display) only the <person>
given xml:
<?xml version="1.0" encoding="iso-8859-2"?>
<?xml-stylesheet type="text/xsl" href="style.xsl"?>
<tree>
<generation level="1">
<mariage>
<person>
<first_name>Aaa</first_name>
<last_name>Qwq</last_name>
</person>
<person>
<first_name>Bbb</first_name>
<last_name>aaa</last_name>
</person>
<children>
<generation level="2">
<mariage>
<person>
<first_name>MMM</first_name>
<last_name>qqq</last_name>
</person>
<person>
<first_name>P</first_name>
<last_name>K</last_name>
</person>
<children/>
</mariage>
<single>
<person>
<first_name>P</first_name>
<last_name>ww</last_name>
</person>
</single>
</generation>
</children>
</mariage>
<single>
<person>
<first_name>P</first_name>
<last_name>ww</last_name>
</person>
</single>
</generation>
</tree>
and yours the stylesheet(a bit modified):
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<html>
<body>
<xsl:apply-templates/>
</body>
</html>
</xsl:template>
<xsl:template match="*[not(self::person) and person]">
<table border="1">
<tr>
<xsl:apply-templates select="person"/>
</tr>
</table>
</xsl:template>
<xsl:template match="person">
<tr>
<td ><xsl:value-of select="name()"/></td>
<td><xsl:value-of select="last_name"/></td>
<td><xsl:value-of select="first_name"/></td>
<xsl:if test="person">
<tr>
<td>   </td>
<td>
<table border="1">
<xsl:apply-templates select="person"/>
</table>
</td>
</tr>
</xsl:if>
</tr>
</xsl:template>
</xsl:stylesheet>
I tried to display all the persons - but only top generation(level='1') was
displayed
I don't know how to ommit all those unnecessary(from my point of view, as
far as i'm only interested in persons) elements and simply display only
persons as a branching table.
thanks in advance
you already helped me a lot with the understanding the XSLT
greetings R
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (
http://www.grisoft.com).
Version: 6.0.554 / Virus Database: 346 - Release Date: 03-12-20