svn commit: r15300 - branches/xmlpropertypanels-penyaskito-soc08/argouml-core-propertypanels-scratch/xslt/uml14-panels.xsl

[email protected]
Newsgroups gmane.comp.lang.uml.argouml.cvs
Message-ID <[email protected]>
Author: penyaskito
Date: 2008-07-18 16:22:03-0700
New Revision: 15300

Modified:
   branches/xmlpropertypanels-penyaskito-soc08/argouml-core-propertypanels-scratch/xslt/uml14-panels.xsl

Log:
Some test code for determining the element type that is needed in the panel XMLs

Modified: branches/xmlpropertypanels-penyaskito-soc08/argouml-core-propertypanels-scratch/xslt/uml14-panels.xsl
Url: http://argouml.tigris.org/source/browse/argouml/branches/xmlpropertypanels-penyaskito-soc08/argouml-core-propertypanels-scratch/xslt/uml14-panels.xsl?view=diff&rev=15300&p1=branches/xmlpropertypanels-penyaskito-soc08/argouml-core-propertypanels-scratch/xslt/uml14-panels.xsl&p2=branches/xmlpropertypanels-penyaskito-soc08/argouml-core-propertypanels-scratch/xslt/uml14-panels.xsl&r1=15299&r2=15300
==============================================================================
--- branches/xmlpropertypanels-penyaskito-soc08/argouml-core-propertypanels-scratch/xslt/uml14-panels.xsl	(original)
+++ branches/xmlpropertypanels-penyaskito-soc08/argouml-core-propertypanels-scratch/xslt/uml14-panels.xsl	2008-07-18 16:22:03-0700
@@ -3,25 +3,86 @@
 	xmlns:xsl="http://www.w3.org/1999/XSL/Transform"

 	xmlns:Model='omg.org/mof.Model/1.3'>

 

-<xsl:output method="xml" indent="yes"/>	

+	<xsl:output method="xml" indent="yes" />

 

-<xsl:template match="/XMI/XMI.content/Model:Package[@name='Core']/Model:Namespace.contents">

-	<panels>

-     	<xsl:for-each select="Model:Class">

-			<panel name="{@name}">

-			<xsl:for-each select="Model:Namespace.contents//Model:Attribute">

-		  		<xsl:variable name="datatypeRef" select="@type" />

-  				<xsl:variable name="datatype" select="//Model:DataType[@xmi.id=$datatypeRef]/@name" />

-		  		<item name="{@name}" type="{$datatype}" />   		

+	<xsl:template

+		match="/XMI/XMI.content/Model:Package[@name='Core']/Model:Namespace.contents">

+		<panels>

+			<xsl:for-each select="Model:Class">

+				<panel name="{@name}">

+					<!-- We take the references -->

+					<xsl:for-each

+						select="Model:Namespace.contents//Model:References">

+						<xsl:variable name="datatypeRef" select="@type" />

+						<xsl:variable name="datatype"

+							select="//Model:Class[@xmi.id=$datatypeRef]/@name" />

+						<xsl:variable name="multiplicityLower"

+							select="Model:StructuralFeature.multiplicity/XMI.field[1]" />

+						<xsl:variable name="multiplicityUpper"

+							select="Model:StructuralFeature.multiplicity/XMI.field[2]" />

+						<xsl:choose>

+							<xsl:when test="$datatype = 'Namespace'">

+								<combo name="{@name}" multiplicity="{$multiplicityUpper - $multiplicityLower}" />

+							</xsl:when>

+							<xsl:otherwise>

+							</xsl:otherwise>							

+						</xsl:choose>

+					</xsl:for-each>

+					<!-- We take the attributes -->

+					<xsl:for-each

+						select="Model:Namespace.contents//Model:Attribute">

+						<xsl:variable name="datatypeRef" select="@type" />

+						<xsl:variable name="datatype"

+							select="//Model:DataType[@xmi.id=$datatypeRef]/@name" />

+						<xsl:variable name="multiplicityLower"

+							select="Model:StructuralFeature.multiplicity/XMI.field[1]" />

+						<xsl:variable name="multiplicityUpper"

+							select="Model:StructuralFeature.multiplicity/XMI.field[2]" />

+						<xsl:choose>

+							<xsl:when test="$datatype = 'Boolean'">

+								<checkbox name="{@name}"

+									type="{$datatype}"

+									multiplicity="{$multiplicityUpper - $multiplicityLower}" />

+							</xsl:when>

+							<xsl:otherwise>

+								<xsl:choose>

+									<xsl:when

+										test="$datatype = 'Name'">

+										<text name="{@name}" />

+									</xsl:when>

+									<xsl:otherwise>

+										<xsl:choose>

+											<xsl:when

+												test="$multiplicityUpper  = $multiplicityLower">

+												<singlerow

+													name="{@name}" type="{$datatype}"

+													multiplicity="{$multiplicityUpper - $multiplicityLower}" />

+											</xsl:when>

+											<xsl:when

+												test="$multiplicityLower = -1">

+												<list name="{@name}"

+													type="{$datatype}"

+													multiplicity="{$multiplicityUpper - $multiplicityLower}" />

+											</xsl:when>

+											<xsl:otherwise>

+												<item name="{@name}"

+													type="{$datatype}"

+													multiplicity="{$multiplicityUpper - $multiplicityLower}" />

+											</xsl:otherwise>

+										</xsl:choose>

+									</xsl:otherwise>

+								</xsl:choose>

+							</xsl:otherwise>

+						</xsl:choose>

+					</xsl:for-each>

+				</panel>

 			</xsl:for-each>

-			</panel>

-      	</xsl:for-each>

-	</panels>

-   	<xsl:apply-templates />

-</xsl:template>

-	

-<xsl:template match="@*|node()">

-   	<xsl:apply-templates/>

-</xsl:template>

+		</panels>

+		<xsl:apply-templates />

+	</xsl:template>

+

+	<xsl:template match="@*|node()">

+		<xsl:apply-templates />

+	</xsl:template>

 

 </xsl:stylesheet>
\ No newline at end of file
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.