This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
Hi there, I'm trying to render certain data into the browser. In particular: 1. To render all products in stock (which include those already available and will be available 2 days after placing the order) - displaying full product dtls (all elements) 2. To render all products having a delivery charge of less than 3 dollars. Here's my xml:
Here's my attempt at no.1:
I know the syntax is wrong for the if statement - how should it be done? And no.2 attempt:
At the moment for the above xsl file, I dont get any results displayed. Where am I going wrong? At the moment I have to change the file name in the xml doc to select the relevant xsl document - but is there a smart way to be able to create a singe xml document that links to multiple xsl files?
Some quick tips: 1) You need to encode the "<" and ">" within your if statements as "<" and ">" 2) You're referring to "InStock" and "LeadTime" when you should be referring to "Stock/InStock" and "Stock/LeadTime" 3) You've got a typo in "Product/Product"
4) If the LeadTime elements have values like "3 working days", you can't do a numeric comparison with "<" etc. Instead, you need to use a string function like substring-before(Stock/LeadTime, ' '), which strips away everything except the number you want to compare with something. There's a decent XPath/XSL function reference at w3schools.com
Joined: May 04, 2004
Thanks Lasse, I used a 'when' instead of the 'if; fixed the typos and it seems to work now. Just got to find a decent parser to use now. Thanks for your help.