Jump to content

assigning the value of an xml node element to div tag


tamanna35
 Share

Recommended Posts

HelloI want to know, how can I assign the value of an xml node element to a div tag.The reason I want this is I have xml which is like below<ProductList><ProductDetails> <ProductID> AX1 </ProductID> <ProductType> Commercial </ProductType> <ProductValue> Tradeable </ProductValue> <ProductBuyer> Bulk </ProductBuyer><ProductDetails><ProductDetails> <ProductID> AX1 </ProductID> <ProductName> Zeefolex </ProductName> <ProductCode> ARN005</ProductCode> <ProductChain> Continuous </ProductChain><ProductDetails><ProductDetails> <ProductID> AX2 </ProductID> <ProductType> Commercial </ProductType> <ProductValue> Tradeable </ProductValue> <ProductCost> 543 </ProductCost><ProductDetails><ProductDetails> <ProductID> AX2 </ProductID> <ProductName> Cabezon </ProductName> <ProductCode> ARN00776</ProductCode> <ProductChain> Spread </ProductChain><ProductDetails></ProductList>the information of product is present as multiple xml nodes , like for product AX1 , we have 2 different xml node bringing different information. and this is being displayed in the form of a table on the page. I do not have control over the type of xml, that I am receiving, As we have continuous rows of different information of same product, I WANT to assign a separate div tag to all the rows containing information about same product, I want to highlight all the rows belonging to the same product when the user takes his mouse on any one of the rows.And if they click on any of the rows, it takes them to a page that contains all the information about that single product.So I am facing problem As we have continuous rows of different information of same product, I WANT to assign a div tag to all the rows containing information about same product, it is using a loop <xsl:for each............> to display all the information in seperate rowsSo what I want is , everytime it loops, it assigns the product id as div id or class, and I can add a function and pass this div id or class as an argument to that functionlike <xsl:for-each select="//ProductList/ProductDetails"><div id=<xsl:value-of select ='./ProductID'> <tr onmouserollover= highlighteffect(./ProductID)>>and then define this function highlighteffect, such that it highlights all the rows under the div tag with same id.Can this be done, assigning the node element to the div id or class.Cause when I tried I got errors , like assigning the same div tag , div tag has already been used.and when I tried this <div id=<xsl:value-of select ='./ProductID'> I got an error something like "<" unexpected element for the underlined "<" ORIs there any other method to associate rows belonging to same product?thank you very muchOR how can I do grouping on this data?

Edited by cimon
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...