[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

RE: xsl2 saxon8B stripping off unwanted separation ch

Subject: RE: xsl2 saxon8B stripping off unwanted separation characters
From: "Michael Kay" <mike@xxxxxxxxxxxx>
Date: Thu, 6 Jul 2006 16:36:07 +0100
stripping off
When you say select="a", do you expect to select a single "a" element, or
multiple elements?

In XSLT 1.0, if there are multiple elements, xsl:value-of will give you the
value of the first.

In XSLT 2.0, if there are multiple elements, xsl:value-of will give you all
of them, with the chosen separator between the values. But if there are
multiple elements, then normalize-space() (or normalize-unicode()) will
fail, because those functions expect to operate on a single string.

If you want to replicate the XSLT 1.0 behaviour, use a[1] to select the
first a element and discard the rest. But then you don't need a separator.

So the question is, what are you trying to achieve?

Michael Kay
http://www.saxonica.com/


> -----Original Message-----
> From: jacques FAUQUEX [mailto:jacques@xxxxxxxxxxxxxxx]
> Sent: 06 July 2006 14:23
> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Subject:  xsl2 saxon8B stripping off unwanted separation
> characters
>
> I have a problem normalizing strings in xslt2 with saxon 8B.
> Here is an example
>
> XML    <a
> href="http://www.ac-versailles.fr/etabliss/michelet-vanves"
> target="_blank"> Lycie
>                Michelet</a>
> XSL
>          <xsl:element name="lycie">
>              <xsl:attribute name="nom">
>                  <xsl:value-of separator=" " select="a"/>
>              </xsl:attribute>
>          </xsl:element>
>          <xsl:value-of select="lycie"/>
>
> RESULT
> 	    <lycie nom=" Lycie&#xA;              Michelet">
>
> ----------------------------------------------------------------------
>
> If a add a normalize-space function within the select,
>
>                 <xsl:value-of separator=" "
> select="normalize-space (a)"/>
>
> XALAN y Saxon 6.5.5 output what I want
>
> 		<lycie nom="Lycie Michelet">
>
> On the contrary, Saxon8B outputs a static error :
>
> 	A sequence of more than one item is not allowed as the
> first argument of normalize-unicode()
> 	URL: http://www.w3.org/TR/xpath20/#ERRXPTY0004
>
> What's happening and how is it posible to normalize strings
> with saxon 8B ?
>
> Thanks
>
> Jacques Fauquex

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.