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

Re: normalize-space and sequence

Subject: Re: normalize-space and sequence
From: "Mathieu Malaterre" <mathieu.malaterre@xxxxxxxxx>
Date: Wed, 26 Sep 2007 22:09:47 +0200
Re:  normalize-space and sequence
Hi David,

On 9/26/07, David Carlisle <davidc@xxxxxxxxx> wrote:
> It's helpful if you post actual code, rather than a description of it,
> as I'm not sure whic case you are in It _sounds_ like you are doing

Sorry. I'll keep that in mind.

> normalize-space(("aaa","bbb","ccc"))
>
> applying the function to a sequence.
> In XPath 2 (native mode) that is an error as normalize-space expects a
> single string
> If you are in backward compatibility mode (ie have version="1.0" in
> scope) then the effect is to discard all but the first item of the
> sequnce and normalize that, so you'd get "aaa".

ok

> the function for converting a sequence to a strng is string-join
>
> string-join(("aaa","bbb","ccc"),"=")
>
> produces the string
>
> "aaa=bbb=ccc"

Hum. I am still not clear why this is called implicitly with {} but I
need to call explicitly string-joing before normalize-space.

> not on input, but on output, you can have templates such as
>
> <xsl:template match="@*">
> <xsl:attribute name="name()" select="normalize-space(.)"/>
> </xsl:template>

I replaced it with:

<xsl:template match="@*">
<xsl:attribute name="{name()}" select="normalize-space(.)"/>
</xsl:template>

See:
http://gdcm.svn.sourceforge.net/viewvc/gdcm/Sandbox/oo2.xsl?r1=1144&r2=1145

> which will make the default templates on attributes and text normalize
> space.

Running the xsl code still leave whitespace at end/beginning of my
output strings:

http://gdcm.svn.sourceforge.net/viewvc/gdcm/trunk/Source/InformationObjectDefinition/ModuleAttributes.xml

Am I missing something ? I'd like to avoid duplicating the string-join
+ normalize-space all over my xsl code.

Thanks a bunch,
-- 
Mathieu

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.