xsl-list
[Top] [All Lists]

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

2009-05-10 02:16:24
...Changed all xsl:value-of to xsl:sequence (also in the how I call the
function) and also as="element()*" and it WORKS!

Thanks, you have helped me a lot. I had hard times trying to figure out this
myself, do you know any good web page/site with guides on XML and
information alike (I mean st. like this list, mulberrytech.com,
dpawson.co.uk, etc. )?

-----Original Message-----
From: Mukul Gandhi [mailto:gandhi(_dot_)mukul(_at_)gmail(_dot_)com] 
Sent: 10. mája 2009 8:01
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: Re: [xsl] how to "print" xsl:element result from inside a function?

On Sun, May 10, 2009 at 9:04 AM, Mtekel <thx(_at_)trolej(_dot_)sk> wrote:
<xsl:function name="F:TagIT" as="xs:string">
       <xsl:param name="TAG"/>
       <xsl:element name="{$TAG}">MISSING!</xsl:element>
</xsl:function>

<xsl:function name="F:AddMissing" >
       <xsl:param name="List" />
               <xsl:if test="not(empty($List))">
               <xsl:variable name="TAG" select="subsequence($List,1,1)"/>

               <xsl:value-of select="F:TagIT($TAG)"/>

               <xsl:value-of select="F:AddMissing(remove($List,1))"/>
       </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

--~------------------------------------------------------------------
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>
--~--