codetoad.com
  ASP Shopping CartForum & BBS
  - all for $20 from CodeToad Plus!
  
  Home || ASP | ASP.Net | C++/C# | DHTML | HTML | Java | Javascript | Perl | VB | XML || CodeToad Plus! || Forums || RAM 
Search Site:
Search Forums:
  How to reorder or Re arrange the node in XSL Using ASP and VBScript  vivekthangaswamy at 06:45 on Tuesday, April 26, 2005
 

How to display the following.

<PRODUCT productid="12678" catalogname="Movie">

<PRODUCTVARIANT hideremove="0" DisplayOrder="2" itemindex="0" sku="SKU_ET_33705_1" title="BB"/>
<PRODUCTVARIANT hideremove="0" DisplayOrder="3" itemindex="1" sku="SKU_ET_33705_2" title="CC"/>
<PRODUCTVARIANT hideremove="0" DisplayOrder="1" itemindex="2" sku="SKU_ET_33705_3" title="AA"/>

</PRODUCT>


The above XSL node 'PRODUCTVARIANT' should sort using VBscript and ASP3.0. The node should sorted using 'DisplayOrder' attribute value.
the DisplayOrder value may vary from 1 to n. Some more attribute are there in that node 'PRODUCTVARIANT' . The key attribute used is 'DisplayOrder'.Can Any one try this. Some code i tried is attached in this thread


My Code::

set oProduct = oEventCatalog.GetProduct(productid)
if ( not oProduct is nothing ) then
Set oNode = xoService.CreateElement("PRODUCT")

oNode.setAttribute "productid" , oProduct.productid
oNode.setattribute "catalogname" , oProduct.CatalogName

Set oProductVariants = oProduct.Variants
'i=0
while oProductVariants.eof = false

if oProductVariants("IsDisabled") = 1 then
'Do nothing
else
Set oVariantNode = xoService.CreateElement("PRODUCTVARIANT")
oVariantNode.setAttribute "DisplayOrder", oProductVariants.fields("DisplayOrder")
'oVariantNode.setAttribute "itemindex", i
'i = i + 1

'dim L(0)
V = XoService.childNodes.length
redim L(V)

for i = 0 to V - 1
D = oVariantNode.getAttribute("DisplayOrder")
'if oVariantNode.getAttribute("DisplayOrder") = L(i)
L(i) = D
if L(i) > L(i + 1) Then
tempvar = L(i)
L(i) = L(i + 1)
L(i + 1) = tempvar
end if
Next

if ( not IsNull(oProductVariants.fields("qtyAvailable")) ) then
oVariantNode.setAttribute "IsDisabled", oProductVariants.fields("IsDisabled")
else
oVariantNode.setAttribute "IsDisabled", "0"
end if

oVariantNode.setAttribute "sku", oProductVariants.fields("sku")
oVariantNode.setAttribute "title", oProductVariants.fields("title")
'
if ( not IsNull(oProductVariants.fields("qtyAvailable")) ) then
oVariantNode.SetAttribute "qtyavailable", oProductVariants.fields("qtyavailable")
else
oVariantNode.SetAttribute "qtyavailable", "9999"
end if
if ( not IsNull(oProductVariants.fields("maxperorder")) ) then
oVariantNode.setAttribute "maxperorder", oProductVariants.fields("maxperorder")
else
oVariantNode.setAttribute "maxperorder", "9999"
end if
if ( not IsNull(oProductVariants.fields("minperorder")) ) then
oVariantNode.setAttribute "minperorder", oProductVariants.fields("minperorder")
else
oVariantNode.setAttribute "minperorder", "9999"
end if
oVariantNode.setAttribute "cy_list_price", oProductVariants.fields("cy_list_price")
oVariantNode.setAttribute "productname", oProductVariants.fields("productname")

oNode.AppendChild(oVariantNode)

'XoService.insertBefore XoService.createElement("PRODUCTVARIANT"), XoService.childNodes(i)
end if
ProductVariants.MoveNext
wend
oRootNode.AppendChild(oNode)
end if

Set oProductVariants = nothing









CodeToad Experts

Can't find the answer?
Our Site experts are answering questions for free in the CodeToad forums








Recent Forum Threads
•  access connection to JSP
•  Please help this n00bie to make a tabbed table work in Netscape 6+
•  ASP / Frames
•  Re: email with image
•  Re: Windows Authentication using LDAP get user first name
•  Two dimentional array - Dropdown box
•  Mcrypt problem
•  datagrid - paging - print data from particular page
•  How to reorder or Re arrange the node in XSL Using ASP and VBScript


Recent Articles
Communicating with the Database (Using ADO)
MagicGrid
Simple Thumbnail Browsing Solution
Type Anywhere
A Better Moustrap: FmtDate to replace FormatDateTime
ASP.NET Forum Source Code
Internal Search Engine
Javascript Growing Window
Simple date validation
Search engine friendly URLs using ASP.NET (C#.NET)


Site Survey
Help us serve you better. Take a five minute survey. Click here!

© Copyright codetoad.com 2001-2005