SPFE Documentation | Collections > SPFE Function Reference > get-subject-type-alias-singular
Function: get-subject-type-alias-singular
get-subject-type-alias-singular(subject-type-id as item()*, config as item()*) as item()*
- Description
-
Gets the singular version of a subject type alias. Subject types are the categories of subjects that a topic set discusses and which form the types of topic index entries and subject affinity markup. For example, the formal subject name for an XSLT function is “spfe-xslt-function”. Because they are XML names, the formal subject type names cannot contain spaces, so they are not suitable for displaying to the reader. If you want to display the name of a subject type publicly, for instance in a list of topics on a subject of a particular type, you will need a human readable name for the subject type: the subject type alias. Subject type aliases are defined in the content set configuration file, in the setting /topic-type/aliases. The topic type alias setting associates a singular and plural topic type alias with a topic type namespace URI:
<spfe xmlns="http://spfeopentoolkit.org/ns/spfe-ot/config" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://spfeopentoolkit.org/ns/spfe-ot/config http://spfeopentoolkit.org/spfe-ot/1.0/schemas/config/spfe-config.xsd"> <content-set> ... <subject-types> <subject-type> <id>config-setting</id> <aliases> <singular>Configuration setting</singular> <plural>Configuration settings</plural> </aliases> </subject-type> </subject-types>
The get-subject-type-alias-singular function looks up the singular version of the subject type alias in the configuration and returns it. To get the plural version of the alias, use the get-subject-type-alias-plural.
- Return value
-
Return type: item()*
The singular version of the subject type alias. An error occurs if a matching subject type alias is not found.
- Source file
-
$SPFEOT_HOME/1.0/scripts/common/utility-functions.xsl
Parameters
- subject-type-id
-
Type: item()*
The id of the subject type. This is the value that is used in defining the type of the entry in the topic type index.
<index> <entry> <type>feature</type> <term>{configuration file}</term> </entry> <entry> <type>config-setting</type> <term>/spfe</term> </entry> </index>
- config
-
Type: item()*
A pointer to the configuration data. In a standard SPFE XSLT script, this is the variable $config.
Definition
<xsl:function name="sf:get-subject-type-alias-singular"> <xsl:param name="subject-type-id"/> <xsl:param name="config"/> <xsl:choose > <xsl:when test="$config/config:content-set/config:subject-types/config:subject-type[config:id=$subject-type-id]/config:aliases/config:singular"> <xsl:value-of select="$config/config:content-set/config:subject-types/config:subject-type[config:id=$subject-type-id]/config:aliases/config:singular"/> </xsl:when> <xsl:otherwise > <xsl:call-template name="sf:error"> <xsl:with-param name="message"> <xsl:text >No singular subject type alias found for subject type </xsl:text> <xsl:value-of select="$subject-type-id"/> <xsl:text >. This setting should be defined in the configuration files at </xsl:text> <xsl:text >/spfe/subject-types/subject-type/aliases/singular.</xsl:text> </xsl:with-param> </xsl:call-template> <xsl:value-of select="$subject-type-id"/> </xsl:otherwise> </xsl:choose> </xsl:function>