XSLT Functions Library

Function Summary

Class[]cr:entities(root document)
Class[]cr:services(root document)
Interface[]cr:interfaces(root document)
Enumeration[], Class[]cr:enumerations(root document)
string[]cr:enumerationLiterals(EnumerationLiteral, Attribute node)
Class[]cr:classes(string stereotype, root document)
Association.connection[]cr:connections(root document)
Association.connection[]cr:entityConnections(root document)
AssociationEnd[], ownedAttribute[]cr:ends(Class node, root document)
AssociationEnd[], ownedAttribute[]cr:importedEnds(Class node, root document)
AssociationEndcr:end(Association.connection node, int index, root document)
Attribute[], ownedAttribute[]cr:attributes(Class node)
Attribute[], ownedAttribute[]cr:staticAttributes(Class node)
Operations[], ownedOperation[]cr:operations(Class node)
Parameter[], ownedParameter[]cr:parameters(Operation node, root document)
stringcr:parametersSignature(Parameter[] parameters, root document)
stringcr:parametersArguments(Parameter[] parameters, root document)
stringcr:returnType(Operation node, root document)
stringcr:implements(Class node, root document)
stringcr:extends(Class node, root document)
Class[], ownedMember[]cr:subclasses(Class node, root document)
intcr:multiUpper(AssociationEnd node)
intcr:multiLower(AssociationEnd node)
booleancr:navigable(AssociationEnd node)
AssociationEnd, ownedAttribute, ownedEndcr:otherEnd(AssociationEnd node, root document)
stringcr:nameUpper(any node)
stringcr:name(any node)
stringcr:visibility(any node)
stringcr:abstract(any node)
stringcr:static(any node)
string[]cr:classImports(string sub, stereotype, root document)
stringcr:classPackage(string sub, Class node, root document)
stringcr:package(Class node)
stringcr:fullClassName(string sub, Class node, root document)
stringcr:lowerMulti(any node)
Class, ownedMembercr:endClass(AssociationEnd node, root document)
stringcr:endClassName(AssociationEnd node, root document)
stringcr:endClassNameFull(AssociationEnd node, root document)
stringcr:isFirstEnd(AssociationEnd node, root document)
stringcr:endFieldName(AssociationEnd node, root document)
stringcr:dataType(Attribute node, root document)
stringcr:initialValue(Attribute node, root document)
cr:sourceFileName(string sub, string name, string ext, Class node, root document)
stringcr:fileNameJava(string sub, string name, Class node, root document)
stringcr:fileNameHbm(string sub, string name, Class node, root document)
stringcr:commonClassFileName(string sub, string name, root document)
stringcr:commonClassPackage(string sub, root document)
stringcr:fileNameJsp(string name, Class node, root document)
stringcr:fileNameRootJsp(string name, root document)
stringcr:fileNameConfig(string name, root document)
stringcr:listLink(Class node, root document)
stringcr:modelName(root document)
stringcr:basePackage(root document)
stringcr:projectName(root document)
stringcr:modelValue(string name, root document)
stringcr:taggedValue(string name, any node, root document)
stringcr:upper(string name)
stringcr:lower(string name)
booleancr:inStrings(string in, string[] list)
stringcr:map(string file, string from)
StateMachine[], ownedBehavior[]cr:allStateMachines(root document)
StateMachine[], ownedBehavior[]cr:stateMachines(Class node)
State[], subvertex[]cr:simpleStates(StateMachine node)
Pseudostate[]cr:initialStates(StateMachine node)
FinalState[]cr:finalStates(StateMachine node)
Pseudostate[]cr:choiceStates(StateMachine node)
ObjectFlowState[]cr:objectFlowStates(StateMachine node)
Transition[], transition[]cr:transitions(StateMachine node)
Transition[], transition[]cr:stateTransitions(StateMachine node, root document)
CallTrigger, ownedMembercr:trigger(Transition node, root document)
Operation, ownedOperationcr:triggerOperation(CallTrigger node, root document)
Guardcr:guard(Transition node)
stringcr:guardBody(Transition node)
CallActioncr:effect(Transition node)
State, Pseudostate, FinalState, subvertexcr:transitionSource(Transition node, root document)
State, Pseudostate, FinalState, subvertexcr:transitionTarget(Transition node, root document)
booleancr:isTransitionTargetChoice(Transition node, root document)
Transition[], transition[]cr:outgoingTransitions(SimpleState, ObjectFlowState, Pseudostate, FinalState node, root document)
Transition[], transition[]cr:incomingTransitions(SimpleState, ObjectFlowState, Pseudostate, FinalState node, root document)
Transition[], transition[]cr:nextTransitions(SimpleState, ObjectFlowState, Pseudostate, FinalState node, root document)
Class, UseCase, ownedMembercr:stateMachineContext(any node, root document)

