2 <xsl:stylesheet xmlns:
xsl=
"http://www.w3.org/1999/XSL/Transform"
4 <xsl:output method=
"xml" indent=
"yes"/>
5 <xsl:param name=
"lang" />
6 <xsl:param name=
"source" />
8 <xsl:template match=
"processing-instruction()" />
10 <xsl:template match=
"/typesystem">
12 <xsl:for-each select=
"@*">
14 <xsl:value-of select=
"." />
18 <xsl:for-each select=
"document($source)/typesystem/@*">
20 <xsl:value-of select=
"." />
24 <xsl:variable name=
"other" select=
"document($source)/typesystem/*[not(self::object-type | self::value-type | self::interface-type | self::namespace-type)]" />
25 <xsl:if test=
"$other">
27 <xsl:when test=
"$lang != ''">
28 <xsl:element name=
"language">
29 <xsl:attribute name=
"name" ><xsl:value-of select=
"$lang" /></xsl:attribute>
30 <xsl:copy-of select=
"$other" />
34 <xsl:copy-of select=
"$other" />
39 <xsl:apply-templates select=
"node()" />
46 <xsl:template match=
"/typesystem/*[self::object-type | self::value-type | self::interface-type | self::namespace-type]">
47 <xsl:variable name=
"name" select=
"name()" />
49 <xsl:for-each select=
"@*">
51 <xsl:value-of select=
"." />
55 <xsl:apply-templates select=
"node()" />
57 <xsl:variable name=
"other" select=
"document($source)/typesystem/*[name() = $name][@name = current()/@name]" />
58 <xsl:if test=
"$other">
60 <xsl:when test=
"$lang != ''">
61 <xsl:element name=
"language">
62 <xsl:attribute name=
"name" ><xsl:value-of select=
"$lang" /></xsl:attribute>
63 <xsl:copy-of select=
"$other/node()" />
67 <xsl:copy-of select=
"$other/node()" />
74 <!-- Plain identity transform. -->
75 <xsl:template match=
"@*|node()">
77 <xsl:apply-templates select=
"@*"/>
78 <xsl:apply-templates select=
"node()"/>