XSLT for-each from query results

Posted by Ben Record on Stack Overflow See other posts from Stack Overflow or by Ben Record
Published on 2012-07-06T21:12:49Z Indexed on 2012/07/06 21:15 UTC
Read the original article Hit count: 217

Filed under:

I've been on a hunt for a while trying to find a solution to this but I cannot find anywhere that addresses this problem.

I'm running a SQL query through XSLT which will return three rows. Here is the query:

<query name="OrderedProductNames" rowElementName ="OrderedItem">
    <sql>
        <![CDATA[
            select OrderedProductName, Quantity from Orders_ShoppingCart where OrderNumber = 101689 // Hard coded order number for testing purposes.
        ]]>
    </sql>
</query>

Ideally, I would like to iterate through each row returned and do a choose when which is tested on a variable from the current row being inspected in the for-each loop, but I am not entirely sure thhis is possible.

My secondary thought would be to use the for-each loop as a way to inject hidden HTML input elements with the values I would need, then I could write a javascript function to complete what I'm trying to do.

Any suggestion on how I would go about completing either task would be greatly appreciated.

© Stack Overflow or respective owner

Related posts about xslt