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

Re: Re: Can not convert #STRING to a NodeList! Error..

Subject: Re: Re: Can not convert #STRING to a NodeList! Error..
From: "arun prasath" <arunwaits@xxxxxxxxxxx>
Date: Sun, 09 Nov 2003 21:35:39 +0530
xsl param nodelist

Thanks Dimitre,
On seeing the process of execution,(in xmlspy), from Default Template, control comes to my third template. I also think the same that default template is not passing anyparameters to my third template.. I am giving my code: minimal possible one.
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" >
<xsl:key name="label" match="labels/label" use="@name"/>
<!-- parameter to get the current user's language-->
<xsl:param name="language" select="'en'"/>
<xsl:template match="/"> (first)
<xsl:choose>
<xsl:when test="$language='en'">
<xsl:call-template name="main">
<xsl:with-param name="labelsfile" select="document('English.xml')"/>
</xsl:call-template>
</xsl:when>
<xsl:when test="$language='fr'">
<xsl:call-template name="main">
<xsl:with-param name="labelsfile" select="document('French.xml')"/>
</xsl:call-template>
</xsl:when>
</xsl:choose>
</xsl:template>
<xsl:template name="main">(second)
<xsl:param name="labelsfile"/>
<xsl:for-each select="$labelsfile">
<!-- works fine -->
<xsl:value-of select="key('label','ecollab.purchaseorder')"/>
</xsl:for-each>
<xsl:apply-templates>
<xsl:with-param name="labelsfile" select="$labelsfile"/>
</xsl:apply-templates>
</xsl:template>
<xsl:template match="HEADER">(third)
<xsl:param name="labelsfile"/>
<xsl:for-each select="$labelsfile">
<!-- Doesnt works -->
<xsl:value-of select="key('label','ecollab.businessfollowedby')" />
</xsl:for-each>
</xsl:template>
<xsl:stylesheet>


sample XML
------------------
<PUR-ORD>
<DOCTYPE-ID>PO</DOCTYPE-ID>
<CONTACT>610223</CONTACT>
<!-- value of above nodes are printed by default template -->
<PO>
<HEADER>header information</HEADER>


	</PO>
</PUR-ORD>

What should I do to solve this problem.
thanks in advance
regards
s.arun prasath

From: "Dimitre Novatchev" <dnovatchev@xxxxxxxxx>
Reply-To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Subject:  Re: Re: Can not convert #STRING to a NodeList! Error..
Date: Sun, 9 Nov 2003 16:43:19 +0100

It seems to me that your description matches completely the guess I made in
my previous message.

If you do value your time it would be best to publish a complete (but the
minimal possible) example, including the xslt code, the source xml document
and where you think the problem happens.

From what you have written:

> 3. From this template, I am again calling child templates using
> <xsl:apply-templates>
> <xsl:with-param name="labelsfile" select="$labelsfile"/>
> </xsl:apply-templates>
> 4. Next Default template prints the node values for some of the xml
> tags.
> 5. Next when a template node is matched (third),the third template is
> being executed, I have declared the param tag
> <xsl:param name="labelsfile"/>
>
> Problem comes only here.. here, the variable "labelsfile" is shown as a
> String rather than a Nodelist. and its value is blank.
> and when the tag <xsl:for-each select="$labelsfile"> is being executed, it
> shows error.


it seems that the "third template" is instantiated from a "default"
template. If this is so, the default template does not use an
"xsl:with-param" when it issues "xsl:apply-templates". If this is so, no
value for any parameter is passed to the "third template" and the xsl:param
named labelsfile does not get any value -- this causes the error message.


===== Cheers,

Dimitre Novatchev.
http://fxsl.sourceforge.net/ -- the home of FXSL




XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list



_________________________________________________________________
Access Hotmail from your mobile now. http://server1.msn.co.in/sp03/mobilesms/ Click here.



XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list



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.