xsl-list
[Top] [All Lists]

RE: [xsl] normalize-space and sequence

2007-09-25 16:27:01
  I am having a very simple issue here. I'd like to be able to apply
normalize-space() even if I am dealing with a sequence of 
string. If I do call normalize-space, the transformation 
implicitly convert my sequence of string into string (saxon 8.9).

If the stylesheet specifies version="1.0", then normalize-space() will
process the first string in the sequence and ignore the others. If it
specifies version="2.0", then you will get a type error.

  What's is this function that convert sequence of strings 
into string ?

You can apply normalize-space to every string in a sequence (returning a
sequence of normalized strings) in the usual way: for $i in $seq return
normalize-space($i). If you want to combine a sequence of strings into a
single string, use string-join().

  As a side note, there is no way to globally say 'all my xml 
attribute/elements should have normalize space'.

Yes there is: you can declare their types in a schema to derive from
xs:token, and use schema-aware XSLT processing.

Michael Kay
http://www.saxonica.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>
--~--