Subject: RE: [xsl] ways to use position() From: Kay Michael <Michael.Kay@xxxxxxx> Date: Mon, 8 Jan 2001 10:27:25 -0000 |
> Can anyone please tell me whether there are other ways touse > position() apart from position=1? You seem to have made a number of misunderstandings. > I tried the following: > > <xsl:variable name="qNum"> > <script> > function getQuestionNumber() > { > parent.qNo; > } > </script> > </xsl:variable> > The value of this variable is a result tree fragment containing a <script> element. You seem to be expecting that the script will be executed; it won't. There's nothing magic about the <script> tag in XSLT that would cause this to happen. Some XSLT processors, e.g. MSXML3, do allow JavaScript code to be executed as part of the transformation, but you need special vendor-defined tags (msxml:script) to achieve this. > <xsl:template > match="Categorydefs/CategoryDef/QuestionDefs/QuestionDef[position()=$qNum]" You can't use variable references within the match pattern of <xsl:template>. If you used msxml:script, you could call a JavaScript external function within the pattern, writing for example "...[position()=js:getQuestionNumber()]" But I'm not sure what you expect your piece of script to do: what is "parent" supposed to mean? If you explain your problem on this list, rather than your incorrect solution, someone will probably come up with a much simpler answer. Mike Kay XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
[xsl] ways to use position(), Rosa I-Ting Cheng | Thread | [xsl] storing a variable value usin, Rosa I-Ting Cheng |
Re: [xsl] storing a variable value , Jeni Tennison | Date | [xsl] DTD Problem, ABHAY Andre |
Month |