Re: [xsl] moving an element and then converting it to an attribute

Subject: Re: [xsl] moving an element and then converting it to an attribute
From: Michael Müller-Hillebrand <mmh@xxxxxxxxx>
Date: Fri, 17 Aug 2012 21:11:03 +0200
> ..//image-size[1]
>
> expands to
>
> parent::node()/descendant-or-self::node()/child::image-size[position() = 1]

which might result in a sequence of more than one element.

> But it might be good to learn
>
> normalize-space(../descendant::image-size[1])
>
> in case you're ever running under XSLT 2.0 ...
>
> ... at least as long as you agree that a little paranoia never hurt ...

Wendell,

I dont see this as paranoia, because such stuff happens! Do you agree that
another option to force the resulting sequence to have only one element would
be

normalize-space((..//image-size)[1])

But I agree that the use of descendant:: is much clearer, especially to people
who (have to) read this bit of code later.

- Michael

--
DOCUFY GmbH
Michael M|ller-Hillebrand | Senior Consultant
www.docufy.de

Current Thread