Function Detail

cr:entities

Class[] cr:entities(root document)

Select all class elements with entity stereotype

Parameters:

  • document - model xmi document: root(.)

cr:services

Class[] cr:services(root document)

Select all class elements with service stereotype

Parameters:

  • document - model xmi document: root(.)

cr:interfaces

Interface[] cr:interfaces(root document)

Select all interfaces

Parameters:

  • document - model xmi document: root(.)

cr:enumerations

Enumeration[], Class[] cr:enumerations(root document)

Select all enumerations or class elements with enumeration stereotype

Parameters:

  • document - model xmi document: root(.)

cr:enumerationLiterals

string[] cr:enumerationLiterals(EnumerationLiteral, Attribute node)

Select names of all members of an enumeration class

Parameters:

  • node - current node: current()

cr:classes

Class[] cr:classes(string stereotype, root document)

Select all class elements. If stereotype is supplied, only those marked by the stereotype are selected. Stereotype name is symbolic and several stereotype names may be defined in a mapping file, ex. 'entity', 'Entity' and 'UML Standard Profile::entity' mean the same thing and map to 'entity', so to get all entities, call cr:classes('entity', root(.)) while in your model entities may be marked as 'UML Standard Profile::entity'. If no stereotype is supplied (parameter stereotype is empty: ''), all classes are selected regardless of their stereotype. If stereotype parameter is 'void', only classes that have no stereotype are selected.

Parameters:

  • stereotype - symbolic stereotype name like entity, service, enumeration
  • document - model xmi document: root(.)

cr:connections

Association.connection[] cr:connections(root document)

Select all association connections between classes

Parameters:

  • document - model xmi document: root(.)

cr:entityConnections

Association.connection[] cr:entityConnections(root document)

Select all association connections between classes with entity stereotype

Parameters:

  • document - model xmi document: root(.)

cr:ends

AssociationEnd[], ownedAttribute[] cr:ends(Class node, root document)

Select all navigable connection ends if either of them points to the current class

Parameters:

  • node - current node: current()
  • document - model xmi document: root(.)

cr:importedEnds

AssociationEnd[], ownedAttribute[] cr:importedEnds(Class node, root document)

Select navigable connection ends with multiplicity 1 if either of them points to the current class

Parameters:

  • node - current node: current()
  • document - model xmi document: root(.)

cr:end

AssociationEnd cr:end(Association.connection node, int index, root document)

Selects first or second (my or other) end in an association

Parameters:

  • node - current node: current()
  • index - index: 1 or 2
  • document - model xmi document: root(.)

cr:attributes

Attribute[], ownedAttribute[] cr:attributes(Class node)

Select all non-static attributes (fields) of the current class

Parameters:

  • node - current node: current()

cr:staticAttributes

Attribute[], ownedAttribute[] cr:staticAttributes(Class node)

Select all static attributes (fields) of the current class

Parameters:

  • node - current node: current()

cr:operations

Operations[], ownedOperation[] cr:operations(Class node)

Select all operations (methods) of the current class

Parameters:

  • node - current node: current()

cr:parameters

Parameter[], ownedParameter[] cr:parameters(Operation node, root document)

Select all non return parameters of a given operation

Parameters:

  • node - current node: current()
  • document - model xmi document: root(.)

cr:parametersSignature

string cr:parametersSignature(Parameter[] parameters, root document)

Form method signature string from parameters

Parameters:

  • parameters - parameters to form signature
  • document - model xmi document: root(.)

cr:parametersArguments

string cr:parametersArguments(Parameter[] parameters, root document)

