Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > XML > XSLT
Password Reminder
Register
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
XSLT General questions and answers about XSLT. For issues strictly specific to the book XSLT 1.1 Programmers Reference, please post to that forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the XSLT section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old January 28th, 2004, 04:57 PM
Registered User
 
Join Date: Jun 2003
Location: champaign, IL, USA.
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Default Maximum Length for XSL variable

Hi,

I have tried to find an answer but I can not find one. I thought this board could provide some guidance/assistance. Thanks.

My dilemma is: I'm using --objSessionData("Query")-- to pass a querystring to a xsl variable "P_Query". Though the xsl variable is not holding querys that exceed 2200(or around 2200) characters.

ManyScripts.asp
if oxsldoc.documentelement.selectsinglenode("//xsl:variable[@name='P_Query']") is nothing = false then
oxsldoc.documentelement.selectsinglenode("//xsl:variable[@name='P_Query']").text = objSessionData("Query") end if

someXSL.xsl
<xsl:variable name="P_Query"></xsl:variable>

This works great, however, sometimes the querystring "objSessionData("Query")" can exceed 2200 characters and the xsl variable "P_Query" will not hold the complete querystring.

I'm using "P_Query" to pass the querystring as a link called "Next Page". P_Query holds the search criteria <C><P><O><V></V></O></P></C> and passes the querystring to the next page.

My question: Is there a way to assign maxlength to the xsl variable"P_Query"?

Thank you for your time and assistance -- It's greatly appreciated.

Thanks,
Mike
Reply With Quote
  #2 (permalink)  
Old January 28th, 2004, 05:33 PM
Registered User
 
Join Date: Jun 2003
Location: champaign, IL, USA.
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Default

here's the link structure:
<TR>
<TD align="left" width="30%">
<xsl:if test="number(@Current_Page) &gt; 1">
<A>
<xsl:attribute name="HREF"><![CDATA[_SearchResults.asp?Action=PageBak&Map=]]><xsl:value-of select="$XMLMAPMap"/><![CDATA[&XSL=]]><xsl:value-of select="$ListXSL"/><![CDATA[&Page=]]><xsl:value-of select="@Current_Page"/><![CDATA[&Query=]]><xsl:value-of select="$P_Query"/></xsl:attribute><img src="images/left.gif" border="0"/>Previous Page
</A>
</xsl:if>
</TD>
<TD align="center" width="40%">
<xsl:value-of select="@Record_Count" /> Records Found <BR/>
Page <xsl:value-of select="@Current_Page" /> of <xsl:value-of select="@Page_Count" />
</TD>
<TD align="right" width="30%">
<xsl:if test="number(@Current_Page) &lt; number(@Page_Count)">[/green]

<A>
<xsl:attribute name="HREF"><![CDATA[_SearchResults.asp?Action=PageFwd&Map=]]><xsl:value-of select="$XMLMAPMap"/><![CDATA[&XSL=]]><xsl:value-of select="$ListXSL"/><![CDATA[&Page=]]><xsl:value-of select="@Current_Page"/><![CDATA[&Query=]]><xsl:value-of select="$P_Query"/></xsl:attribute>
Next Page <img src="images/right.gif" border="0"/>
</A>

</xsl:if>
</TD>
</TR>

Thanks,
Mike
Reply With Quote
  #3 (permalink)  
Old January 29th, 2004, 07:25 AM
joefawcett's Avatar
Wrox Author
Points: 9,763, Level: 42
Points: 9,763, Level: 42 Points: 9,763, Level: 42 Points: 9,763, Level: 42
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Exeter, , United Kingdom.
Posts: 3,074
Thanks: 1
Thanked 38 Times in 37 Posts
Default

Which version of DomDocument are you using, I don't know of any limitation on string length, other than max length in VB which is about 65k.
Can you show where you create the DomDocument? Are you sure the full string is being held in the session variable and it's not being truncated before it reaches the xsl?

Aside from that this code is very wasteful, searching twice for the same node:
Code:
if oxsldoc.documentelement.selectsinglenode("//xsl:variable[@name='P_Query']") is nothing = false then
oxsldoc.documentelement.selectsinglenode("//xsl:variable[@name='P_Query']").text = objSessionData("Query") end if
change it to:
Code:
Dim oSearchNode
Set oSearchNode = oxsldoc.documentElement.selectSingleNode("//xsl:variable[@name='P_Query']")
If Not oSearchNode Is Nothing Then
  oSearchNode.text = objSessionData("Query")
