Re: [xsl] storing a variable value using <script> tags in between

Subject: Re: [xsl] storing a variable value using <script> tags in between
From: David Carlisle <davidc@xxxxxxxxx>
Date: Mon, 8 Jan 2001 08:55:15 GMT
> <xsl:variable name="qNum">
> <SCRIPT>
> parent.qNo;
> </SCRIPT>
> </xsl:variable>

> so as to get the value of the variable qNo equal to qNum? 

There is nothing special about a result element called SCRIPT to an XSL
engine, so that will make the variable qNum  into the result tree
fragment 

<SCRIPT>
parent.qNo;
</SCRIPT>
</xsl:variable>


In XSLT 1.0 that is just about identical in behaviour to the string
[newline]parent.qNo;[newline]

> I get this:
> parent.qNo;
> 
> while it should be a number....

No, it should be that string.

> and when I try this:
> <xsl:template
> match="Categorydefs/CategoryDef/QuestionDefs/QuestionDef[position()=$qNu
> I get that "Variables may not be used within this expression.

That error message seems quite explicit. If you check the XSLT
specification you will see that you are not allowed to use variables in
match expressions.

> Can anyone please help me here?
You've posted several messages containing invalid XSLT examples, but you
haven't said anywhere what you are trying to do, so it's rather hard to
give any help other than to confirm that your examples are wrong.

> Can anyone please tell me whether I can access certain nodes in the XML when
> I'm programming javascript in it?  

If you are producing HTML then you can include javascript in the output
but the XSLT engine will not see or execute it, the javascript will run
in whatever client is displaying the HTML. In particular the javascript
won't have access to the original XML, only to the generate HTML page in
which it is running.

David

_____________________________________________________________________
This message has been checked for all known viruses by Star Internet delivered
through the MessageLabs Virus Control Centre. For further information visit
http://www.star.net.uk/stats.asp

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread