<xsl:variable name="html-output-name"
select="(if(@index and @index eq 'true')
then concat($default-name, '.html')
else (),
@html-output-name,
@output-name,
$default-html)[1]" />
I see what the 'if' is doing, but I'm not sure how to make sense of the rest of the items in the command, and then the [1] at the end. Does this add up to 'the first non-empty item in the list?"
The idiom
(A, B, C)[1]
in XPath 2.0 is often used to mean "if A exists, then A; otherwise if B exists, then B; otherwise if C exists then C; otherwise nothing." Which I guess matches your paraphrase "the first non-empty item in the list". Technically it builds a sequence containing all the items selected by A, then all the items selected by B, then all the items selected by C, and then it selects the first item in the list. But because of lazy evaluation and pipelining, it's unlikely it will actually build the whole list.From http://www.w3.org/TR/xpath20/#construct_seq
Partial BNF:
[2] Expr ::=
ExprSingle
(","
ExprSingle
)*
And from http://www.w3.org/TR/xpath20/#id-filter-expr
Question:
Answer: Not quite. This selects the first item in the list. There are no empty item, but empty sequence. And because there aren't nested sequence (formaly tuples), they are just concatenated as a flat sequence.