Subject: RE: [xsl] XPATH: Can not convert #STRING to a NodeList! From: "Palaniappan, Krishnasamy" <PalaniK@xxxxxxxxxxx> Date: Fri, 22 Dec 2000 10:09:47 -0500 |
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: [xsl] 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 |
---|
|
<- Previous | Index | Next -> |
---|---|---|
RE: [xsl] XPATH: Can not convert #S, Palaniappan, Krishna | Thread | [xsl] Using preceding-sibling, Jesse Ehrenzweig |
RE: [xsl] Using preceding-sibling, Bob DuCharme | Date | [xsl] JeniTennison website, mxmodi |
Month |