Re: [xsl] how to "print" xsl:element result from inside a function?

Subject: Re: [xsl] how to "print" xsl:element result from inside a function?
From: Mukul Gandhi <gandhi.mukul@xxxxxxxxx>
Date: Sun, 10 May 2009 11:30:31 +0530
On Sun, May 10, 2009 at 9:04 AM, Mtekel <thx@xxxxxxxxx> wrote:
> <xsl:function name="F:TagIT" as="xs:string">
> B  B  B  B <xsl:param name="TAG"/>
> B  B  B  B <xsl:element name="{$TAG}">MISSING!</xsl:element>
> </xsl:function>
>
> <xsl:function name="F:AddMissing" >
> B  B  B  B <xsl:param name="List" />
> B  B  B  B  B  B  B  B <xsl:if test="not(empty($List))">
> B  B  B  B  B  B  B  B <xsl:variable name="TAG"
select="subsequence($List,1,1)"/>
>
> B  B  B  B  B  B  B  B <xsl:value-of select="F:TagIT($TAG)"/>
>
> B  B  B  B  B  B  B  B <xsl:value-of
select="F:AddMissing(remove($List,1))"/>
> B  B  B  B </xsl:if>
> </xsl:function>
>
> And then later I call the function by:
>
> <xsl:value-of select="F:AddMissing(('Test1','t2','tst3'))"/>
>
> It will print MISSING!MISSING!MISSING! - but without the XML tags generated
> by xsl:element.

xsl:value-of prints the 'text nodes' and not elements as you want.

I think, you must declare the function to return element()* and then
do, xsl:sequence select="" instead of xs:value-of.


--
Regards,
Mukul Gandhi

Current Thread