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

Re: node returned from a user function is no longer a

Subject: Re: node returned from a user function is no longer a node??
From: "Dimitre Novatchev" <dnovatchev@xxxxxxxxx>
Date: Mon, 11 Aug 2008 11:00:32 -0700
Re:  node returned from a user function is no longer a
> So it seems that it's being converted to a string for some reason, so I
> try to set the function's return type to as="node()" or as="element()"
> (don't know the difference) but now the compiler seems to require an
> object to always be returned, a case which I don't know how to handle
> (returning () causes compiler complaint too).

Probably what you want is:

  element()?

which means that the return type is a sequence of  0 or 1 elements.


-- 
Cheers,
Dimitre Novatchev
---------------------------------------
Truly great madness cannot be achieved without significant intelligence.
---------------------------------------
To invent, you need a good imagination and a pile of junk
-------------------------------------
Never fight an inanimate object
-------------------------------------
You've achieved success in your field when you don't know whether what
you're doing is work or play



On Mon, Aug 11, 2008 at 10:09 AM, Bordeman, Chris
<Chris.Bordeman@xxxxxxxxxxxxxxxxx> wrote:
> Consider this variable and the function it calls:
>
> <variable name="buyerfirstaddressnode"
> select="fn:getfirstactiveaddressnode(buyer/Addresses)"/>
>
> <xsl:function name="fn:getfirstactiveaddressnode">
>  <xsl:param name="addresses"/>
>  <xsl:if test="$addresses">
>    <xsl:sequence select="addresses/Address[Sequence=1 and
> IsActive=1]"/>
>  </xsl:if>
> </xsl:function>
>
> Now, if I access $buyerfirstaddressnode/StreetName for instance, or any
> other member, I get an EMPTY STRING.  However, if I simply output the
> $buyerfirstaddressnode variable, I get a string that LOOKS like it
> contains the address data I want.
>
> So it seems that it's being converted to a string for some reason, so I
> try to set the function's return type to as="node()" or as="element()"
> (don't know the difference) but now the compiler seems to require an
> object to always be returned, a case which I don't know how to handle
> (returning () causes compiler complaint too).
>
> Help please?
>
> Chris

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.