End If
Joe (MVP - xml)
Reply With Quote
  #4 (permalink)  
Old January 29th, 2004, 10:31 AM
Registered User
 
Join Date: Jun 2003
Location: champaign, IL, USA.
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi Joe,

Thanks for assisting. The objSessionData("Query")does contain the entire querystring. The initial search criteria is passed using objSessionData("Query")and it returns the first page of search results. However when you click on the "Next Page" link (the P_Query variable) nothing happens (and again this is only when the search criteria is extremely long). I agree I didn't find any text that gave a maximum length. It's driving me mad =)

Here is the domdocument info:


function XMLTransform(sXMLDoc,sXSLDoc)
dim oXmlDoc
dim oXslDoc

set oXmlDoc = Server.CreateObject("Msxml2.DOMDocument.3.0")
set oXslDoc = Server.CreateObject("Msxml2.DOMDocument.3.0")
oXmlDoc.async = false
oXslDoc.async = false
oxmldoc.preservewhitespace = false
oXmlDoc.load(application("XMLDir") & "\" & sXMLDoc)
if oXmlDoc.parseError.errorCode <> 0 then
response.write "The following error occurred while processing the XML file: <br>" & oXmlDoc.parseError.errorCode & ", " & oXmlDoc.parseError.reason & ", " & oXmlDoc.ParseError.line
end if

oXslDoc.load(application("XSLDir") & "\" & sXSLDoc)
oxsldoc.setProperty "SelectionLanguage", "XPath"
oxsldoc.setProperty "SelectionNamespaces", "xmlns:xsl='http://www.w3.org/1999/XSL/Transform'"
if oXslDoc.parseError.errorCode <> 0 then
response.write "The following error occurred while processing the XSL stylesheet: <br>" & oXslDoc.parseError.errorCode & ", " & oXslDoc.parseError.reason
        response.end
end if

Thanks again Joe. I do appreciate your time and knowledge.

Mike
Reply With Quote
  #5 (permalink)  
Old January 29th, 2004, 12:04 PM
joefawcett's Avatar
Wrox Author
Points: 9,763, Level: 42
Points: 9,763, Level: 42 Points: 9,763, Level: 42 Points: 9,763, Level: 42
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Exeter, , United Kingdom.
Posts: 3,074
Thanks: 1
Thanked 38 Times in 37 Posts
Default

If you run this code, it needs WScript installed so Windows only, you'll see that the file is fine, IE won't display it properly but if opened in text editor it's all there. So there must be a problem elsewhere. FILE_PATH needs altering before you run it.
Code:
var DATA_LENGTH = 10000;
var FILE_PATH = "E:\\scripts\\xml\\longString.xml"; //Change this to somewhere local

function getDomDoc()
{
  var oDom =  new ActiveXObject("Msxml2.DomDocument.3.0");
  oDom.async = false;
  return oDom;
}

function main()
{
  var oDom = getDomDoc();
  var sXml = "<root/>";
  oDom.loadXML(sXml);
  var sText = "1";
  for (var i = 1; i < DATA_LENGTH - 1; i++)
  {
    sText += "0";     
  }
  sText += "1";
  var oNode = oDom.selectSingleNode("root");
  oNode.text = sText;
  oDom.save(FILE_PATH);
  WScript.echo("Done");
}

main();


--

Joe
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Maximum length of http Object mohan.karunanidhi Ajax 2 November 21st, 2006 06:11 AM
How to set a length of a Variable rtr1900 ASP.NET 1.0 and 1.1 Basics 2 May 19th, 2006 01:07 AM
Maximum Request Length exceeded? dparsons ASP.NET 1.0 and 1.1 Professional 0 March 23rd, 2006 12:41 AM
Setting xsl:variable maximum count isme XSLT 2 March 14th, 2006 03:39 AM
make textbox maximum length of <td> cell crmpicco Javascript How-To 0 October 19th, 2005 10:46 AM



All times are GMT -4. The time now is 05:56 PM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.