Form method arguments string from parameters

Parameters:

  • parameters - parameters to form signature
  • document - model xmi document: root(.)

cr:returnType

string cr:returnType(Operation node, root document)

Get return type of a given operation, void if not specified

Parameters:

  • node - current node: current()
  • document - model xmi document: root(.)

cr:implements

string cr:implements(Class node, root document)

Get a string listing all the interfaces the current class implements

Parameters:

  • node - current node: current()
  • document - model xmi document: root(.)

cr:extends

string cr:extends(Class node, root document)

Get a string listing the class the current class extends

Parameters:

  • node - current node: current()
  • document - model xmi document: root(.)

cr:subclasses

Class[], ownedMember[] cr:subclasses(Class node, root document)

Select all subclasses of the current class

Parameters:

  • node - current node: current()
  • document - model xmi document: root(.)

cr:multiUpper

int cr:multiUpper(AssociationEnd node)

Get upper boundary of the multiplicity of the connection end. Return 1 if not specified, -1 if set to *

Parameters:

  • node - current node: current()

cr:multiLower

int cr:multiLower(AssociationEnd node)

Get lower boundary of the multiplicity of the connection end. Return 1 if not specified, -1 if set to *

Parameters:

  • node - current node: current()

cr:navigable

boolean cr:navigable(AssociationEnd node)

Get navigability property of the connection end

Parameters:

  • node - current node: current()

cr:otherEnd

AssociationEnd, ownedAttribute, ownedEnd cr:otherEnd(AssociationEnd node, root document)

Get the other end of the current end's connection

Parameters:

  • node - current node: current()
  • document - model xmi document: root(.)

cr:nameUpper

string cr:nameUpper(any node)

Get uppercased name attribute of the current node

Parameters:

  • node - current node: current()

cr:name

string cr:name(any node)

Get name attribute of the current node

Parameters:

  • node - current node: current()

cr:visibility

string cr:visibility(any node)

Get visibility attribute of the current node. If none specified, return 'public'

Parameters:

  • node - current node: current()

cr:abstract

string cr:abstract(any node)

Return 'abstract' string if the current node has abstract attribute set to 'true'

Parameters:

  • node - current node: current()

cr:static

string cr:static(any node)

Return 'static' string if the current node's scope set to 'classifier' or marked isStatic.

Parameters:

  • node - current node: current()

cr:classImports

string[] cr:classImports(string sub,  stereotype, root document)

Get a list of 'import' strings listing unique packages of all classes, interfaces, enumerations and data types in the model

Parameters:

  • sub - specific package prefix added to the beginning of model's package name, ex. if the model's package is people, then technology specific packages may be data.people, ejb.people etc.
  • stereotype - select only packages that have given stereotype; if left blank, select all classes; if 'void', select classes with no stereotype
  • document - model xmi document: root(.)

cr:classPackage

string cr:classPackage(string sub, Class node, root document)

Get full package name including model-wide base package and specific subpackage name, ex. if the current class is domain.people.User in the model, model base package is com.mycompany and technology specific subpackage name is ejb, then the full package name is com.mycompany.ejb.domain.people.User. If classes in packages java and javax are modelled explicitely, they are left as they are, no base package or subpackage are added, ex. if you have java::util::Calendar in the model, the resulting package will be java.util

Parameters:

  • sub - specific package prefix added to the beginning of model's package name, ex. if the model's package is people, then technology specific packages may be data.people, ejb.people
  • node - current node: current()
  • document - model xmi document: root(.)

cr:package

string cr:package(Class node)

Get bare package name

Parameters:

  • node - current node: current()

cr:fullClassName

string cr:fullClassName(string sub, Class node, root document)

Get fully qualified name of a class

Parameters:

  • sub - specific package prefix added to the beginning of model's package name, ex. if the model's package is people, then technology specific packages may be data.people, ejb.people
  • node - current node: current()
  • document - model xmi document: root(.)

cr:lowerMulti

string cr:lowerMulti(any node)

Get the lower multiplicity parameter. Return 0 if not specified

Parameters:

  • node - current node: current()

cr:endClass

Class, ownedMember cr:endClass(AssociationEnd node, root document)

