1 <?xml version="1.0"?> 2 <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> 3 4 <!-- Filename: MinitestInclude.xsl --> 5 <!-- Author: Paul_Dick@lotus.com --> 6 7 <xsl:template name="tree"> 8 <xsl:param name="Surname" select="Default"/> 9 10 <xsl:comment> Create an simplified output tree for each family </xsl:comment><xsl:text> </xsl:text> 11 <xsl:element name="{$root}"> 12 <xsl:element name="{substring-after($Surname,'The ')}"> 13 14 <!-- Start with the Parents.--> 15 <xsl:element name="Parents"> 16 <xsl:for-each select="Parents/Father | Parents/Mother"> 17 <xsl:element name="{name(.)}"> 18 <xsl:value-of select="."/> 19 </xsl:element> 20 </xsl:for-each> 21 </xsl:element> 22 23 <!-- Then the Children. --> 24 <xsl:element name="Children"> 25 <xsl:attribute name="number"> 26 <xsl:value-of select="count(Children/Child)"/> 27 </xsl:attribute> 28 <xsl:for-each select="Children/Child"> 29 <xsl:element name="{Personal_Information/Sex}"> 30 31 <xsl:attribute name="name"> 32 <xsl:value-of select="Basic_Information/Name/@First"/> 33 </xsl:attribute> 34 <xsl:choose> 35 <xsl:when test="Personal_Information/Sex='Male'"> 36 <xsl:attribute name="wife"> 37 <xsl:value-of select="Personal_Information/Family_Information/Wife/Name/@First"/> 38 </xsl:attribute> 39 </xsl:when> 40 <xsl:when test="Personal_Information/Sex='Female'"> 41 <xsl:attribute name="husband"> 42 <xsl:value-of select="Personal_Information/Family_Information/Husband/Name/@First"/> 43 </xsl:attribute> 44 </xsl:when> 45 </xsl:choose> 46 47 <xsl:attribute name="kids"> 48 <xsl:value-of select="count(Personal_Information/Family_Information/Kids/Kid)"/> 49 </xsl:attribute> 50 51 <xsl:if test="count(Personal_Information/Family_Information/Kids/Kid)"> 52 <xsl:element name="Kids"> 53 <xsl:for-each select="Personal_Information/Family_Information/Kids/Kid"> 54 <xsl:element name="Grandkid"><xsl:value-of select="Name/@First"/></xsl:element> 55 </xsl:for-each> 56 </xsl:element> 57 </xsl:if> 58 59 <xsl:value-of select="Basic_Information/Name/@First"/> 60 </xsl:element> 61 </xsl:for-each> 62 </xsl:element> 63 64 </xsl:element> 65 </xsl:element> 66 </xsl:template> 67 </xsl:stylesheet>