[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

RE: ways to use position()

Subject: RE: ways to use position()
From: Kay Michael <Michael.Kay@xxxxxxx>
Date: Mon, 8 Jan 2001 10:27:25 -0000
position in msxml3
> 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

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.