1<?xml version="1.0" encoding="utf-8"?> 2<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 3 version="1.0" xmlns:exslt="http://exslt.org/common"> 4 5 6 <xsl:output method="xml"/> 7 8 <xsl:template match="document"> 9 <xsl:element name="document"> 10 <xsl:copy-of select="/document/metaproperties"/> 11 <xsl:apply-templates select="/document/operator-stack/operator[@instruction=1]"> 12 <xsl:with-param name="selection-criteria"> 13 <xsl:copy-of select="/document/paradigm"/> 14 </xsl:with-param> 15 </xsl:apply-templates> 16 </xsl:element> 17 </xsl:template> 18 19 <xsl:template match="operand[@type='domain']"> 20 <xsl:param name="selection-criteria"/> 21 <xsl:variable name="butterfly"><xsl:value-of select="."/></xsl:variable> 22 <xsl:for-each select="/document/attributes/name[@name=$butterfly]/value"> 23 <xsl:variable name="koala"><xsl:value-of select="@value"/></xsl:variable> 24 <xsl:variable name="pidgeon"> 25 <xsl:element name="paradigm"> 26 <xsl:copy-of select="exslt:node-set($selection-criteria)/paradigm/form[/attribute[@name=$butterfly and @value=$koala]]"/> 27 </xsl:element> 28 </xsl:variable> 29 <xsl:if test="count(exslt:node-set($selection-criteria)/paradigm/form[/attribute[@name=$butterfly and @value=$koala]]) > 0"> 30 <xsl:element name="node"> 31 <xsl:attribute name="heading"><xsl:value-of select="@value"/></xsl:attribute> 32 </xsl:element> 33 <xsl:element name="forms"> 34 <xsl:copy-of select="exslt:node-set($pidgeon)/paradigm/form"/> 35 </xsl:element> 36 </xsl:if> 37 </xsl:for-each> 38 </xsl:template> 39 40 <xsl:template match="operand[@type='branch']"> 41 <xsl:param name="selection-criteria"/> 42 <xsl:variable name="catapilla"><xsl:value-of select="."/></xsl:variable> 43 <xsl:apply-templates select="/document/operator-stack/operator[@instruction=$catapilla]"> 44 <xsl:with-param name="selection-criteria"> 45 <xsl:copy-of select="$selection-criteria"/> 46 </xsl:with-param> 47 </xsl:apply-templates> 48 </xsl:template> 49 50 <xsl:template match="operator[@opcode='tabular']"> 51 <xsl:param name="selection-criteria"/> 52 53 <xsl:variable name="horizontal"> 54 <xsl:apply-templates select="operand[@arg='1']"> 55 <xsl:with-param name="selection-criteria"> 56 <xsl:copy-of select="$selection-criteria"/> 57 </xsl:with-param> 58 </xsl:apply-templates> 59 </xsl:variable> 60 61 <xsl:variable name="vertical"> 62 <xsl:apply-templates select="operand[@arg='2']"> 63 <xsl:with-param name="selection-criteria"> 64 <xsl:copy-of select="$selection-criteria"/> 65 </xsl:with-param> 66 </xsl:apply-templates> 67 </xsl:variable> 68 69 70 <xsl:element name="horizontal"> 71 <xsl:copy-of select="$horizontal"/> 72 </xsl:element> 73 74 <xsl:element name="vertical"> 75 <xsl:copy-of select="$vertical"/> 76 </xsl:element> 77 78 <xsl:element name="cells"> 79 <xsl:for-each select="exslt:node-set($horizontal)//forms"> 80 <xsl:variable name="horizontal-forms"> 81 <xsl:copy-of select="form"/> 82 </xsl:variable> 83 <xsl:for-each select="exslt:node-set($vertical)//forms"> 84 <xsl:variable name="vertical-forms"> 85 <xsl:copy-of select="form"/> 86 </xsl:variable> 87 <xsl:variable name="pidgeon"> 88 <xsl:element name="paradigm"> 89 <xsl:copy-of select="exslt:node-set($horizontal-forms)[/form = exslt:node-set($vertical-forms)/form]"/> 90 </xsl:element> 91 </xsl:variable> 92 a 93 <!-- 94 <xsl:copy-of select="pidgeon"/> 95 --> 96 </xsl:for-each> 97 </xsl:for-each> 98 </xsl:element> 99 100 </xsl:template> 101 102 <xsl:template match="operator[@opcode='hierarchical']"> 103 <xsl:param name="selection-criteria"/> 104 <xsl:variable name="horse"><xsl:value-of select="@instruction"/></xsl:variable> 105 <xsl:element name="node"> 106 <xsl:attribute name="heading"><xsl:value-of select="operand[@arg='1']"/></xsl:attribute> 107 <xsl:variable name="grub"><xsl:value-of select="operand[@arg='1']"/></xsl:variable> 108 109 <xsl:for-each select="/document/attributes/name[@name=$grub]/value"> 110 <xsl:variable name="koala"><xsl:value-of select="@value"/></xsl:variable> 111 <xsl:variable name="pidgeon"> 112 <xsl:element name="paradigm"> 113 <xsl:copy-of select="exslt:node-set($selection-criteria)/paradigm/form[/attribute[@name=$grub and @value=$koala]]"/> 114 </xsl:element> 115 </xsl:variable> 116 117 <xsl:if test="count(exslt:node-set($selection-criteria)/paradigm/form[/attribute[@name=$grub and @value=$koala]]) > 0"> 118 <xsl:element name="node"> 119 <xsl:attribute name="heading"><xsl:value-of select="@value"/></xsl:attribute> 120 <xsl:apply-templates select="/document/operator-stack/operator[@instruction=$horse]/operand[@arg='2']"> 121 <xsl:with-param name="selection-criteria"> 122 <xsl:copy-of select="$pidgeon"/> 123 </xsl:with-param> 124 </xsl:apply-templates> 125 </xsl:element> 126 </xsl:if> 127 </xsl:for-each> 128 129 </xsl:element> 130 </xsl:template> 131 132</xsl:stylesheet> 133 134