xsl-list
[Top] [All Lists]

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

2012-08-17 14:11:19
..//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 don’t 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



--~------------------------------------------------------------------
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>
--~--