Subject: Re: [xsl] XPATH: Can not convert #STRING to a NodeList! From: Jeni Tennison <mail@xxxxxxxxxxxxxxxx> Date: Fri, 22 Dec 2000 10:23:48 +0000 |
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 -> |
---|---|---|
[xsl] XPATH: Can not convert #STRIN, Palaniappan, Krishna | Thread | RE: [xsl] XPATH: Can not convert #S, Weakliem, Gordon |
Re: [xsl] White space - preserving , Conor Ryan | Date | Re: [xsl] Remove <?xml version> lin, Jeni Tennison |
Month |