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

RE: XPATH: Can not convert #STRING to a NodeList!

Subject: RE: XPATH: Can not convert #STRING to a NodeList!
From: "Palaniappan, Krishnasamy" <PalaniK@xxxxxxxxxxx>
Date: Fri, 22 Dec 2000 10:09:47 -0500
cannot convert string to nodelist
Thanks, Jeni! However, still having some problems.
When i replaced:
    <xsl:value-of select="$b_level_total"/>
by:
  <xsl:value-of select="*[local-name() = $b_level_total]" />
- it resulted in the statement returning (or assigning) nothing. 

When i changed that to:
  <xsl:value-of select="*[local-name($b_level_total)]" /> - Statement 3
- something weird happened. 
	<BREAK2>
  	 <VAR1> value1 </VAR2>
       <B2TOTAL>
	   <VAR2> value2 </VAR2>
	 </B2TOTAL>
	</BREAK2>

If i called the template from:
	<xsl:for-each select="BREAK2">
		<xsl:call-template name="..">
		 <xsl:with-param select="B2TOTAL"/>
		</xsl:call-template>
	</xsl:for-each>
then, Statement 3 (see above) displays "value1" (which is the value of B2TOTAL's sibling VAR1).

Do you see what is going on here?!
Please let me know if I am missing something or doing something wrong.

Thanks,
Krish
p.s.: I have subscribed to the digest.

-----Original Message-----
From: Jeni Tennison [mailto:mail@xxxxxxxxxxxxxxxx]
Sent: Friday, December 22, 2000 5:24 AM
To: Palaniappan, Krishnasamy
Cc: 'xslt'
Subject: Re:  XPATH: Can not convert #STRING to a NodeList!


Krish,

> I call this template using:
>         <xsl:call-template name="values_SUST">
>                       <xsl:with-param name="b_level_total" select="'B4TOTAL'"/>
>                        <xsl:with-param name="category" select="'TDES'"/>
>                        <xsl:with-param name="bcolor" select="'black'"/> 
>             </xsl:call-template>
>
> what I desire is:
> The template values_SUST needs to be called with 3 string arguments
> ("B4TOTAL","TDES","black"). While "black" should become the color in
> the template, B4TOTAL and TDES are actually nodes. Can I not do
> this?

In answer to your subject's question: you cannot convert strings to
node lists unless you use an extension function like saxon:evaluate.
However, you can select elements that have the same name as the
string.  For example:

  <xsl:value-of select="*[local-name() = $b_level_total]" />

One problem that you might be experiencing is that you seem to be
testing whether the value of $category is equal to the *value* of TDES,
SUB-TOTAL and TOTAL elements, whereas I think you want to test whether
it's equal to the strings 'TDES', 'SUB-TOTAL' or 'TOTAL', i.e.:

     <xsl:choose>
      <xsl:when test="$category='TDES'">
       <xsl:value-of select="TDES"/>
      </xsl:when>
      <xsl:when test="$category='SUB-TOTAL'">
       SUB-TOTAL
      </xsl:when>
      <xsl:when test="$category='TOTAL'">
       TOTAL
      </xsl:when>
     </xsl:choose>

Also, where you're inserting the colour that you're passing as a
parameter, remember that you need to use attribute value templates to
put the value of the parameter into the value of the attribute, i.e.:
     
    <fo:block font-size="6pt" color="{$bcolor}" text-align="center">
     <xsl:value-of select="*[local-name() = $b_level_total]/CNT"/>
    </fo:block>

I hope that helps,

Jeni

---
Jeni Tennison
http://www.jenitennison.com/


 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.