Get the class the current end points to

Parameters:

  • node - current node: current()
  • document - model xmi document: root(.)

cr:endClassName

string cr:endClassName(AssociationEnd node, root document)

Get the name of the class the current end points to

Parameters:

  • node - current node: current()
  • document - model xmi document: root(.)

cr:endClassNameFull

string cr:endClassNameFull(AssociationEnd node, root document)

Get the fully qualified name of the $purePackage (default 'data') class the current end points to, including package, ex. if the end points to a class in the model domain.people.User, model base package is com.mycompany, then the result is com.mycompany.data.domain.people.User

Parameters:

  • node - current node: current()
  • document - model xmi document: root(.)

cr:isFirstEnd

string cr:isFirstEnd(AssociationEnd node, root document)

Return 'true' if this assoiciation end is listed first in the pair, 'false' otherwise. Use to track ends in symmetrical assoiciations like many-to-many

Parameters:

  • node - current node: current()
  • document - model xmi document: root(.)

cr:endFieldName

string cr:endFieldName(AssociationEnd node, root document)

Build name of a field representing the current end, ex. if the end name in the model is employee and the class name of the end is User, then the field name is employeeUser. If the end carries no name, the class name is taken to be the field name, ex. if the end points to a class named User, the field name representing the association is user

Parameters:

  • node - current node: current()
  • document - model xmi document: root(.)

cr:dataType

string cr:dataType(Attribute node, root document)

Get the data type name of the current attribute. If a datatype contains package delimeter ::, it is translated into ., ex. if an attribute is of type java::io::File, it becomes java.io.File. Primitives are translated into classes: int (and java::lang::int too) becomes Integer etc. If type modifier like [] is present, it is appended

Parameters:

  • node - current node: current()
  • document - model xmi document: root(.)

cr:initialValue

string cr:initialValue(Attribute node, root document)

Get the initial value of the current attribute

Parameters:

  • node - current node: current()
  • document - model xmi document: root(.)

cr:sourceFileName

 cr:sourceFileName(string sub, string name, string ext, Class node, root document)

Parameters:

  • sub - Specific package prefix added to the beginning of model's package name, ex. if the model's package is people, then technology specific packages may be data.people, ejb.people
  • name - filename
  • ext - file extension such as java or xml
  • node - current node: current()
  • document - model xmi document: root(.)

cr:fileNameJava

string cr:fileNameJava(string sub, string name, Class node, root document)

Build a full java file path given a class in the model, ex. if the current node is class domain.people.User, filename is UserEditBean, model-wide project directory is c:/projects/mycompany, model-wide base package is com.mycompany, sub-package is fe, then the filename is c:/projects/mycompany/gen/com/mycompany/fe/domain/people/UserEditBean.java. Note that class is used only to determine package, the resulting filename is not the class name but passed as a parameter name

Parameters:

  • sub - specific package prefix added to the beginning of model's package name, ex. if the model's package is people, then technology specific packages may be data.people, ejb.people
  • name - filename
  • node - current node: current()
  • document - model xmi document: root(.)

cr:fileNameHbm

string cr:fileNameHbm(string sub, string name, Class node, root document)

Build a full file path for a Hibernate config file given a class in the model, ex. if the current node is class domain.people.User, filename is User, model-wide project directory is c:/projects/mycompany, model-wide base package is com.mycompany, sub-package is data, then the result is c:/projects/mycompany/gen/com/mycompany/data/domain/people/User.hbm.xml. Note that class is used only to determine package, the resulting filename is not the class name but passed as a parameter name

Parameters:

  • sub - specific package prefix added to the beginning of model's package name, ex. if the model's package is people, then technology specific packages may be data.people, ejb.people
  • name - filename
  • node - current node: current()
  • document - model xmi document: root(.)

cr:commonClassFileName

string cr:commonClassFileName(string sub, string name, root document)

Build a full file path given a common (utility) class that is not part of the model, ex. if the class name is Locator, model-wide project directory is c:/projects/mycompany, model-wide base package is com.mycompany, sub-package is ejb, then the filename is c:/projects/mycompany/gen/com/mycompany/ejb/Locator.java

