This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]