xref: /aosp_15_r20/external/apache-xml/test/tests/api/impincl/MinitestInclude.xsl (revision 1212f9a0ffdc28482b8821715d2222bf16dc14e2)
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: [email protected] -->
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>&#10;   </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
68  <!--
69   * Licensed to the Apache Software Foundation (ASF) under one
70   * or more contributor license agreements. See the NOTICE file
71   * distributed with this work for additional information
72   * regarding copyright ownership. The ASF licenses this file
73   * to you under the Apache License, Version 2.0 (the  "License");
74   * you may not use this file except in compliance with the License.
75   * You may obtain a copy of the License at
76   *
77   *     http://www.apache.org/licenses/LICENSE-2.0
78   *
79   * Unless required by applicable law or agreed to in writing, software
80   * distributed under the License is distributed on an "AS IS" BASIS,
81   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
82   * See the License for the specific language governing permissions and
83   * limitations under the License.
84  -->
85
86</xsl:stylesheet>
87