XML Editor
Sign up for a WebBoard account Sign Up Keyword Search Search More Options... Options
Chat Rooms Chat Help Help News News Log in to WebBoard Log in Not Logged in
Conferences Close Tree View
+ Stylus Studio Feature Requests (1192)
+ Stylus Studio Technical Forum (14621)
+ Website Feedback (249)
- XSLT Help and Discussion (7625)
-> + Use of before and after string (3) Sticky Topic
-> - How do I substitute element ty... (1)
-> + How does one add working days ... (4)
-> - Help, I have existing XLT and... (1)
-> + Need help on XSLT issue - (2)
-> + EDI to XML Conversion (7)
-> - XML To JSON Conversion using X... (1)
-> + Formatting Paragraphs to same ... (2)
-> - Grouping of records (1)
-> + Problems with xsd 1.1 (4)
-> + XML to HL7 mapping (3)
-> + XSLT 3 and Iterate (2)
-> + XSL-FO to PDF preview (3)
-> + java.lang.RuntimeException: Er... (2)
-> + Create Acroforms with Stylus X... (2)
-> + How to change XSLT parameter s... (3)
-> + how to change format of the da... (2)
-> + Search "Next 8 Results " doesn... (2)
-> - Support for Git (1)
-> + newbee (8)
-- [1-20] [21-40] [41-60] Next
+ XQuery Help and Discussion (2017)
+ Stylus Studio FAQs (159)
+ Stylus Studio Code Samples & Utilities (364)
+ Stylus Studio Announcements (113)
Topic  
Postnext
Rinni VermaSubject: "URGENT PLEASE" How to select more than one item using loop
Author: Rinni Verma
Date: 15 Jul 2005 10:46 AM
Please let me know How to select more than one item using <XSL:for-each> loop

<CustomerOrder>
<CustomerInformation>
<CustomerNumber>18823</CustomerNumber>
<Addresses>
<Address type="shipping">
<Customer Name>Widget Corp.</CustomerName>
<Address>1234 Michigan Ave</Address>
<City>Chicago</City>
<State>IL</State>
<Zip>60614</Zip>
</Address>
<Address type="billing">
<Customer Name>Widget Corp.</CustomerName>
<Address>1234 Michigan Ave</Address>
<City>Chicago</City>
<State>IL</State>
<Zip>60614</Zip>
</Address>
</Addresses>
</CustomerInformation>
<OrderInformation>
<OrderNumber>900128844</OrderNumber>
<LineItems>
<Item>
<Field Name="SKU" Value="19923" />
<Field Name="Description" Value="Carburating widget" />
<Field Name="Quantity" Value="12" />
<Field Name="PricePer" Value="500" />
<Item>
</Item>
</LineItems>
<Subtotal>7298.50</Subtotal>
<ShippingAmount>200</ShippingAmount>
<TaxAmount>500</TaxAmount>
<Total>7998.50</Total>
<OrderDate>20010422</OrderDate>
</OrderInformation>
</CustomerOrder>

In the xml above, I need to retrieve the values of the fields SKU and Description.

Thanks.

Rinni

Postnext
Minollo I.Subject: No Topic
Author: Minollo I.
Date: 16 Jul 2005 09:58 AM
I'm not sure on what you are looping, or what you want to create as an output; but I hope something like this can help to get you started:

...
<xsl:for-each select="CustomerOrder/OrderInformation/LineItems/Item">
The SKU is <xsl:value-of select="Field[@Name='SKU']/@Value"/>
...and its description is <xsl:value-of select="Field[@Name='Description']/@Value"/>
</xsl:for-each>
...

Minollo

Postnext
anthony tranSubject: No Topic
Author: anthony tran
Date: 18 Jul 2005 10:46 AM
Hi all:

I have similar problem.

Hi all,

Let's say this is my XML

<policy>
<poldoc category="dars">
<idno>1234</idno>
<doctitle> ABC </doctitle>
<doctype>Adobe PDF</doctype>
</poldoc>
<poldoc category="dars">
<idno>5678</idno>
<doctitle> EDF </doctitle>
<doctype>Adobe PDF</doctype>
<attach>
<doc name="attachement 1">http://www.abc.com</doc>
<doc name="attachement 2">http://www.edf.com</doc>
</attach>
</poldoc>
</policy>

Basically, it's about posting policies. Each policy (<poldoc>) is very the same but some has attached file, some doesn't. And, it can be one or more than 2 attachments. I don't know how to loop through the XML file in order to pull out all attachments (if there is any)

Here is my XSL

<table>
<tr>
<th>category</th>
<th>track number</th>
<th>title</th>
<th>format</th>
<th>attachement</th>
<tr>
<xsl:for-each select="policy/poldoc">
<tr>
<td><p><xsl:value-of select="idno"/></p></td>
<td><p><xsl:value-of select="doctitle"/></a></p></td>
<td><p><xsl:value-of select="doctype"/></p></td>
<xsl:choose>
<xsl:when test="count(attach) &gt; 0">
<td>
<xsl:for-each select="//attach">
<p><a href="{doc}"><xsl:value-of select="doc/@name"/></a></p>
</xsl:for-each>
</td>
</xsl:when>
<xsl:otherwise>
<td><p>none</p></td>
</xsl:otherwise>
</xsl:choose>

</tr>
</xsl:for-each> </table>

It just pulls out only one attach.
Please help...Thank you very much

Postnext
Ivan PedruzziSubject: No Topic
Author: Ivan Pedruzzi
Date: 18 Jul 2005 11:52 AM

You have to change the for-each

<xsl:for-each select="//doc">
<p><a href="{.}"><xsl:value-of select="@name"/></a></p>
</xsl:for-each>

Hope this helps
Ivan Pedruzzi
Stylus Studio Team

Postnext
anthony tranSubject: No Topic
Author: anthony tran
Date: 18 Jul 2005 04:29 PM
AWSOME
IT WORKS
THANKS A LOT

Postnext
anthony tranSubject: No Topic
Author: anthony tran
Date: 19 Jul 2005 04:38 PM
Originally Posted: 19 Jul 2005 04:31 PM
Ivan <br> It works, but not actually the way I want I changed the for select as the way you showed, it pulls out ALL attach elements. Well, what I'm looking for in layout result is if one has attachments then it should list only attachments belong to that one only, not ALL attachment found in XML Please Help....THANKS A LOT !! For example: if <idno>5678</idno> has its own 2 attachments and <idno>9101<idno>also has its own 2 attachments.Then the result will show 2 attachments for <idno>5678</idno> and 2 attachments for <idno>9101</idno> separatedly. The method you showed me earlier, it show ALL attachments for any <poldoc> that has <attach> ... Hope you understand what I'm trying to say here .....

Posttop
Ivan PedruzziSubject: No Topic
Author: Ivan Pedruzzi
Date: 19 Jul 2005 04:53 PM


If you need only the "doc" elements under the context node use .

<xsl:for-each select=".//doc">
<p><a href="{.}"><xsl:value-of select="@name"/></a></p>
</xsl:for-each>

Ivan

   
Download A Free Trial of Stylus Studio 6 XML Professional Edition Today! Powered by Stylus Studio, the world's leading XML IDE for XML, XSLT, XQuery, XML Schema, DTD, XPath, WSDL, XHTML, SQL/XML, and XML Mapping!  
go

Log In Options

Site Map | Privacy Policy | Terms of Use | Trademarks
Stylus Scoop XML Newsletter:
W3C Member
Stylus Studio® and DataDirect XQuery ™are from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2016 All Rights Reserved.