Sign Up
Search
Options
search
Chat
Help
News
Log in
Not Logged in
Home
»
Boards
»
Stylus Studio Developer Network
»
XSLT Help and Discussion
»
Paging with XSL and passing URL parameter (using javascript)
Conferences
Stylus Studio Feature Requests
(1192)
Stylus Studio Technical Forum
(14621)
Website Feedback
(249)
XSLT Help and Discussion
(7625)
Mapping complex document with ...
(8)
Sorting in XSLT
(2)
xsl date time adding...
(16)
Flat XML to nested XML convers...
(1)
parser for parsing XSL file
(2)
q on group function
(1)
compare 2 date value using xsl
(2)
Remove namespaces from SOAP pa...
(1)
Numeric string not displaying ...
(3)
where is the old HTM to XSL wi...
(2)
XSLT variable path
(2)
Sort by lookup values & styles...
(2)
Hi without hard code filed na...
(2)
XSLT output does not work
(2)
How can I do this javascript i...
(2)
Paging with XSL and passing UR...
(2)
Paging with XSL and passi...
XPath Condition Query
(3)
Xalan Multiple XML Output Over...
(3)
Inserting Line Break
(2)
Get Value from non-standard xm...
(2)
Previous
[541-560]
[561-580]
[581-600]
Next
XQuery Help and Discussion
(2017)
Stylus Studio FAQs
(159)
Stylus Studio Code Samples & Utilities
(364)
Stylus Studio Announcements
(113)
Topic
next
Subject:
Paging with XSL and passing URL parameter (using javascript)
Author:
Yama Kamyar
Date:
22 Sep 2008 01:57 PM
Originally Posted: 19 Sep 2008 01:27 PM
Hi,
I have a very large XML file in CruiseControl.NET 1.4 which I want to display its data to the browser.
In my XSL I have created the following:
<xsl:param name="pageNumber" select="0" />
When the user clicks on a "Next" link the page is refreshed with the addition of
http://server/page.aspx?pageNumber=2
I have tried using msxml:script but it did not work because it complained about a javascript object: window.location.href. The error was it could not locate 'window' object or something like that.
ALL I want is when the page refreshes I get:
the value of pageNumber
http://server/page.aspx?pageNumber=2
populate this:
<xsl:param name="pageNumber" select="2" />
Very pretty straight forward but could not figure out how... I searched everywhere on the web and could not find anything.
Is there a solution you know of?
Thanks,
Yama
top
Subject:
Paging with XSL and passing URL parameter (using javascript)
Author:
Yama Kamyar
Date:
22 Sep 2008 01:59 PM
Originally Posted: 19 Sep 2008 05:40 PM
for those of you who think this wasn't possibly... Here is the solution:
<xsl:stylesheet
version="1.0"
xmlns:xsl="
http://www.w3.org/1999/XSL/Transform"
xmlns:msxml="urn:schemas-microsoft-com:xslt"
xmlns:csharp="
http://csharp"
exclude-result-prefixes="xsl msxml csharp">
<msxml:script implements-prefix="csharp" language="C#">
<msxml:using namespace="System.Collections"/>
<msxml:assembly name="System.Web"/>
<msxml:using namespace="System.Web"/>
<![CDATA[
public int GetPageNumber() {
int page = 0;
if(HttpContext.Current.Request.QueryString["pageNumber"] != null)
{
if(HttpContext.Current.Request.QueryString["pageNumber"].Length > 0)
{
page = Convert.ToInt32(HttpContext.Current.Request.QueryString["pageNumber"]);
}
}
return page;
}
]]>
</msxml:script>
<xsl:output method="html"/>
<xsl:template match="/">
<script type="text/javascript">
function foo()
{ return "your javascript here"; }
</script>
<style type="text/css">
body {
font:normal 88% verdana,arial,helvetica;
color:#000000;
}
table tr td, tr th {
font-size: 88%;
}
</stlye>
</xsl:template>
<xsl:template match="files">
<xsl:param name="recordsPerPage" select="10" />
<xsl:param name="pageNumber" select="number(csharp:GetPageNumber())" />
<xsl:param name="recordCount" select="count(//file)" />
<xsl:for-each select="//file">
<xsl:if test="position() > $recordsPerPage * number($pageNumber) and
position() <= number($recordsPerPage * number($pageNumber) +
$recordsPerPage)">
<!-- Display 50Mb XML -->
</xsl:if>
</xsl:for-each>
<span style="Z-INDEX: 101; LEFT: 261px; WIDTH: 501px;">
<xsl:if test="$pageNumber > 0">
<xsl:element name="a">
<xsl:attribute name="href">?pagenumber=<xsl:value-of select="number($pageNumber)-1" />
</xsl:attribute>
<< Previous Page
</xsl:element>
       
</xsl:if>
<xsl:if test="($recordCount - ((1+number($pageNumber)) * $recordsPerPage))> 0">
<xsl:element name="a">
<xsl:attribute name="href">?pagenumber=<xsl:value-of select="number($pageNumber)+1" />
</xsl:attribute>
Next page >>
</xsl:element>
</xsl:if>
</span>
</xsl:template>
Hope this helps many others. Please let me know if anyone has questions.
Yama Kamyar
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 to Conference:
Select Conference
Stylus Studio Feature Requests
Stylus Studio Technical Forum
Website Feedback
XSLT Help and Discussion
XQuery Help and Discussion
Stylus Studio FAQs
Stylus Studio Code Samples & Utilities
Stylus Studio Announcements
go
Log In Options
Username:
Password:
Site Map
|
Privacy Policy
|
Terms of Use
|
Trademarks
Stylus Scoop XML Newsletter:
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.