xsl-list
[Top] [All Lists]

Re: [xsl] [Summary] 4 equivalent XPath expressions for concatenating three arguments

2012-12-19 15:53:22
and also since XPath 2.0

string-join(('section', ': ', 1), '')

Xmlizer

2012/11/10 Adam Retter <adam(_dot_)retter(_at_)googlemail(_dot_)com>:
Actually there are more than this, as in XPath 3.0, you can use "||"
as a shortcut for concat, e.g.:

'section' || ':' || 1

On 10 November 2012 12:07, Costello, Roger L. <costello(_at_)mitre(_dot_)org> 
wrote:
Hi Folks,

Here are 4 equivalent XPath expressions for concatenating 'Section' and ': ' 
and 1 to produce 'Section: 1'. The latter 3 use XPath 3.0 capabilities, 
particularly partial function application and specifying the arity of the 
concat function.

-----------
XPath #1
-----------
concat('Section', ': ', 1)

-----------
XPath #2
-----------
let $concat3 := concat#3                (: Specify the arity of the concat 
function :)
return $concat3('Section', ': ', 1)

-----------
XPath #3
-----------
let $concat3 := concat(?,?,?)           (: Partial function application :)
return $concat3('Section', ': ', 1)

-----------
XPath #4
-----------
let $concat3 := concat#3('Section', ?, ?)
return $concat3(': ', 1)

/Roger

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: 
<mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--




--
Adam Retter

skype: adam.retter
tweet: adamretter
http://www.adamretter.org.uk

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: 
<mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--


--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--

<Prev in Thread] Current Thread [Next in Thread>
  • Re: [xsl] [Summary] 4 equivalent XPath expressions for concatenating three arguments, Xmlizer <=