Subject: Re: [xsl] moving an element and then converting it to an attribute From: Wendell Piez <wapiez@xxxxxxxxxxxxxxxx> Date: Fri, 17 Aug 2012 17:29:55 -0400 |
..//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.
Cheers, Wendell
====================================================================== Wendell Piez mailto:wapiez@xxxxxxxxxxxxxxxx Mulberry Technologies, Inc. http://www.mulberrytech.com 17 West Jefferson Street Direct Phone: 301/315-9635 Suite 207 Phone: 301/315-9631 Rockville, MD 20850 Fax: 301/315-8285 ---------------------------------------------------------------------- Mulberry Technologies: A Consultancy Specializing in SGML and XML ======================================================================
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] moving an element and the, Michael Müller-Hille | Thread | [xsl] Running out of Memory, Terry Badger |
Re: [xsl] moving an element and the, Michael Müller-Hille | Date | Re: [xsl] how to split word into se, Michael Kay |
Month |