BTW I know about the typo in the parameter name and how it's used in the
function.
-----Original Message-----
From: Bordeman, Chris
[mailto:Chris(_dot_)Bordeman(_at_)wolterskluwer(_dot_)com]
Subject: [xsl] Function to accept node and name of subnode in parameter
string
Hi all. I need to create a 2.0 function that will accept an element()?
and a xs:string. The string will contain the name of a subnode of the
first parameter.
The function will do something like this:
<!-- Given any node and the name of a subnode, returns
the nonempty subnode's value or N/A --> <xsl:function
name="fn:ValueOrNA" as="xs:string">
<xsl:param name="node" as="element()?"/>
<xsl:param name="childelementname" as="xs:string"/>
<xsl:choose>
<xsl:when test="$node and $node/$childname != ''">
<xsl:value-of select="$node/$childname"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="'N/A'"/>
</xsl:otherwise>
</xsl:choose>
</xsl:function>
But it always seems to return just the second string I pass in, not the
value of the subnode.
What's the right way to do this?
Thanks.
--~------------------------------------------------------------------
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>
--~--
--~------------------------------------------------------------------
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>
--~--