XSLT Reference

http://www.inventic.eu/strings

String functions.

<?xml version="1.0"?>
<xsl:stylesheet version="1.0" xmlns:axstr="http://www.inventic.eu/strings" extension-element-prefixes="... axstr">
  <xsl:value-of select="str:makeLower('XX')"/>
</xsl:stylesheet>
FunctionDescription
makeLower(value)convert string to lower
makeUpper(value)convert string to upper
makeFirstCharUpper(value)convert first char to upper
makeFirstCharLower(value)convert first char to lower
convertCamelCaseToXmlStyle(value,separator='-')convert camel case to xml style
convertXmlStyleToCamelCase(value,firstLower,separator='-')convert xml style to camel case
convertStringStyle(value,style,defaultStyle)convert value based on style. If style is empty, use default style
makeEnglishPlural(value)make plural from singular word (car cars)
makeEnglishSingular(value)make singular from plural word (cars car)
makeEnglishPluralMultiword(value)make plural from singular word (NewCar NewCars)
makeEnglishSingularMultiword(value)make singular from plural word (NewCars NewCar)
replace(str,from,to)replace from in string to to value
endsWith(str,val)test if passed string ends with val
count(str,val)return number of occurances of val in str
substringAfterLast(str,val)returns string after last occurance of val
substringBeforeLast(str,val)returns string before last occurance of val
firstNonEmpty(str1,str2,...)returns first non-empty value
namespaceGetPath(value)get namespace from full path
namespaceGetLocalName(value)get local name from fullpath
namespaceConcatPath(v1,v2)concate two paths as namespace
namespaceRemoveStartingSlash(v1)removes starting \ from namespace`
namespaceSubtractTwoPaths(ns1,ns2,direction)removes ns2 from ns1 from direction("begin" or "end"). \a\b\c - \a\b = \c
namespaceRelativePath(ns1,ns2)returns relative path from ns1 to ns2. In case ns2 is independent NS, returns absolute NS2 path. \a\b, \a\b\c = c

http://www.inventic.eu/system

System functions.

<?xml version="1.0"?>
<xsl:stylesheet version="1.0" xmlns:axsys="http://www.inventic.eu/system" extension-element-prefixes="... axsys">
  <axsys:call-template name="{$param}"/>
</xsl:stylesheet>
ElementDescription
<call-template name="{$param}"/>ability to call template with dynamic param name

http://www.skipper18.com/orm-attributes

Functions for manipulating with ORM Attributes.

<?xml version="1.0"?>
<xsl:stylesheet version="1.0" xlns:ormd="http://www.skipper18.com/orm-attributes" extension-element-prefixes="... ormd">
  ...
</xsl:stylesheet>
FunctionDescription
ConvertAttributesToOrmAttributes(encapsule,mask,xpath)convert attributes to orm attributes
ConvertXpathItemsToOrmAttributes(encapsule,mask,xpath)convert xpath items to orm attribute
CreateOrmAttributesFromValues(encapsule)create orm attributes from passed values
-- value(value,name)-- inner element, attribute by value
-- xpath(select,name)-- inner element, attribute by xpath
CreateAttributeFromOrmAttribute(attribute,orm-attribute)create attribute from orm attribute
ConvertOrmAttributesToAttributes(mask,xpath,class-kind-filter)convert orm attributes to attributes
ConvertOrmAttributesToChildElements(mask,xpath,class-kind-filter,type-kind-filter,last-as-attribute)convert orm attribute to child elements
ExistsOrmAttributeByFullName(full-name)test if exists specified orm attribute

Note: Each function attribute can be passed as xslt param, inner element and in some cases as inner-value.

Note2: class-kind-filter can have values: container,scalar,struct,value (based on orm attribute element class)

Note3: type-kind-filter can have values: container,scalar (based on orm attribute element type)

#this statement
<ormd:ConvertAttributesToOrmAttributes encapsule='true' mask='name()="attr1"'/>

#is equivalent to this one
<ormd:ConvertAttributesToOrmAttributes>
  <ormd:encapsule>true</ormd:encapsule>
  <ormd:mask>name()='attr1'</ormd:mask>
</ormd:ConvertAttributesToOrmAttributes>

http://www.skipper18.com/annotations

Functions for manipulation with annotations.

<?xml version="1.0"?>
<xsl:stylesheet version="1.0" xlns:ann="http://www.skipper18.com/annotations" extension-element-prefixes="... ann">
  ...
</xsl:stylesheet>
FunctionDescription
ConvertAttributesToAnnotationElement(*params)convert attributes to annotation
ConvertXpathToAnnotationElement(*params)convert xpath items to annotation
ConvertElementToAnnotationElement(*params)convert element to annotation element
[encapsule,mask,xpath,name,always-create,element,prefix,remove-prefix,annotation-element,ast-param,divider,encapsuler]\*params
ConvertAnnotationElementToAttribute(attribute,full-name)create attribute from annotation element by name
ConvertAnnotationElementsToAttributes(*params)convert annotation elements to attributes
ConvertAnnotationElementsToChildElements(*params)convert annotation elements to child element
ConvertAnnotationElementsToChildElementsAndAttributes(*params)convert annotation elements to child element and attributes
[mask, child-mask, xpath, full-name, encapsuler, encapsuler-ns,default-value-element,default-value-attribute]\*params (value-elem/value-attr is for default attr/elem for annotation-value)
ExistsAnnotationElementByFullName(full-name, sub-path)test if exists specified annotation (element)
ExistsAnnotationElementByFullNameFce(full-name, sub-path)test if exists specified annotation (function)
GetAnnotationValueAsString(full-name, sub-path)convert annotation element to single text value (sub-path by @name attribute) (element)
GetAnnotationValueAsStringFce(full-name, sub-path)convert annotation element to single text value (sub-path by @name attribute) (function)

Note: Each function attribute can be passed as xslt param, inner element and in some cases as inner-value.

Note: When xpath contains ".", function is evaluate on current element

#this statement
<ann:ConvertAttributesToAnnotationElement encapsule='true' mask='name()="attr1"'/>

#is equivalent to this one
<ann:ConvertAttributesToAnnotationElement>
  <ann:encapsule>true</ann:encapsule>
  <ann:mask>name()='attr1'</ann:mask>
</ann:ConvertAttributesToAnnotationElement>

http://www.skipper18.com/extensions-support

Functions for manipulation with complext extensions.

<?xml version="1.0"?>
<xsl:stylesheet version="1.0" xmlns:skext="http://www.skipper18.com/extensions-support" extension-element-prefixes="... skext">
  ...
</xsl:stylesheet>

common extension + behavior definition:

<skext:ConvertFromOrmAttributesToExtension extension="Gedmo" output="gedmo">
  <behavior name="Sluggable">
    <field name="slug" format="XmlYml" allow-empty="true">
       ...
    </field>
  </behavior>

  <behavior name="...">
		<entity name=""> ...
    <field name=""> ...
    <non-orm-field name=""> ...
    <field-list name="" storage-elements="entities" storage-element="entity" storage-params="auto"> ...
    <association-list name=""> ...
    <non-orm-field-list name=""> ...
  </behavior>
</skext:ConvertFromOrmAttributesToExtension>
Xslt attributesDescription
allow-emptywhether export this annotation if no parameter inside is filled [default false]
formatfor which export format use this export
outputname of output element to convert behavior [default is lowecased extension name]
storage-elementsname of element storing group of items
storage-elementname of element storing single item
storage-paramswhere to get referenced item name [auto,none,entity,field]. None/Entity/Auto+norules = inner element, field=Name attribute
Xslt elementDescription
extensiongroup of extensions in orm-attributes (gedmo, custom-extensions,....)
behaviorsingle behavior in group of extensions (sluggable in gedmo)
entityparameters stored inside entity annotation
fieldparameters stored inside field annotation

parameters of behaviors

<skext:ConvertFromOrmAttributesToExtension extension="Gedmo">
  <behavior name="...">
    <entity name="...">
       <parameter name="repository" alias="RepoAlias" type="string"/>
       <parameter name="callback-test" type="callback-value" from-template="xx" to-template="yy"/>
    </entity>
  </behavior>
</skext:ConvertFromOrmAttributesToExtension>
Xslt elementDescription
parameterstring parameter
aliashow to store this parameter in Orm attributes [default = name ]
typetype of parameter [string,list,csv,elements,callback-value, callback-standalone]
from-templatexslt template name to generate callback value in FROM direction
to-templatexslt template name to generate callback value in TO direction