Photo Gallery Member List Search Calendars FAQ Ticket List Log Out


How to re order the nodes in XSL using VBscript

 
Logged in as: Guest
arrSession:exec spGetSession 2,3,2791
 Active Users: There are 0 members and 0 guests.
 Users viewing this topic: none
 

 

 
  
  Printable Version
All Forums >> [Scripting] >> ASP >> How to re order the nodes in XSL using VBscript
  Do you like VisualBasicScript.com? Link to us and help spread the word about our forum. Thanks!
Page: [1]
Login
Message << Older Topic   Newer Topic >>
 How to re order the nodes in XSL using VBscript - 4/25/2005 12:58:33 AM   
  vivekthangaswamy

 

Posts: 2
Score: 0
Joined: 4/25/2005
From:
Status: offline
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

Can any one find a solution for this?


View the following code for ref.

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
--------------------------Testing the loop for Reorder---------------

'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)
 
 
Post #: 1
 
 
 
  

If you found our site useful please link to us <a href="http://www.visualbasicscript.com">VisualBasicScript.com</a>.
All Forums >> [Scripting] >> ASP >> How to re order the nodes in XSL using VBscript Page: [1]
Jump to:





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts