Thank you very much sir. I am still learning XSLT 2.0 and this gives me
a chance to examine the enhancements to the expression syntax.
Michael Kay wrote:
If the select expression in xsl:value-of is returning a sequence of strings,
and you want the strings joined together without a separator, you can
specify separator="" on the xsl:value-of instruction (the default value is
separator=" ", a single space).
However, If you want to return a string from the function, rather than a
text node, I would suggest using xsl:sequence rather than xsl:value-of. You
will then need to use string-join() to merge the strings in the sequence.
To show you an alternative coding style, I would be inclined to write this
function as:
<xsl:function name="local:logicalName" as="xs:string">
<xsl:param name="name" as="xs:string"/>
<xsl:variable name="words" as="element()*"
select="$locals/lookup/words/word"/>
<xsl:variable name="mapped-words" as="xs:string*" select="
for $substring in tokenize($name, '_') return
if ($words[(_at_)physical=$substring])
then if ($words[(_at_)physical=$substring and @logical eq '*'])
then $substring
else $words[(_at_)physical=$substring]/@logical
else if ($words[(_at_)shortPhysical=$substring])
then if ($words[(_at_)shortPhysical=$substring and @logical='*'])
then $substring
else $words[(_at_)shortPhysical=$substring]/@logical
else concat(substring(., 1, 1), lower-case(substring(., 2)))
"/>
<xsl:sequence select="string-join($mapped-words, '')"/>
</xsl:function>
Not tested!
I'll do that part.
Barry