RE: [xsl] New to XSLT: problem with passing param

Subject: RE: [xsl] New to XSLT: problem with passing param
From: "Michael Kay" <mike@xxxxxxxxxxxx>
Date: Thu, 3 Feb 2005 16:12:33 -0000
In the expression

count(ancestor::decisiontree_question=$stop_question)

the argument to count() is a boolean, not a node-set.

Perhaps you meant

count(ancestor::decisiontree_question[.=$stop_question])

or perhaps not, since ancestor elements don't usually have a useful string
value.

Michael Kay
http://www.saxonica.com/ 

> -----Original Message-----
> From: Sanjukta Mitra [mailto:sanmit27@xxxxxxxxx] 
> Sent: 03 February 2005 15:48
> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Subject: [xsl] New to XSLT: problem with passing param
> 
> Hi,
> 
> I am fairly new to XSLT and am trying to write a
> stylesheet that will convert an XML decision tree to a
> flowchart in SVG. This is a binomial decisiontree and
> I am facing the problem of overlapping nodes.To solve
> this I am trying to use a parameter that calculates
> some positions in one template and passes it on to
> another template.Can anyone please help me figure out
> what I am doing wrong here.
> 
> Thanks
> Sanjukta
> 
> I am getting the following error:
> 
> Error at xsl:param on line 211 of
> file:/C:/REDworks/src/xslt/red2svg_testtree.xsl:
> 
>            The value is not a node-set
> 
>          Transformation failed: Run-time errors were
> reported
> 
>  Line 211 is the line where I am defining the
> parameter "Cnt"
> 
> 
> Here goes the relevant portion of the code:
> 
> 
> 
> 
> <xsl:template match="enumerated_type_ptr">
>         <xsl:param name="XT"/>
>         <xsl:param name="YT"/>
>         <xsl:param name="XTxt"/>
>         <xsl:param name="YTxt"/>
>         <xsl:param name="rx" select="22"/>
>         <xsl:param name="width" select="75"/>
>         <xsl:param name="height" select="40"/>
>         <xsl:param name="subtype"
> select="id(@ptr)/title/@titleabbrev"/>
>         <xsl:param name="subtype_length"
> select="string-length($subtype)"/>
>         <xsl:param name="stop_question"
> select="ancestor::decisiontree_question[../decisiontree_answer
> [@answer='yes']][1]"/>
>         <xsl:param name="Cnt"
> select="count(ancestor::decisiontree_answer[@answer='no'][coun
> t(ancestor::decisiontree_question=$stop_question)
> &gt;0])"/>
>         <xsl:param name="Ctr" select="($Cnt)-1"/>
>         <xsl:param name="X1"
> select="($XT)-80-($Ctr)*140"/>
>         <xsl:param name="Y1" select="($YT)-78"/>
>         <xsl:param name="Variable_width"
> select="($XT)+10"/>
>         
>       <svg:rect..../>
> ..................
>       <svg:text..../>
>         
>         <xsl:apply-templates
> select="./decisiontree_answer[@answer='no']"
> mode="No">
> 	            <xsl:with-param name="X1"
> select="($XT)-80-($Ctr)*140"/>
> 	            <xsl:with-param name="Y1"
> select="($YT)-78"/>
> 	            <xsl:with-param name="Variable_width"
> select="($XT)+10"/>
>         </xsl:apply-templates>
>         
>         
>     </xsl:template>
> 
> 
> 
> 
> 
> 		
> __________________________________ 
> Do you Yahoo!? 
> Yahoo! Mail - Find what you need with new enhanced search.
> http://info.mail.yahoo.com/mail_250

Current Thread