XML Editor
Sign up for a WebBoard account Sign Up Keyword Search Search More Options... Options
Chat Rooms Chat Help Help News News Log in to WebBoard Log in Not Logged in
Show tree view Topic
Topic Page 1 2 3 4 5 6 7 8 9 Go to previous topicPrev TopicGo to next topicNext Topic
Postnext
hari jayramanSubject: Help, is it possible to have a javascript variable
Author: hari jayraman
Date: 15 Sep 2006 08:44 AM
Hi gurus,

Is it possible to copy a value for XSL variable from a javascript variable?

Basically I have a counter set in my javascript file (global variable say 'mycount') and in my xslt I need to use the value of mycount to loop through the xsl:for-each

my js file (myscript.js)
<script>
//global variables
mycount=5;
.....
......
</script>

my xsl file (myxsl.xsl)
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
>

<xsl:output method="html" encoding="UTF-8" indent="yes" doctype-public="-//W3C//DTD HTML 4.01 Transitional//EN" />

<xsl:template match="/">
.......
....... (call-template)
</xsl:template>

<!-- User defined Templates -->
1.<xsl:template name="ItemTableContent">
2. <script src="js/myscript.js"></script>
3. <script>parent.mycount)</script>
4. <xsl:variable name="test" select="5"/>

5. <xsl:for-each select="book/data/item[position() &lt;= number($test)]">
.....
.....

So in line 4 when I see the xsl (IE) getting the alert with correct value, but how I can make that available to the xsl variable <b>test<b>, so I can restrict the loop to the specified count.

I appreicate your time and guidance.

Thanks and Regards
Hari

Posttop
hari jayramanSubject: Help, is it possible to have a javascript variable
Author: hari jayraman
Date: 15 Sep 2006 08:49 AM
>Hi gurus,
>
>Is it possible to copy a value
>for XSL variable from a
>javascript variable?
>
>Basically I have a counter set
>in my javascript file (global
>variable say 'mycount') and in
>my xslt I need to use the
>value of mycount to loop
>through the xsl:for-each
>
>my js file (myscript.js)
><script>
> //global variables
> mycount=5;
> .....
> ......
></script>
>
>my xsl file (myxsl.xsl)
><?xml version="1.0"
>encoding="UTF-8"?>
><xsl:stylesheet
>version="1.0"
>xmlns:xsl="http://www.w3.org/1
>999/XSL/Transform"
> >
>
><xsl:output method="html"
>encoding="UTF-8" indent="yes"
>doctype-public="-//W3C//DTD
>HTML 4.01 Transitional//EN"
>/>
>
><xsl:template match="/">
>.......
>....... (call-template)
></xsl:template>
>
><!-- User defined Templates
>-->
>1.<xsl:template
>name="ItemTableContent">
>2. <script
>src="js/myscript.js"></s
>cript>
>3.
><script>parent.mycount)&
>lt;/script>
>4. <xsl:variable
>name="test" select="5"/>
>
>5. <xsl:for-each
>select="book/data/item[positio
>n() &lt;=
>number($test)]">
>.....
>.....
>
>So in line 4 when I see the
>xsl (IE) getting the alert
>with correct value, but how I
>can make that available to the
>xsl variable
><b>test<b>, so I
>can restrict the loop to the
>specified count.
>
>I appreicate your time and
>guidance.
>
>Thanks and Regards
>Hari


A correction in line
3.<script>parent.mycount)</script> and

and rewriting the question

When I see the xsl (in IE) I am getting the of line 3) with correct expected value, but how I can make that available to the xsl variable <b>test<b>, so that I can restrict the xsl:for-each loop to the specified count.

 
Topic Page 1 2 3 4 5 6 7 8 9 Go to previous topicPrev TopicGo to next topicNext Topic
Download A Free Trial of Stylus Studio 6 XML Professional Edition Today! Powered by Stylus Studio, the world's leading XML IDE for XML, XSLT, XQuery, XML Schema, DTD, XPath, WSDL, XHTML, SQL/XML, and XML Mapping!  
go

Log In Options

Site Map | Privacy Policy | Terms of Use | Trademarks
Stylus Scoop XML Newsletter:
W3C Member
Stylus Studio® and DataDirect XQuery ™are from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2016 All Rights Reserved.