The xtpxlib-common component contains the following XSLT modules. The ones used most frequently are general.mod.xsl
and href.mod.xsl
.
Module/Pipeline | Description |
---|---|
compare.mod.xsl | XSL library module with support for comparing XML documents/elements: |
date-time.mod.xsl | XSLT library module containing functions for working with dates and times. |
format-output.mod.xsl | XSLT library with functions for formatting output/strings. |
general.mod.xsl | XSLT library module with general constants and code. |
href.mod.xsl | XSLT library module with functions for the generic handling of href-s (filenames/paths). |
message.mod.xsl | Message related templates. |
mimetypes.mod.xsl | MIME type conversion related functions. |
parameters.mod.xsl | Takes an XML document with parameters and turns this into a parameter map. |
uuid.mod.xsl | UUID related functions. |
compare.mod.xsl
File: xslmod/compare.mod.xsl
XSL library module with support for comparing XML documents/elements:
Prefix | Namespace URI |
---|---|
xtlc | http://www.xtpxlib.nl/ns/common |
Named template | Description |
---|---|
xtlc:compare-documents | Compares two XML documents with each other: |
xtlc:compare-documents as element(xtlc:message)*
Compares two XML documents with each other:
Comments and processing instructions are ignored
Text nodes are normalized before comparison
Empty text nodes (after normalization) are ignored
The comparison stops after the first difference is encountered.
The result is either:
An empty set, when no differences found
One or more xtlc:message
elements, status="error"
when differences were found (you can only get more than one message on attribute differences)
Parameter | Type | Rq? | Default | Description |
---|---|---|---|---|
doc1 | document-node() | yes |
| First document to compare. |
doc2 | document-node() | yes |
| Second document to compare. |
date-time.mod.xsl
File: xslmod/date-time.mod.xsl
XSLT library module containing functions for working with dates and times.
When language based, it only distinguishes between Dutch and non-Dutch (which now means: English).
Prefix | Namespace URI |
---|---|
xtlc | http://www.xtpxlib.nl/ns/common |
Variable | Type | Value | Description |
---|---|---|---|
xtlc:day-names-en | xs:string+ | ('Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saterday', 'Sunday') | Sequence with the names of the days in English |
xtlc:day-names-nl | xs:string+ | ('maandag', 'dinsdag', 'woensdag', 'donderdag', 'vrijdag', 'zaterdag', 'zondag') | Sequence with the names of the days in Dutch |
xtlc:month-names-en | xs:string+ | ('January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December') | Sequence with the names of the months in English |
xtlc:month-names-nl | xs:string+ | ('januari', 'februari', 'maart', 'april', 'mei', 'juni', 'juli', 'augustus', 'september', 'oktober', 'november', 'december') | Sequence with the names of the months in Dutch |
Function | Description |
---|---|
xtlc:day-in-year-number() | Computes the day number in the year: January 1 is 1, December 31 is 365 (or 366 in leap years). |
xtlc:days-in-month() | Computes the number of days in a particular month. If values are out of range it returns 0. |
xtlc:format-date-as-text() | Formats a date as a string with the month name in full. |
xtlc:format-date-as-text-short() | Formats a date as a string with the month name in short. |
xtlc:is-leap-year() | Returns true when a given year is a leap year |
xtlc:month-name() | Returns the name of a month. |
xtlc:month-name-short() | Returns the name of a month in short (abbreviated to 3 characters). |
xtlc:to-date() | Creates a date from its components. |
xtlc:unix-epoch() | Computes the UNIX "epoch" code (number of seconds since 1-1-1970) for a given date/time. |
xtlc:week-number() | Computes the ISO week number for a given date. |
xtlc:weekday-name() | Returns the name of a month. |
xtlc:weekday-number() | The number of the weekday (1=Monday, 7=Sunday). |
xtlc:day-in-year-number() as xs:integer
Computes the day number in the year: January 1 is 1, December 31 is 365 (or 366 in leap years).
Parameter | Type | Description |
---|---|---|
date | xs:date | Date to use. |
xtlc:days-in-month() as xs:integer
Computes the number of days in a particular month. If values are out of range it returns 0.
Parameter | Type | Description |
---|---|---|
month-number | xs:integer | The month to calculate the number of days for. |
year | xs:integer | The year this month is in (important because of leap years). |
xtlc:format-date-as-text() as xs:string
Formats a date as a string with the month name in full.
Parameter | Type | Description |
---|---|---|
date | xs:date | The date to format. |
lang | xs:string | The language for the conversion. |
xtlc:format-date-as-text-short() as xs:string
Formats a date as a string with the month name in short.
Parameter | Type | Description |
---|---|---|
date | xs:date | The date to format. |
lang | xs:string | The language for the conversion. |
xtlc:is-leap-year() as xs:boolean
Returns true when a given year is a leap year
Parameter | Type | Description |
---|---|---|
year | xs:integer | The year to check. |
xtlc:month-name() as xs:string
Returns the name of a month.
Parameter | Type | Description |
---|---|---|
month-number | xs:integer | The month number (1-12). |
lang | xs:string | The language you want the month name in. |
xtlc:month-name-short() as xs:string
Returns the name of a month in short (abbreviated to 3 characters).
Parameter | Type | Description |
---|---|---|
month-number | xs:integer | The month number (1-12). |
lang | xs:string | The language you want the month name in. |
xtlc:to-date() as xs:date
Creates a date from its components.
Parameter | Type | Description |
---|---|---|
day | xs:integer | Day number to use. |
month | xs:integer | Month number to use. |
year | xs:integer | Year to use. |
xtlc:unix-epoch() as xs:decimal
Computes the UNIX "epoch" code (number of seconds since 1-1-1970) for a given date/time.
Parameter | Type | Description |
---|---|---|
datetime | xs:dateTime | The date/time to compute the epoch code for. |
xtlc:week-number() as xs:integer
Computes the ISO week number for a given date.
Parameter | Type | Description |
---|---|---|
date | xs:date | Date to use. |
format-output.mod.xsl
File: xslmod/format-output.mod.xsl
XSLT library with functions for formatting output/strings.
When language based, we only distinguish between Dutch and non-Dutch (usually English).
Prefix | Namespace URI |
---|---|
xtlc | http://www.xtpxlib.nl/ns/common |
Function | Description |
---|---|
xtlc:duration2str() | Turns a day/time duration into a more readable string, e.g. 1d3h40m12s |
xtlc:format-amount() | Formats an amount by adding a € sign and always use double digits. |
xtlc:format-double() | Formats a double as a string with a given amount of digits. |
xtlc:size2str() | Turns an integer (e.g. a file size) into a (rounded) number using a Kb /Mb /Gb suffix. |
xtlc:duration2str() as xs:string
Turns a day/time duration into a more readable string, e.g. 1d3h40m12s
Parameter | Type | Description |
---|---|---|
duration | xs:dayTimeDuration | The duration to convert. |
round-seconds | xs:boolean | Whether the seconds part must be rounded. |
xtlc:format-amount() as xs:string
Formats an amount by adding a € sign and always use double digits.
For the Dutch language, .
and ,
are swapped.
Parameter | Type | Description |
---|---|---|
amount | xs:double | The amount to format. |
lang | xs:string | The language for the conversion. |
xtlc:format-double() as xs:string
Formats a double as a string with a given amount of digits.
For the Dutch language, .
and ,
are swapped.
Parameter | Type | Description |
---|---|---|
dbl | xs:double | Number to convert |
digits | xs:integer | The number of digits to use. When < 0 this is left open. |
lang | xs:string | The language for the conversion. |
general.mod.xsl
File: xslmod/general.mod.xsl
XSLT library module with general constants and code.
Prefix | Namespace URI |
---|---|
xtlc | http://www.xtpxlib.nl/ns/common |
Variable | Type | Value | Description |
---|---|---|---|
xtlc:default-dt-format | xs:string | '[Y]-[M01]-[D01] [H01]:[m01]:[s01]' | Default date/time format string (yyyy-mm-dd … ). |
xtlc:default-dt-format-en | xs:string | '[M01]-[D01]-[Y] [H01]:[m01]:[s01]' | Date/time format string (English: mm-dd-yyyy … ). |
xtlc:default-dt-format-nl | xs:string | '[D01]-[M01]-[Y] [H01]:[m01]:[s01]' | Date/time format string (Dutch: dd-mm-yyyy … ). |
xtlc:internal-error-prompt | xs:string | 'Internal error: ' | Add this in front of any internal error raised. |
xtlc:language-en | xs:string | 'en' | Language code for English |
xtlc:language-nl | xs:string | 'nl' | Language code for Dutch |
xtlc:namespace-xtlc-common | xs:string | namespace-uri-for-prefix('xtlc', doc('')/*) | Namespace used for xtpxlib-common . |
xtlc:status-codes | xs:string+ | ($xtlc:status-info, $xtlc:status-warning, $xtlc:status-error, $xtlc:status-debug) | Sequence with all valid status codes. |
xtlc:status-debug | xs:string | 'debug' | Generic debug status/severity code. |
xtlc:status-error | xs:string | 'error' | Generic error status/severity code. |
xtlc:status-info | xs:string | 'info' | Generic info (a.k.a. OK) status/severity code. |
xtlc:status-warning | xs:string | 'warning' | Generic warning status/severity code. |
Named template | Description |
---|---|
xtlc:raise-error | Stops any processing by raising an error. |
Function | Description |
---|---|
xtlc:att2str() | Turns an attribute into a string representation, suitable for display (e.g. name="value" ). |
xtlc:capitalize() | Capitalizes a string (makes the first character uppercase). |
xtlc:char-repeat() | Returns a string with a single character repeated a given number of times. |
xtlc:count-leading-whitespace() | Counts the number of whitespace characters at the beginning of a string |
xtlc:elm2str() | Turns an element into a descriptive string (the element with all its attributes, excluding schema references). |
xtlc:item2element() | Tries to find the element belonging to a given item. |
xtlc:items2str() | Creates a string from a sequence of items. |
xtlc:prefix-to-length() | Prefixes a string with a given character so it will get at least a given length. |
xtlc:q() | Returns the input string quoted ("$in" ) |
xtlc:str2bln() | Safe conversion of a string into a boolean. |
xtlc:str2id() | Turns a string into a valid identifier, adding a prefix. |
xtlc:str2id() | Turns a string into a valid identifier. |
xtlc:str2int() | Safe conversion of a string to an integer. |
xtlc:str2regexp() | Turns a string into a regular expression that matches the input exactly. Optionally anchors the regular expression so the match will be on this string only (result starts with ^ and ends with $ ). |
xtlc:str2regexp() | Turns a string into a regular expression that matches the input exactly. |
xtlc:str2seq() | Converts a string with a list of words into a sequence of words. |
xtlc:text2lines() | Converts text into separate lines. |
xtlc:raise-error
Stops any processing by raising an error.
Parameter | Type | Rq? | Default | Description |
---|---|---|---|---|
error-name | xs:string | $xtlc:status-error | The (optional) name of the error. Must be an NCName. | |
msg-parts | item()+ | yes |
| Error message to show (in parts, all parts will be concatenated by xtlc:items2str() ). |
xtlc:att2str() as xs:string
Turns an attribute into a string representation, suitable for display (e.g. name="value"
).
Parameter | Type | Description |
---|---|---|
att | attribute()? | Attribute to convert. |
xtlc:capitalize() as xs:string
Capitalizes a string (makes the first character uppercase).
Parameter | Type | Description |
---|---|---|
in | xs:string | The string to work on. |
xtlc:char-repeat() as xs:string
Returns a string with a single character repeated a given number of times.
Parameter | Type | Description |
---|---|---|
char | xs:string | The first character of this string is the character to repeat. If empty, an empty string is returned. |
repeat | xs:integer | The number of repeats. If <= 0 , an empty string is returned. |
xtlc:count-leading-whitespace() as xs:integer
Counts the number of whitespace characters at the beginning of a string
Parameter | Type | Description |
---|---|---|
text | xs:string | Text to work on. |
xtlc:elm2str() as xs:string
Turns an element into a descriptive string (the element with all its attributes, excluding schema references).
Parameter | Type | Description |
---|---|---|
elm | element()? | Element to convert |
xtlc:item2element() as element()?
Tries to find the element belonging to a given item.
When the item is of type xs:string
or xs:anyURI
, it is assumed to be a document reference. The root element of this is returned.
When the item is of type document-node()
, the root element of this document is returned
When the item is of type element()
, this is returned
You can choose whether to produce an error message or ()
when the item cannot be resolved.
Parameter | Type | Description |
---|---|---|
item | item() | The item to work on |
error-on-non-resolve | xs:boolean | Whether to generate an error when $item could not be resolved. Otherwise, the function will return () . |
xtlc:items2str() as xs:string
Creates a string from a sequence of items.
Useful for easy creation of messages consisting of multiple parts and pieces.
Parameter | Type | Description |
---|---|---|
items | item()* | The message parts to combine |
xtlc:prefix-to-length() as xs:string
Prefixes a string with a given character so it will get at least a given length.
Parameter | Type | Description |
---|---|---|
in | xs:string | String to prefix |
prefix-char | xs:string | String to prefix with. Only first character is used. If empty, * is used. |
length | xs:integer | The length to reach. |
xtlc:q() as xs:string
Returns the input string quoted ("$in"
)
Parameter | Type | Description |
---|---|---|
in | xs:string? | String to convert. |
xtlc:str2bln() as xs:boolean
Safe conversion of a string into a boolean.
When $in
is empty or not convertible into a boolean, $default
is returned.
Parameter | Type | Description |
---|---|---|
in | xs:string? | String to convert. |
default | xs:boolean | Default value to return when $in is empty or cannot be converted. |
xtlc:str2id() as xs:string
Turns a string into a valid identifier, adding a prefix.
All characters that are not allowed in an identifier are converted into underscores.
When the result does not start with a letter or underscore, the prefix id-
is added.
Parameter | Type | Description |
---|---|---|
in | xs:string | String to convert. |
prefix | xs:string? | Prefix to apply. |
xtlc:str2id() as xs:string
Turns a string into a valid identifier.
All characters that are not allowed in an identifier are converted into underscores.
When the result does not start with a letter or underscore, the prefix id-
is added.
Parameter | Type | Description |
---|---|---|
in | xs:string | String to convert. |
xtlc:str2int() as xs:integer
Safe conversion of a string to an integer.
When $in
is empty or not convertible to an integer, $default
is returned.
Parameter | Type | Description |
---|---|---|
in | xs:string? | String to convert. |
default | xs:integer | Default value to return when $in is empty or cannot be converted. |
xtlc:str2regexp() as xs:string
Turns a string into a regular expression that matches the input exactly. Optionally anchors the regular expression so the match will be on this string only (result starts with ^
and ends with $
).
Parameter | Type | Description |
---|---|---|
in | xs:string? | String to convert |
anchor | xs:boolean | If true, the resulting string will be anchored (start with ^ and ends with $ ) |
xtlc:str2regexp() as xs:string
Turns a string into a regular expression that matches the input exactly.
Parameter | Type | Description |
---|---|---|
in | xs:string? | String to convert |
xtlc:str2seq() as xs:string*
Converts a string with a list of words into a sequence of words.
Parameter | Type | Description |
---|---|---|
in | xs:string? | String to convert. |
xtlc:text2lines() as xs:string*
Converts text into separate lines.
Uses the LF as separator; CRs are removed.
Parameter | Type | Description |
---|---|---|
text | xs:string? | The text to convert. |
remove-empty-start-end-lines | xs:boolean | When true any empty (containing whitespace only) lines at the beginning and end are removed. |
normalize-indents | xs:boolean | When true the indents of the lines are normalized: the indent of the non-whitespace line with the minimum leading whitespace is removed from all other lines. Lines that contain only whitespace will become zero length. |
href.mod.xsl
File: xslmod/href.mod.xsl
XSLT library module with functions for the generic handling of href-s (filenames/paths).
Prefix | Namespace URI |
---|---|
xtlc | http://www.xtpxlib.nl/ns/common |
Variable | Type | Value | Description |
---|---|---|---|
xtlc:protocol-file | xs:string | 'file' | File protocol specifier. |
Function | Description |
---|---|
xtlc:href-add-encoding() | Percent encodes all "strange" characters (%xx ). Any existing percentage encodings will be kept as is. |
xtlc:href-canonical() | Makes an href canonical (remove any .. and . directory specifiers). |
xtlc:href-concat() | Performs a safe concatenation of href components: |
xtlc:href-decode-uri() | Reverse function of encode-fo-uri(). Translates percent encodings (%xx ) into their actual characters. |
xtlc:href-ext() | Returns the extension part of an href. |
xtlc:href-is-absolute() | Returns true if the href is considered absolute. |
xtlc:href-name() | Returns the (file)name part of an href. |
xtlc:href-name-noext() | Returns the (file)name part of an href without its extension. |
xtlc:href-noext() | Returns the complete href path without its extension. |
xtlc:href-path() | Returns the path part of an href. |
xtlc:href-protocol() | Returns the protocol part of an href (without the :// ). |
xtlc:href-protocol() | Returns the protocol part of an href (without the :// ) or a default value when none present. |
xtlc:href-protocol-add() | Adds a protocol specifier (written without the trailing :// , e.g. http ) to an href. |
xtlc:href-protocol-present() | Returns true when an href has a protocol specifier (e.g. file:// or http:// ). |
xtlc:href-protocol-remove() | Removes the protocol part from an href. |
xtlc:href-relative() | Computes a relative href from one document to another. |
xtlc:href-relative-from-path() | Computes a relative href from a directory path to a document. |
xtlc:href-result-doc() | Transforms an href into something xsl:result-document/@href can use. |
xtlc:href-add-encoding() as xs:string
Percent encodes all "strange" characters (%xx
). Any existing percentage encodings will be kept as is.
Parameter | Type | Description |
---|---|---|
href | xs:string | href to work on. |
xtlc:href-canonical() as xs:string
Makes an href canonical (remove any .. and . directory specifiers).
Examples:
href-canonical('a/b/../c')
==> 'a/c'
Parameter | Type | Description |
---|---|---|
href | xs:string | href to work on. |
xtlc:href-concat() as xs:string
Performs a safe concatenation of href components:
Translates all backslashes into slashes
Makes sure that all components are separated with a single slash
If somewhere in the list is an absolute path, the concatenation stops.
Examples:
xtlc:href-concat(('a', 'b', 'c'))
==> 'a/b/c'
xtlc:href-concat(('a', '/b', 'c'))
==> '/b/c'
Parameter | Type | Description |
---|---|---|
href-path-components | xs:string* | The path components to concatenate into a full href. |
xtlc:href-decode-uri() as xs:string
Reverse function of encode-fo-uri(). Translates percent encodings (%xx
) into their actual characters.
Parameter | Type | Description |
---|---|---|
href | xs:string | href to work on. |
xtlc:href-ext() as xs:string
Returns the extension part of an href.
Examples:
xtlc:href-ext('a/b/c.xml')
==> 'xml'
xtlc:href-ext('a/b/c')
==> ''
Parameter | Type | Description |
---|---|---|
href | xs:string | href to work on. |
xtlc:href-is-absolute() as xs:boolean
Returns true
if the href is considered absolute.
An href is considered absolute when it starts with a /
or \
, contains a protocol specifier (e.g. file://
) or starts with a Windows drive letter (e.g. C:
).
Parameter | Type | Description |
---|---|---|
href | xs:string | href to work on. |
xtlc:href-name() as xs:string
Returns the (file)name part of an href.
Examples:
xtlc:href-name('a/b/c')
==> 'c'
xtlc:href-name('c')
==> 'c'
Parameter | Type | Description |
---|---|---|
href | xs:string | href to work on. |
xtlc:href-name-noext() as xs:string
Returns the (file)name part of an href without its extension.
Examples:
xtlc:href-name-noext('a/b/c.xml')
==> 'c'
xtlc:href-name-noext('a/b/c')
==> 'c'
Parameter | Type | Description |
---|---|---|
href | xs:string | href to work on. |
xtlc:href-noext() as xs:string
Returns the complete href path without its extension.
Examples:
xtlc:href-noext('a/b/c.xml')
==> 'a/b/c'
xtlc:href-noext('a/b/c')
==> 'a/b/c'
Parameter | Type | Description |
---|---|---|
href | xs:string | href to work on. |
xtlc:href-path() as xs:string
Returns the path part of an href.
Examples:
xtlc:href-path('a/b/c')
==> 'a/b'
xtlc:href-path('c')
==> ''
Parameter | Type | Description |
---|---|---|
href | xs:string | href to work on. |
xtlc:href-protocol() as xs:string
Returns the protocol part of an href (without the ://
).
Examples:
xtlc:href-protocol('http://…')
==> 'http'
Parameter | Type | Description |
---|---|---|
href | xs:string | href to work on. |
xtlc:href-protocol() as xs:string
Returns the protocol part of an href (without the ://
) or a default value when none present.
Examples:
xtlc:href-protocol('http://…', 'file')
==> 'http'
xtlc:href-protocol('/a/b/c', 'file')
==> 'file'
Parameter | Type | Description |
---|---|---|
href | xs:string | href to work on. |
default-protocol | xs:string | Default protocol to return when $ref contains none. |
xtlc:href-protocol-add() as xs:string
Adds a protocol specifier (written without the trailing ://
, e.g. http
) to an href.
Parameter | Type | Description |
---|---|---|
href | xs:string | href to work on. |
protocol | xs:string | The protocol to add, without a leading :// part (e.g. just file or http ). |
force | xs:boolean | When true an existing protocol is removed first. When false , a reference with an existing protocol is left unchanged. |
xtlc:href-protocol-present() as xs:boolean
Returns true when an href has a protocol specifier (e.g. file://
or http://
).
Parameter | Type | Description |
---|---|---|
href | xs:string | href to work on. |
xtlc:href-protocol-remove() as xs:string
Removes the protocol part from an href.
Examples:
xtlc:protocol-remove('file:///a/b/c')
==> '/a/b/c'
Weird exceptions:
xtlc:protocol-remove('file:/a/b/c')
==> '/a/b/c'
xtlc:protocol-remove('file:/C:/a/b/c')
==> 'C:/a/b/c'
Parameter | Type | Description |
---|---|---|
href | xs:string | href to work on. |
xtlc:href-relative() as xs:string
Computes a relative href from one document to another.
Examples:
href-relative('a/b/c/from.xml', 'a/b/to.xml')
==> '../to.xml'
href-relative('a/b/c/from.xml', 'a/b/d/to.xml')
==> '../d/to.xml'
Parameter | Type | Description |
---|---|---|
from-href | xs:string | href (of a document) of the starting point. |
to-href | xs:string | href (of a document) of the target. |
xtlc:href-relative-from-path() as xs:string
Computes a relative href from a directory path to a document.
Examples:
href-relative-from-path('a/b/c', 'a/b/to.xml')
==> '../to.xml'
href-relative-from-path('a/b/c', 'a/b/d/to.xml')
==> '../d/to.xml'
Parameter | Type | Description |
---|---|---|
from-href-path | xs:string | href (of a directory) of the starting point. |
to-href | xs:string | href (of a document) of the target. |
xtlc:href-result-doc() as xs:string
Transforms an href into something xsl:result-document/@href
can use.
xsl:result-document/@href
needs a file://
in front and has some strict rules about the formatting. The input to this function must be an absolute href!
Parameter | Type | Description |
---|---|---|
href | xs:string | href to work on. Must be absolute! |
message.mod.xsl
File: xslmod/message.mod.xsl
Message related templates.
A message is a standardized piece of XML used for inserting (error, debug, etc.) messages into XML documents.
Prefix | Namespace URI |
---|---|
xtlc | http://www.xtpxlib.nl/ns/common |
Named template | Description |
---|---|
xtlc:msg-create | Generates a standard xtlc:message element. |
xtlc:msg-create as element(xtlc:message)
Generates a standard xtlc:message
element.
Parameter | Type | Rq? | Default | Description |
---|---|---|---|---|
extra-attributes | attribute()* | () | Any extra attributes to add to the message. | |
extra-contents | element()* | () | Any extra elements to add to the message. | |
msg-parts | item()+ | yes |
| Message to show (parts will be concatenated by xtlc:items2str() ). |
status | xs:string | yes |
| The status of the message. Must be one of the $xtlc:status-* constants as defined in general.mod.xsl. |
mimetypes.mod.xsl
File: xslmod/mimetypes.mod.xsl
MIME type conversion related functions.
These conversions work with an external MIME type/extension table.
Prefix | Namespace URI |
---|---|
xtlc | http://www.xtpxlib.nl/ns/common |
Function | Description |
---|---|
xtlc:ext2mimetype() | Turns an href extension (e.g. xml') into the correct MIME type ('text/xml' ). |
xtlc:mimetype2ext() | Turns a MIME type (e.g. 'text/xml' ) into a corresponding href extension ('xml' ). |
parameters.mod.xsl
File: xslmod/parameters.mod.xsl
Takes an XML document with parameters and turns this into a parameter map.
More information here.
Prefix | Namespace URI |
---|---|
xtlc | http://www.xtpxlib.nl/ns/common |
Variable | Type | Value | Description |
---|---|---|---|
xtlc:parameter-group-separator | xs:string | '.' | When a <group> element is encountered, this character is used as a separator after the group's name. |
xtlc:parameter-main-trigger-character | xs:string | '$' | Use this variable for a quick check on whether something might contain a parameter: contains(..., $xtlc:parameter-main-trigger-character) |
Function | Description |
---|---|
xtlc:expand-text-against-parameters() | Expands parameter references in $text (either {$...} or ${...} ) against the parameters in $parameter-map . If a parameter has multiple values, only the first one is used. |
xtlc:parameters-get() | Tries to locate a <parameters> element (in any namespace) underneath $root-item and processes the child <parameter> and <group> elements in here into a parameter map. |
xtlc:expand-text-against-parameters() as xs:string
Expands parameter references in $text
(either {$...}
or ${...}
) against the parameters in $parameter-map
. If a parameter has multiple values, only the first one is used.
Parameter | Type | Description |
---|---|---|
text | xs:string | Text to expand. |
parameter-map | map(xs:string, xs:string*) | Map with parameter values. |
xtlc:parameters-get() as map(xs:string, xs:string*)
Tries to locate a <parameters>
element (in any namespace) underneath $root-item
and processes the child <parameter>
and <group>
elements in here into a parameter map.
The <value>
elements are filtered according to the entries in $filters
.
Parameter references in values (either {$...}
or ${...}
). are expanded. If a parameter has multiple values, only the first one is used.
Parameter | Type | Description |
---|---|---|
root-item | item() | Root item under which the first <parameters> element is processed. Can be an href, a document node or an element. See xtlc:item2element() on how this is processed. |
filters | map(xs:string, xs:string*)? | Any filters for the parameter's <value> elements. |
uuid.mod.xsl
File: xslmod/uuid.mod.xsl
UUID related functions.
Works only in Saxon PE or EE (not in the free HE), because we are calling an underlying Java function.
Prefix | Namespace URI |
---|---|
xtlc | http://www.xtpxlib.nl/ns/common |
Function | Description |
---|---|
xtlc:get-uuid() | Returns a random unique UUID (by calling an underlying Java function) |
xtlc:is-real-uuid() | Checks whether a string contains a "real" UUID (conforms to the UUID formatting rules). |