Parameters:

  • sub - specific package prefix added to the beginning of model's package name, ex. if the model's package is people, then technology specific packages may be data.people, ejb.people
  • name - class name
  • document - model xmi document: root(.)

cr:commonClassPackage

string cr:commonClassPackage(string sub, root document)

Build a full package given a common (utility) class that is not part of the model, ex. if the class name is Locator, base package is com.mycompany, sub-package is ejb, then the package is com.mycompany.ejb and the fully qualified name is com.mycompany.ejb.Locator

Parameters:

  • sub - specific package prefix added to the beginning of model's package name, ex. if the model's package is people, then technology specific packages may be data.people, ejb.people
  • document - model xmi document: root(.)

cr:fileNameJsp

string cr:fileNameJsp(string name, Class node, root document)

Build a full jsp file path given namespace in the model, ex. if the current node is class domain.people.User, filename is UserEdit, model-wide project directory is c:/projects/mycompany, model-wide base package is com.mycompany, then the filename is c:/projects/mycompany/htdocs/domain/people/UserEdit.jsp. Note that class is used only to determine package, the resulting filename is not the class name but passed as a parameter name

Parameters:

  • name - filename
  • node - current node: current()
  • document - model xmi document: root(.)

cr:fileNameRootJsp

string cr:fileNameRootJsp(string name, root document)

Build a full file path for a common (root) jsp page, ex. if the name is Login, model-wide project directory is c:/projects/mycompany, then the filename is c:/projects/mycompany/htdocs/Login.jsp

Parameters:

  • name - filename
  • document - model xmi document: root(.)

cr:fileNameConfig

string cr:fileNameConfig(string name, root document)

Build a full path for a config file, ex. if the name is ejb-jar.xml, model-wide project directory is c:/projects/mycompany, then the filename is c:/projects/mycompany/config/ejb-jar.xml

Parameters:

  • name - filename
  • document - model xmi document: root(.)

cr:listLink

string cr:listLink(Class node, root document)

Build a web link to a List jsp page given current node name, ex. if the model name is mycompany (becomes web app name), class name in the model is domain.people.User then the result is '/mycompany/domain/people/UserList.jsp

Parameters:

  • node - current node: current()
  • document - model xmi document: root(.)

cr:modelName

string cr:modelName(root document)

Get name attribute of the model, normalized: spaces, dots and commas are removed

Parameters:

  • document - model xmi document: root(.)

cr:basePackage

string cr:basePackage(root document)

