Extension **org.gramar.base** contains the core set of Gramar tags and functions === Usage and Configuration === Place a **** element within the **** element in the **gramar.config** file in the root of your gramar: === Tags === The **org.gramar.base** extension provides the following production markup tags * [[org.gramar.base:addElement|addElement]] - adds a new child node with a given name to a given node in the model. * [[<c:addTextElement select="" name="">|Extension-org.gramar.base-Tag-addTextElement]] - adds a new child text node with a given name to a given node in the model. * [[<c:choose select="">|Extension-org.gramar.base-Tag-choose]] - provides case-style conditional logic. The choose tag will have nested some number of when tags and possibly an otherwise tag. The first when tag to test true will be resolved to become the processing result of the entire choose tag. If no when tag tests true and an otherwise tag is present, the otherwise tag is resolved to produce the result of the entire choose tag. * [[<c:copyFile target="" source="" replace="">|Extension-org.gramar.base-Tag-copyFile]] - copies a binary file from within the gramar to the output file store.. * [[<c:dump select="">|Extension-org.gramar.base-Tag-dump]] - Writes a string representation of the specified node and its children. * [[<c:file path="" template="" replace="">|Extension-org.gramar.base-Tag-file]] - copies a binary file from within the gramar to the output file store. * [[<c:folder path="">|Extension-org.gramar.base-Tag-folder]] - creates a new folder with the given name if that folder does not already exist. * [[<c:flow>|Extension-org.gramar.base-Tag-flow]] - Allows for the text flow of the tag's content across several lines of output where each line must have a constant prefix, such as with a Javadoc comment. * [[<c:flowContent width="">|Extension-org.gramar.base-Tag-flowContent]] - scopes the actual content to be flowed. The width attribute specifies the maximum length of each line of flowed text. The template content before the flowContent tag but after the containing flow tag is the prefix to be prepended to each flowed line of text. * [[<c:formatNow pattern="">|Extension-org.gramar.base-Tag-formatNow]] - writes the current time using the format specified. * [[<c:get select="">|Extension-org.gramar.base-Tag-get]] - Resolves to the string representation of the value of an XPath expression * [[<c:if test="" var="">|Extension-org.gramar.base-Tag-if]] - Evaluates an XPath expression and processes the tag content if the value is true. * [[<c:include template="" restore="">|Extension-org.gramar.base-Tag-include]] - Processes another template in the gramar in-line as resolves to the text content produced by that template. * [[<c:initialCode>|Extension-org.gramar.base-Tag-initialCode]] - Scopes a region of template processing that might be modified by the user after generation and should therefore be kept (not overwritten on subsequent gramar invocations). * [[<c:iterate select="" var="" delimeter="">|Extension-org.gramar.base-Tag-iterate]] - Iterates over a collection of nodes. * [[<c:loadContent var="">|Extension-org.gramar.base-Tag-loadContent]] - parses the content of the tag into a secondary DOM. * [[<c:milliseconds>|Extension-org.gramar.base-Tag-milliseconds]] - resolves to the current epoch time in milliseconds. * [[<c:otherwise>|Extension-org.gramar.base-Tag-otherwise]] - provides a "last-resort" case for a containing choose tag. If no when tags in that choose tag test true, the contents of the otherwise tag become the processing result of the choose tag. * [[<c:project name="">|Extension-org.gramar.base-Tag-project]] - creates a new project with the given name if that project does not already exist. * [[<c:RemoveElemet select="">|Extension-org.gramar.base-Tag-RemoveElemet]] - adds a node from the model. * [[<c:set select="" name="">|Extension-org.gramar.base-Tag-set]] - Sets the value of an attribute on a given node to the resolved content of the tag. * [[<c:setVariable select="" var="">|Extension-org.gramar.base-Tag-setVariable]] - Sets a context variable to the resolved value of an XPath expression. * [[<c:stringTokens string="" var="" delimeter="" delimetedBy="" reverse="">|Extension-org.gramar.base-Tag-stringTokens]] - Parses a string into tokens and iterates over the tokens. * [[<c:userRegion>|Extension-org.gramar.base-Tag-userRegion]] - scopes a region of template processing that might be modified by the user after generation and should therefore be kept (not overwritten on subsequent gramar invocations). * [[<c:when test="">|Extension-org.gramar.base-Tag-when]] - acts as a single case clause for a containing choose tag. Within a choose tag's scope, the first when tag to test true will become the processing result of the entire choose tag. === XPath functions === The **org.gramar.base** extension provides the following custom Path functions * [[org.gramar.base:camelCase|camelCase]] - returns a single-token string from the given text where whitespace has been removed and the first character of each token has been upper-cased * [[c:cardinality(expression, cards)|Extension-org.gramar.base-Function-cardinality]] - returns a boolean value depending on whether the cardinality of the collection of nodes is present in the cards string * [[c:className(fqn)|Extension-org.gramar.base-Function-className]] - returns the class name from a given fully-qualified Java class name * [[c:isVariableDefined(varname)|Extension-org.gramar.base-Function-isVariableDefined]] - returns whether the specified variable has an associated value in the Gramar context * [[c:lowercaseFirst(term)|Extension-org.gramar.base-Function-lowercaseFirst]] - returns the given string value with the first character appropriately lower-cased * [[c:lower-case(term)|Extension-org.gramar.base-Function-lower-case]] - returns the given string value with every character appropriately lower-cased * [[c:packageName(fqn)|Extension-org.gramar.base-Function-packageName]] - returns the package name from a given fully-qualified Java class name * [[c:singleToken(term)|Extension-org.gramar.base-Function-singleToken]] - returns a single-token string from the given text where whitespace has been removed and the first character of each token, except the first, has been uppercased * [[c:sort(collection, key, options)|Extension-org.gramar.base-Function-sort]] - sorts and returns the given collection using the key XPath expression to calculate a sort key for each node in the collection. * [[c:unique(collection, key)|Extension-org.gramar.base-Function-unique]] - filters and returns the given collection using the key XPath expression to calculate a key for each node in the collection. * [[c:uppercaseFirst(term)|Extension-org.gramar.base-Function-uppercaseFirst]] - returns the given string value with the first character appropriately upper-cased * [[c:upper-case(term)|Extension-org.gramar.base-Function-upper-case]] - returns the given string value with every character appropriately upper-cased Return to [[org.gramar.base|Extension-org.gramar.base]]