RE: [xsl] Converting for-each into one string

Subject: RE: [xsl] Converting for-each into one string
From: "Bordeman, Chris" <Chris.Bordeman@xxxxxxxxxxxxxxxxx>
Date: Wed, 20 Aug 2008 20:11:09 -0500
Thanks Wendell, I needed that. <g>

I finally got through my first XSLT, though.  In this case I was trying
to make the thing easy to modify in the future by non-programmers, so I
had to write lots of functions they could utilize.  Funny thing is I've
gotten into a lot of the 2.0 stuff w/o even plunging into templates
much.  In our tiny development department though that makes me the 'XSL
expert' though.  I certainly don't mind, it's a 'cool' skill to have. ;)

-----Original Message-----
From: Wendell Piez [mailto:wapiez@xxxxxxxxxxxxxxxx]
Sent: Wednesday, August 20, 2008 4:42 PM
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Subject: Re: [xsl] Converting for-each into one string

Chris,

At 05:18 PM 8/20/2008, you wrote:
>I want my function to return xs:string, but it uses a for-each and so
>the compiler complains:
>
>"A sequence of more than one item is not allowed as the result of
>function..."
>
>How do I do this?
>
>P.S. Really getting sick of XSL today.

Mm. I think maybe you need to take smaller bites off the apple.

For example, in this case you might have got the function working
without typing the return sequence, and then when it looked good, adding
the type back and debugging.

By writing functions at all, you are pushing the edges where still only
a few people know how to go. The ins and outs of such errors as you are
seeing are likely to be evident to only a select few, not many at all
who aren't on this list.

If that's no comfort, maybe it's a comfort that by reasoning through the
problem and figuring it out for yourself, you are becoming one of those
people. Worse: you are becoming an expert who might actually have a
little sympathy for the struggles of a newbie. A rare bird.

So, congratulations on figuring out how to use that value-of wrapper.
What you did was collapse a sequence of text nodes into a single string
value, which is what you told your function definition you wanted.

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