Get base package where all generated packages are placed, ex. if you have a base package named 'com.mycompany' and classes Address, people.User, then resulting classes will be com.mycompany.data.Address, com.mycompany.ejb.Address, com.mycompany.data.people.User. The base package is usually supplied as a parameter $basePackage. If it's empty, the model's name is taken: in the above example if the model name is 'mycompany' then the classes are mycompany.data.Address, mycompany.data.people.User etc. If you`d like the generated files to retain the exact package on the model, set basePackage parameter to 'void'. In this case if your class is people.User in the model, it will be generated as class people.User in gen/people/User.java

Parameters:

  • document - model xmi document: root(.)

cr:projectName

string cr:projectName(root document)

Get project name to be used as web app name for example. Usually project name is supplied as a parameter projectName, if it's empty, the model's name is taken

Parameters:

  • document - model xmi document: root(.)

cr:modelValue

string cr:modelValue(string name, root document)

Get value of a model-wide tagged parameter

Parameters:

  • name - name of the parameter
  • document - model xmi document: root(.)

cr:taggedValue

string cr:taggedValue(string name, any node, root document)

Get value of a given tag

Parameters:

  • name - name of the tag
  • node - current node: current()
  • document - model xmi document: root(.)

cr:upper

string cr:upper(string name)

Make the first character of the string uppercase

Parameters:

  • name - string to convert

cr:lower

string cr:lower(string name)

Make the first character of the string lowercase

Parameters:

  • name - string to convert

cr:inStrings

boolean cr:inStrings(string in, string[] list)

Returns true if a given string exists in a given collection of space delimited strings

Parameters:

  • in - string to compare
  • list - collection of space delimited strings

cr:map

string cr:map(string file, string from)

Translates a string from a named mapping file

Parameters:

  • file - symbolic name of the mappings file, ex. Java mappings are in JavaMappings.xml
  • from - string to convert

cr:allStateMachines

StateMachine[], ownedBehavior[] cr:allStateMachines(root document)

Select all state machines

Parameters:

  • document - model xmi document: root(.)

cr:stateMachines

StateMachine[], ownedBehavior[] cr:stateMachines(Class node)

Select state machines of the given class

Parameters:

  • node - current node: current()

cr:simpleStates

State[], subvertex[] cr:simpleStates(StateMachine node)

Select all simple states for the current state machine

Parameters:

  • node - current node: current()

cr:initialStates

Pseudostate[] cr:initialStates(StateMachine node)

Select all initial states for the current state machine

Parameters:

  • node - current node: current()

cr:finalStates

FinalState[] cr:finalStates(StateMachine node)

Select all final states for the current state machine

Parameters:

  • node - current node: current()

cr:choiceStates

Pseudostate[] cr:choiceStates(StateMachine node)

Select all choice states for the current state machine

Parameters:

  • node - current node: current()

cr:objectFlowStates

ObjectFlowState[] cr:objectFlowStates(StateMachine node)

Select all object flow states for the current state machine

Parameters:

  • node - current node: current()

cr:transitions

Transition[], transition[] cr:transitions(StateMachine node)

Select all transitions for the current state machine

Parameters:

  • node - current node: current()

cr:stateTransitions

Transition[], transition[] cr:stateTransitions(StateMachine node, root document)

Select transitions that originate on simple state

Parameters:

  • node - current node: current()
  • document - model xmi document: root(.)

cr:trigger

CallTrigger, ownedMember cr:trigger(Transition node, root document)

Select a trigger of the current transition

Parameters:

  • node - current node: current()
  • document - model xmi document: root(.)

cr:triggerOperation

Operation, ownedOperation cr:triggerOperation(CallTrigger node, root document)

Select an operation of the current call trigger

Parameters:

  • node - current node: current()
  • document - model xmi document: root(.)

cr:guard

Guard cr:guard(Transition node)

Select a guard of the current transition

Parameters:

  • node - current node: current()

cr:guardBody

string cr:guardBody(Transition node)

Get body of the current transition's guard. Return 'success' if not specified

Parameters:

  • node - current node: current()

cr:effect

CallAction cr:effect(Transition node)

Select an effect of the current transition

Parameters:

  • node - current node: current()

cr:transitionSource

State, Pseudostate, FinalState, subvertex cr:transitionSource(Transition node, root document)

Select source simple, initial or final state of the current transition

Parameters:

  • node - current node: current()
  • document - model xmi document: root(.)

cr:transitionTarget

State, Pseudostate, FinalState, subvertex cr:transitionTarget(Transition node, root document)

Select target simple, initial or final state of the current transition

Parameters:

  • node - current node: current()
  • document - model xmi document: root(.)

cr:isTransitionTargetChoice

boolean cr:isTransitionTargetChoice(Transition node, root document)

Check if the target of the current transition is choice state

Parameters:

  • node - current node: current()
  • document - model xmi document: root(.)

cr:outgoingTransitions

Transition[], transition[] cr:outgoingTransitions(SimpleState, ObjectFlowState, Pseudostate, FinalState node, root document)

Select outgoing transitions of the current state

Parameters:

  • node - current node: current()
  • document - model xmi document: root(.)

cr:incomingTransitions

Transition[], transition[] cr:incomingTransitions(SimpleState, ObjectFlowState, Pseudostate, FinalState node, root document)

Select incoming transitions of the current state

Parameters:

  • node - current node: current()
  • document - model xmi document: root(.)

cr:nextTransitions

Transition[], transition[] cr:nextTransitions(SimpleState, ObjectFlowState, Pseudostate, FinalState node, root document)

Select outgoing transitions of the current transition's target

Parameters:

  • node - current node: current()
  • document - model xmi document: root(.)

cr:stateMachineContext

Class, UseCase, ownedMember cr:stateMachineContext(any node, root document)

Select context class or use case of a state machine

Parameters:

  • node - current node: current()
  • document - model xmi document: root(.)