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
Conferences Close Tree View
+ Stylus Studio Feature Requests (1192)
+ Stylus Studio Technical Forum (14621)
+ Website Feedback (249)
- XSLT Help and Discussion (7625)
-> + pass xsl-variable to javascrip... (2)
-> + Character Encoding of an exist... (5)
-> + Convert xml to Spss syntax (2)
-> + Appending XML data (4)
-> + newbie..... create XSL from XM... (5)
-> + Mapping xslt files - beginner ... (3)
-> + consolidating footnotes (2)
-> + xslt tranformation using msxml... (2)
-> + xslt - one input xml and outpu... (2)
-> + XSL record lookup via a extern... (3)
-> + difficult problem for an xslt ... (2)
-> - Help, is it possible to have a... (2)
-> ->Help, is it possible to h...
-> + XML Scenarios (2)
-> + Too Many XSLTs Need a better o... (3)
-> + Transforming ADO output (4)
-> + remove commas, single quotes, ... (2)
-> + problem writing & character in... (6)
-> + get a default value for any at... (2)
-> - set new value fro a default te... (1)
-> - get a default value for xslt (1)
-- Previous [1321-1340] [1341-1360] [1361-1380] Next
+ XQuery Help and Discussion (2017)
+ Stylus Studio FAQs (159)
+ Stylus Studio Code Samples & Utilities (364)
+ Stylus Studio Announcements (113)
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.

   
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.