From: Bordeman, Chris
[mailto:Chris(_dot_)Bordeman(_at_)wolterskluwer(_dot_)com]
Sent: Monday, August 11, 2008 1:10 PM
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: [xsl] node returned from a user function is no longer a node??
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).
I think you need to change:
<xsl:sequence select="addresses/Address[Sequence=1 and IsActive=1]"/>
to
<xsl:sequence select="$addresses/Address[Sequence=1 and IsActive=1]"/>
note the $
Andy.
--~------------------------------------------------------------------
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>
--~--